1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/listbox.h
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
, const wxString
& rsString
);
113 virtual bool IsSelected(int n
) const;
114 virtual void DoSetSelection( int n
117 virtual int GetSelection(void) const;
118 virtual int GetSelections(wxArrayInt
& raSelections
) const;
120 virtual int DoAppend(const wxString
& rsItem
);
121 virtual void DoInsertItems( const wxArrayString
& raItems
124 virtual void DoSetItems( const wxArrayString
& raItems
125 ,void ** ppClientData
128 virtual void DoSetFirstItem(int n
);
130 virtual void DoSetItemClientData( int n
133 virtual void* DoGetItemClientData(int n
) const;
134 virtual void DoSetItemClientObject( int n
135 ,wxClientData
* pClientData
137 virtual wxClientData
* DoGetItemClientObject(int n
) const;
140 // wxCheckListBox support
142 #if wxUSE_OWNER_DRAWN
143 long OS2OnMeasure(WXMEASUREITEMSTRUCT
*item
);
144 bool OS2OnDraw(WXDRAWITEMSTRUCT
*item
);
146 virtual wxOwnerDrawn
* CreateItem(size_t n
);
147 wxOwnerDrawn
* GetItem(size_t n
) const { return m_aItems
[n
]; }
148 int GetItemIndex(wxOwnerDrawn
*item
) const { return m_aItems
.Index(item
); }
149 #endif // wxUSE_OWNER_DRAWN
151 bool OS2Command( WXUINT uParam
154 virtual void SetupColours(void);
158 bool HasMultipleSelection(void) const;
159 virtual wxSize
DoGetBestSize(void) const;
165 #if wxUSE_OWNER_DRAWN
169 wxListBoxItemsArray m_aItems
;
173 DECLARE_DYNAMIC_CLASS(wxListBox
)
174 }; // end of wxListBox