1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxListBox class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_LISTBOX_H_
13 #define _WX_LISTBOX_H_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
20 class WXDLLEXPORT wxOwnerDrawn
;
22 // define the array of list box items
23 #include <wx/dynarray.h>
25 WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn
*, wxListBoxItemsArray
);
26 #endif // wxUSE_OWNER_DRAWN
28 // forward decl for GetSelections()
31 // ----------------------------------------------------------------------------
33 // ----------------------------------------------------------------------------
35 class WXDLLEXPORT wxListBox
: public wxListBoxBase
40 wxListBox( wxWindow
* pParent
42 ,const wxPoint
& rPos
= wxDefaultPosition
43 ,const wxSize
& rSize
= wxDefaultSize
45 ,const wxString asChoices
[] = NULL
48 ,const wxValidator
& rValidator
= wxDefaultValidator
50 ,const wxString
& rsName
= wxListBoxNameStr
)
66 bool Create( wxWindow
* pParent
68 ,const wxPoint
& rPos
= wxDefaultPosition
69 ,const wxSize
& rSize
= wxDefaultSize
71 ,const wxString asChoices
[] = NULL
74 ,const wxValidator
& rValidator
= wxDefaultValidator
76 ,const wxString
& rsName
= wxListBoxNameStr
82 // Implement base class pure virtuals
84 virtual void Clear(void);
85 virtual void Delete(int n
);
87 virtual int GetCount(void) const;
88 virtual wxString
GetString(int n
) const;
89 virtual void SetString( int n
90 ,const wxString
& rsString
92 virtual int FindString(const wxString
& rsString
) const;
94 virtual bool IsSelected(int n
) const;
95 virtual void SetSelection( int n
98 virtual int GetSelection(void) const;
99 virtual int GetSelections(wxArrayInt
& raSelections
) const;
101 virtual int DoAppend(const wxString
& rsItem
);
102 virtual void DoInsertItems( const wxArrayString
& raItems
105 virtual void DoSetItems( const wxArrayString
& raItems
106 ,void ** ppClientData
109 virtual void DoSetFirstItem(int n
);
111 virtual void DoSetItemClientData( int n
114 virtual void* DoGetItemClientData(int n
) const;
115 virtual void DoSetItemClientObject( int n
116 ,wxClientData
* pClientData
118 virtual wxClientData
* DoGetItemClientObject(int n
) const;
121 // wxCheckListBox support
123 #if wxUSE_OWNER_DRAWN
124 bool OS2OnMeasure(WXMEASUREITEMSTRUCT
*item
);
125 bool OS2OnDraw(WXDRAWITEMSTRUCT
*item
);
127 virtual wxOwnerDrawn
* CreateItem(size_t n
);
128 wxOwnerDrawn
* GetItem(size_t n
) const { return m_aItems
[n
]; }
129 int GetItemIndex(wxOwnerDrawn
*item
) const { return m_aItems
.Index(item
); }
130 #endif // wxUSE_OWNER_DRAWN
132 bool OS2Command( WXUINT uParam
135 virtual void SetupColours(void);
139 bool HasMultipleSelection(void) const;
140 virtual wxSize
DoGetBestSize(void) const;
146 #if wxUSE_OWNER_DRAWN
150 wxListBoxItemsArray m_aItems
;
154 #if wxUSE_WX_RESOURCES
155 # if wxUSE_OWNER_DRAWN
156 virtual wxControl
* CreateItem( const wxItemResource
* pChildResource
157 ,const wxItemResource
* pParentResource
158 ,const wxResourceTable
* pTable
= (const wxResourceTable
*) NULL
161 return(wxWindowBase::CreateItem( pChildResource
169 DECLARE_DYNAMIC_CLASS(wxListBox
)
170 }; // end of wxListBox