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 size_t GetCount() 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
, bool bSelect
);
115 virtual int GetSelection(void) const;
116 virtual int GetSelections(wxArrayInt
& raSelections
) const;
118 virtual int DoAppend(const wxString
& rsItem
);
119 virtual void DoInsertItems( const wxArrayString
& raItems
, int rPos
);
120 virtual void DoSetItems( const wxArrayString
& raItems
121 ,void ** ppClientData
124 virtual void DoSetFirstItem(int n
);
126 virtual void DoSetItemClientData( int n
129 virtual void* DoGetItemClientData(int n
) const;
130 virtual void DoSetItemClientObject( int n
131 ,wxClientData
* pClientData
133 virtual wxClientData
* DoGetItemClientObject(int n
) const;
136 // wxCheckListBox support
138 #if wxUSE_OWNER_DRAWN
139 long OS2OnMeasure(WXMEASUREITEMSTRUCT
*item
);
140 bool OS2OnDraw(WXDRAWITEMSTRUCT
*item
);
142 virtual wxOwnerDrawn
* CreateItem(size_t n
);
143 wxOwnerDrawn
* GetItem(size_t n
) const { return m_aItems
[n
]; }
144 int GetItemIndex(wxOwnerDrawn
*item
) const { return m_aItems
.Index(item
); }
145 #endif // wxUSE_OWNER_DRAWN
147 bool OS2Command( WXUINT uParam
150 virtual void SetupColours(void);
154 bool HasMultipleSelection(void) const;
155 virtual wxSize
DoGetBestSize(void) const;
160 #if wxUSE_OWNER_DRAWN
164 wxListBoxItemsArray m_aItems
;
168 DECLARE_DYNAMIC_CLASS(wxListBox
)
169 }; // end of wxListBox
171 #endif // _WX_LISTBOX_H_