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_PTR(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
47 ,const wxValidator
& rValidator
= wxDefaultValidator
48 ,const wxString
& rsName
= wxListBoxNameStr
)
61 wxListBox( wxWindow
* pParent
65 ,const wxArrayString
& asChoices
67 ,const wxValidator
& rValidator
= wxDefaultValidator
68 ,const wxString
& rsName
= wxListBoxNameStr
)
81 bool Create( wxWindow
* pParent
83 ,const wxPoint
& rPos
= wxDefaultPosition
84 ,const wxSize
& rSize
= wxDefaultSize
86 ,const wxString asChoices
[] = NULL
88 ,const wxValidator
& rValidator
= wxDefaultValidator
89 ,const wxString
& rsName
= wxListBoxNameStr
91 bool Create( wxWindow
* pParent
95 ,const wxArrayString
& asChoices
97 ,const wxValidator
& rValidator
= wxDefaultValidator
98 ,const wxString
& rsName
= wxListBoxNameStr
101 virtual ~wxListBox();
104 // Implement base class pure virtuals
106 virtual void Clear(void);
107 virtual void Delete(int n
);
109 virtual int GetCount(void) const;
110 virtual wxString
GetString(int n
) const;
111 virtual void SetString( int n
112 ,const wxString
& rsString
114 virtual int FindString(const wxString
& rsString
) const;
116 virtual bool IsSelected(int n
) const;
117 virtual void DoSetSelection( int n
120 virtual int GetSelection(void) const;
121 virtual int GetSelections(wxArrayInt
& raSelections
) const;
123 virtual int DoAppend(const wxString
& rsItem
);
124 virtual void DoInsertItems( const wxArrayString
& raItems
127 virtual void DoSetItems( const wxArrayString
& raItems
128 ,void ** ppClientData
131 virtual void DoSetFirstItem(int n
);
133 virtual void DoSetItemClientData( int n
136 virtual void* DoGetItemClientData(int n
) const;
137 virtual void DoSetItemClientObject( int n
138 ,wxClientData
* pClientData
140 virtual wxClientData
* DoGetItemClientObject(int n
) const;
143 // wxCheckListBox support
145 #if wxUSE_OWNER_DRAWN
146 long OS2OnMeasure(WXMEASUREITEMSTRUCT
*item
);
147 bool OS2OnDraw(WXDRAWITEMSTRUCT
*item
);
149 virtual wxOwnerDrawn
* CreateItem(size_t n
);
150 wxOwnerDrawn
* GetItem(size_t n
) const { return m_aItems
[n
]; }
151 int GetItemIndex(wxOwnerDrawn
*item
) const { return m_aItems
.Index(item
); }
152 #endif // wxUSE_OWNER_DRAWN
154 bool OS2Command( WXUINT uParam
157 virtual void SetupColours(void);
161 bool HasMultipleSelection(void) const;
162 virtual wxSize
DoGetBestSize(void) const;
168 #if wxUSE_OWNER_DRAWN
172 wxListBoxItemsArray m_aItems
;
176 DECLARE_DYNAMIC_CLASS(wxListBox
)
177 }; // end of wxListBox