1 /////////////////////////////////////////////////////////////////////////////
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(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
)
62 bool Create( wxWindow
* pParent
64 ,const wxPoint
& rPos
= wxDefaultPosition
65 ,const wxSize
& rSize
= wxDefaultSize
67 ,const wxString asChoices
[] = NULL
69 ,const wxValidator
& rValidator
= wxDefaultValidator
70 ,const wxString
& rsName
= wxListBoxNameStr
76 // Implement base class pure virtuals
78 virtual void Clear(void);
79 virtual void Delete(int n
);
81 virtual int GetCount(void) const;
82 virtual wxString
GetString(int n
) const;
83 virtual void SetString( int n
84 ,const wxString
& rsString
86 virtual int FindString(const wxString
& rsString
) const;
88 virtual bool IsSelected(int n
) const;
89 virtual void SetSelection( int n
92 virtual int GetSelection(void) const;
93 virtual int GetSelections(wxArrayInt
& raSelections
) const;
95 virtual int DoAppend(const wxString
& rsItem
);
96 virtual void DoInsertItems( const wxArrayString
& raItems
99 virtual void DoSetItems( const wxArrayString
& raItems
100 ,void ** ppClientData
103 virtual void DoSetFirstItem(int n
);
105 virtual void DoSetItemClientData( int n
108 virtual void* DoGetItemClientData(int n
) const;
109 virtual void DoSetItemClientObject( int n
110 ,wxClientData
* pClientData
112 virtual wxClientData
* DoGetItemClientObject(int n
) const;
115 // wxCheckListBox support
117 #if wxUSE_OWNER_DRAWN
118 long OS2OnMeasure(WXMEASUREITEMSTRUCT
*item
);
119 bool OS2OnDraw(WXDRAWITEMSTRUCT
*item
);
121 virtual wxOwnerDrawn
* CreateItem(size_t n
);
122 wxOwnerDrawn
* GetItem(size_t n
) const { return m_aItems
[n
]; }
123 int GetItemIndex(wxOwnerDrawn
*item
) const { return m_aItems
.Index(item
); }
124 #endif // wxUSE_OWNER_DRAWN
126 bool OS2Command( WXUINT uParam
129 virtual void SetupColours(void);
133 bool HasMultipleSelection(void) const;
134 virtual wxSize
DoGetBestSize(void) const;
140 #if wxUSE_OWNER_DRAWN
144 wxListBoxItemsArray m_aItems
;
148 #if wxUSE_WX_RESOURCES
149 # if wxUSE_OWNER_DRAWN
150 virtual wxControl
* CreateItem( const wxItemResource
* pChildResource
151 ,const wxItemResource
* pParentResource
152 ,const wxResourceTable
* pTable
= (const wxResourceTable
*) NULL
155 return(wxWindowBase::CreateItem( pChildResource
163 DECLARE_DYNAMIC_CLASS(wxListBox
)
164 }; // end of wxListBox