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(unsigned int n
);
109 virtual unsigned int GetCount() const;
110 virtual wxString
GetString(unsigned int n
) const;
111 virtual void SetString(unsigned 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
, unsigned int rPos
);
120 virtual void DoSetItems( const wxArrayString
& raItems
121 ,void ** ppClientData
124 virtual void DoSetFirstItem(int n
);
126 virtual void DoSetItemClientData(unsigned int n
, void* pClientData
);
127 virtual void* DoGetItemClientData(unsigned int n
) const;
128 virtual void DoSetItemClientObject(unsigned int n
, wxClientData
* pClientData
);
129 virtual wxClientData
* DoGetItemClientObject(unsigned int n
) const;
132 // wxCheckListBox support
134 #if wxUSE_OWNER_DRAWN
135 long OS2OnMeasure(WXMEASUREITEMSTRUCT
*item
);
136 bool OS2OnDraw(WXDRAWITEMSTRUCT
*item
);
138 virtual wxOwnerDrawn
* CreateItem(size_t n
);
139 wxOwnerDrawn
* GetItem(size_t n
) const { return m_aItems
[n
]; }
140 int GetItemIndex(wxOwnerDrawn
*item
) const { return m_aItems
.Index(item
); }
141 #endif // wxUSE_OWNER_DRAWN
143 bool OS2Command( WXUINT uParam
146 virtual void SetupColours(void);
150 bool HasMultipleSelection(void) const;
151 virtual wxSize
DoGetBestSize(void) const;
153 unsigned int m_nNumItems
;
156 #if wxUSE_OWNER_DRAWN
160 wxListBoxItemsArray m_aItems
;
164 DECLARE_DYNAMIC_CLASS(wxListBox
)
165 }; // end of wxListBox
167 #endif // _WX_LISTBOX_H_