1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: listbox.h
|
|
|
|
// Purpose: wxListBox class
|
1999-10-10 14:36:14 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-10-10 14:36:14 -04:00
|
|
|
// Created: 10/09/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-10-10 14:36:14 -04:00
|
|
|
// Copyright: (c) David Webster
|
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_LISTBOX_H_
|
|
|
|
#define _WX_LISTBOX_H_
|
|
|
|
|
1999-10-22 18:00:20 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// simple types
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-10 14:36:14 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
|
|
|
class WXDLLEXPORT wxOwnerDrawn;
|
|
|
|
|
|
|
|
// define the array of list box items
|
|
|
|
#include <wx/dynarray.h>
|
|
|
|
|
1999-10-22 18:00:20 -04:00
|
|
|
WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray);
|
|
|
|
#endif // wxUSE_OWNER_DRAWN
|
1999-10-10 14:36:14 -04:00
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
// forward decl for GetSelections()
|
1999-10-22 18:00:20 -04:00
|
|
|
class wxArrayInt;
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-22 18:00:20 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// List box control
|
|
|
|
// ----------------------------------------------------------------------------
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-22 18:00:20 -04:00
|
|
|
class WXDLLEXPORT wxListBox : public wxListBoxBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
1999-10-22 18:00:20 -04:00
|
|
|
public:
|
|
|
|
// ctors and such
|
|
|
|
wxListBox();
|
2001-11-04 21:50:59 -05:00
|
|
|
wxListBox( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,int n = 0
|
|
|
|
,const wxString asChoices[] = NULL
|
|
|
|
,long lStyle = 0
|
1999-11-08 00:18:15 -05:00
|
|
|
#if wxUSE_VALIDATORS
|
2001-11-04 21:50:59 -05:00
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
1999-11-08 00:18:15 -05:00
|
|
|
#endif
|
2001-11-04 21:50:59 -05:00
|
|
|
,const wxString& rsName = wxListBoxNameStr)
|
1999-10-22 18:00:20 -04:00
|
|
|
{
|
2001-11-04 21:50:59 -05:00
|
|
|
Create( pParent
|
|
|
|
,vId
|
|
|
|
,rPos
|
|
|
|
,rSize
|
|
|
|
,n
|
|
|
|
,asChoices
|
|
|
|
,lStyle
|
|
|
|
#if wxUSE_VALIDATORS
|
|
|
|
,rValidator
|
|
|
|
#endif
|
|
|
|
,rsName
|
|
|
|
);
|
1999-10-22 18:00:20 -04:00
|
|
|
}
|
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,int n = 0
|
|
|
|
,const wxString asChoices[] = NULL
|
|
|
|
,long lStyle = 0
|
1999-11-08 00:18:15 -05:00
|
|
|
#if wxUSE_VALIDATORS
|
2001-11-04 21:50:59 -05:00
|
|
|
,const wxValidator& rValidator = wxDefaultValidator
|
1999-11-08 00:18:15 -05:00
|
|
|
#endif
|
2001-11-04 21:50:59 -05:00
|
|
|
,const wxString& rsName = wxListBoxNameStr
|
|
|
|
);
|
1999-10-22 18:00:20 -04:00
|
|
|
|
|
|
|
virtual ~wxListBox();
|
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
//
|
|
|
|
// Implement base class pure virtuals
|
|
|
|
//
|
|
|
|
virtual void Clear(void);
|
|
|
|
virtual void Delete(int n);
|
|
|
|
|
|
|
|
virtual int GetCount(void) const;
|
|
|
|
virtual wxString GetString(int n) const;
|
|
|
|
virtual void SetString( int n
|
|
|
|
,const wxString& rsString
|
|
|
|
);
|
|
|
|
virtual int FindString(const wxString& rsString) const;
|
|
|
|
|
|
|
|
virtual bool IsSelected(int n) const;
|
|
|
|
virtual void SetSelection( int n
|
|
|
|
,bool bSelect = TRUE
|
|
|
|
);
|
|
|
|
virtual int GetSelection(void) const;
|
|
|
|
virtual int GetSelections(wxArrayInt& raSelections) const;
|
|
|
|
|
|
|
|
virtual int DoAppend(const wxString& rsItem);
|
|
|
|
virtual void DoInsertItems( const wxArrayString& raItems
|
|
|
|
,int rPos
|
|
|
|
);
|
|
|
|
virtual void DoSetItems( const wxArrayString& raItems
|
|
|
|
,void ** ppClientData
|
|
|
|
);
|
|
|
|
|
|
|
|
virtual void DoSetFirstItem(int n);
|
|
|
|
|
|
|
|
virtual void DoSetItemClientData( int n
|
|
|
|
,void* pClientData
|
|
|
|
);
|
|
|
|
virtual void* DoGetItemClientData(int n) const;
|
|
|
|
virtual void DoSetItemClientObject( int n
|
|
|
|
,wxClientData* pClientData
|
|
|
|
);
|
1999-10-22 18:00:20 -04:00
|
|
|
virtual wxClientData* DoGetItemClientObject(int n) const;
|
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
//
|
1999-10-22 18:00:20 -04:00
|
|
|
// wxCheckListBox support
|
2001-11-04 21:50:59 -05:00
|
|
|
//
|
1999-10-10 14:36:14 -04:00
|
|
|
#if wxUSE_OWNER_DRAWN
|
2001-11-04 21:50:59 -05:00
|
|
|
bool OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
|
|
|
|
bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
|
1999-10-10 14:36:14 -04:00
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
virtual wxOwnerDrawn* CreateItem(size_t n);
|
|
|
|
wxOwnerDrawn* GetItem(size_t n) const { return m_aItems[n]; }
|
|
|
|
int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
|
1999-10-10 14:36:14 -04:00
|
|
|
#endif // wxUSE_OWNER_DRAWN
|
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
bool OS2Command( WXUINT uParam
|
|
|
|
,WXWORD wId
|
|
|
|
);
|
|
|
|
virtual void SetupColours(void);
|
1999-10-10 14:36:14 -04:00
|
|
|
|
|
|
|
protected:
|
1999-10-22 18:00:20 -04:00
|
|
|
|
2001-11-04 21:50:59 -05:00
|
|
|
bool HasMultipleSelection(void) const;
|
|
|
|
virtual wxSize DoGetBestSize(void) const;
|
|
|
|
|
|
|
|
int m_nNumItems;
|
|
|
|
int m_nSelected;
|
1999-10-10 14:36:14 -04:00
|
|
|
|
|
|
|
|
|
|
|
#if wxUSE_OWNER_DRAWN
|
2001-11-04 21:50:59 -05:00
|
|
|
//
|
|
|
|
// Control items
|
|
|
|
//
|
|
|
|
wxListBoxItemsArray m_aItems;
|
1999-10-10 14:36:14 -04:00
|
|
|
#endif
|
1999-10-22 18:00:20 -04:00
|
|
|
|
1999-10-10 14:36:14 -04:00
|
|
|
private:
|
1999-10-22 18:00:20 -04:00
|
|
|
#if wxUSE_WX_RESOURCES
|
|
|
|
# if wxUSE_OWNER_DRAWN
|
2001-11-04 21:50:59 -05:00
|
|
|
virtual wxControl* CreateItem( const wxItemResource* pChildResource
|
|
|
|
,const wxItemResource* pParentResource
|
|
|
|
,const wxResourceTable* pTable = (const wxResourceTable *) NULL
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return(wxWindowBase::CreateItem( pChildResource
|
|
|
|
,pParentResource
|
|
|
|
,pTable
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
1999-10-22 18:00:20 -04:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxListBox)
|
2001-11-04 21:50:59 -05:00
|
|
|
}; // end of wxListBox
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_LISTBOX_H_
|