1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/listbox.h
3 // Purpose: wxListBox class
4 // Author: David Webster
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_LISTBOX_H_
12 #define _WX_LISTBOX_H_
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
19 class WXDLLIMPEXP_FWD_CORE wxOwnerDrawn
;
21 // define the array of list box items
22 #include "wx/dynarray.h"
24 WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn
*, wxListBoxItemsArray
);
25 #endif // wxUSE_OWNER_DRAWN
27 // forward decl for GetSelections()
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
34 class WXDLLIMPEXP_CORE wxListBox
: public wxListBoxBase
39 wxListBox( wxWindow
* pParent
41 ,const wxPoint
& rPos
= wxDefaultPosition
42 ,const wxSize
& rSize
= wxDefaultSize
44 ,const wxString asChoices
[] = NULL
46 ,const wxValidator
& rValidator
= wxDefaultValidator
47 ,const wxString
& rsName
= wxListBoxNameStr
)
60 wxListBox( wxWindow
* pParent
64 ,const wxArrayString
& asChoices
66 ,const wxValidator
& rValidator
= wxDefaultValidator
67 ,const wxString
& rsName
= wxListBoxNameStr
)
80 bool Create( wxWindow
* pParent
82 ,const wxPoint
& rPos
= wxDefaultPosition
83 ,const wxSize
& rSize
= wxDefaultSize
85 ,const wxString asChoices
[] = NULL
87 ,const wxValidator
& rValidator
= wxDefaultValidator
88 ,const wxString
& rsName
= wxListBoxNameStr
90 bool Create( wxWindow
* pParent
94 ,const wxArrayString
& asChoices
96 ,const wxValidator
& rValidator
= wxDefaultValidator
97 ,const wxString
& rsName
= wxListBoxNameStr
100 virtual ~wxListBox();
103 // Implement base class pure virtuals
105 virtual void DoClear(void);
106 virtual void DoDeleteOneItem(unsigned int n
);
108 virtual unsigned int GetCount() const;
109 virtual wxString
GetString(unsigned int n
) const;
110 virtual void SetString(unsigned int n
, const wxString
& rsString
);
112 virtual bool IsSelected(int n
) const;
113 virtual void DoSetSelection(int n
, bool bSelect
);
114 virtual int GetSelection(void) const;
115 virtual int GetSelections(wxArrayInt
& raSelections
) const;
117 virtual void DoSetFirstItem(int n
);
119 virtual void DoSetItemClientData(unsigned int n
, void* pClientData
);
120 virtual void* DoGetItemClientData(unsigned int n
) const;
123 // wxCheckListBox support
125 #if wxUSE_OWNER_DRAWN
126 long OS2OnMeasure(WXMEASUREITEMSTRUCT
*item
);
127 bool OS2OnDraw(WXDRAWITEMSTRUCT
*item
);
129 virtual wxOwnerDrawn
* CreateItem(size_t n
);
130 wxOwnerDrawn
* GetItem(size_t n
) const { return m_aItems
[n
]; }
131 int GetItemIndex(wxOwnerDrawn
*item
) const { return m_aItems
.Index(item
); }
132 #endif // wxUSE_OWNER_DRAWN
134 bool OS2Command( WXUINT uParam
137 virtual void SetupColours(void);
141 bool HasMultipleSelection(void) const;
142 virtual wxSize
DoGetBestSize(void) const;
144 unsigned int m_nNumItems
;
147 #if wxUSE_OWNER_DRAWN
151 wxListBoxItemsArray m_aItems
;
155 // Implement base wxItemContainer virtuals
157 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
160 wxClientDataType type
);
162 DECLARE_DYNAMIC_CLASS(wxListBox
)
163 }; // end of wxListBox
165 #endif // _WX_LISTBOX_H_