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 WXDLLIMPEXP_FWD_CORE 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 DoClear(void);
107 virtual void DoDeleteOneItem(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 void DoSetFirstItem(int n
);
120 virtual void DoSetItemClientData(unsigned int n
, void* pClientData
);
121 virtual void* DoGetItemClientData(unsigned int n
) const;
124 // wxCheckListBox support
126 #if wxUSE_OWNER_DRAWN
127 long OS2OnMeasure(WXMEASUREITEMSTRUCT
*item
);
128 bool OS2OnDraw(WXDRAWITEMSTRUCT
*item
);
130 virtual wxOwnerDrawn
* CreateItem(size_t n
);
131 wxOwnerDrawn
* GetItem(size_t n
) const { return m_aItems
[n
]; }
132 int GetItemIndex(wxOwnerDrawn
*item
) const { return m_aItems
.Index(item
); }
133 #endif // wxUSE_OWNER_DRAWN
135 bool OS2Command( WXUINT uParam
138 virtual void SetupColours(void);
142 bool HasMultipleSelection(void) const;
143 virtual wxSize
DoGetBestSize(void) const;
145 unsigned int m_nNumItems
;
148 #if wxUSE_OWNER_DRAWN
152 wxListBoxItemsArray m_aItems
;
156 // Implement base wxItemContainer virtuals
158 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
161 wxClientDataType type
);
163 DECLARE_DYNAMIC_CLASS(wxListBox
)
164 }; // end of wxListBox
166 #endif // _WX_LISTBOX_H_