1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxListBox class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_LISTBOX_H_
13 #define _WX_LISTBOX_H_
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "listbox.h"
19 #include "wx/ctrlsub.h"
20 #include "wx/clntdata.h"
22 // forward decl for GetSelections()
23 class WXDLLEXPORT wxArrayInt
;
26 class WXDLLEXPORT wxListBox
: public wxListBoxBase
28 DECLARE_DYNAMIC_CLASS(wxListBox
)
32 wxListBox(wxWindow
*parent
, wxWindowID id
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
35 int n
= 0, const wxString choices
[] = NULL
,
37 const wxValidator
& validator
= wxDefaultValidator
,
38 const wxString
& name
= wxListBoxNameStr
)
40 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
43 bool Create(wxWindow
*parent
, wxWindowID id
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
46 int n
= 0, const wxString choices
[] = NULL
,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxListBoxNameStr
);
53 // implementation of wxControlWithItems
54 virtual int GetCount() const;
55 virtual int DoAppend(const wxString
& item
);
56 virtual void DoSetItemClientData(int n
, void* clientData
);
57 virtual void* DoGetItemClientData(int n
) const;
58 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
);
59 virtual wxClientData
* DoGetItemClientObject(int n
) const;
60 virtual int GetSelection() const;
61 virtual void Delete(int n
);
62 virtual int FindString(const wxString
& s
) const;
64 virtual void SetString(int n
, const wxString
& s
);
65 virtual wxString
GetString(int n
) const;
67 // implementation of wxListBoxbase
68 virtual void SetSelection(int n
, bool select
= TRUE
);
69 virtual void DoInsertItems(const wxArrayString
& items
, int pos
);
70 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
71 virtual void DoSetFirstItem(int n
);
72 virtual int GetSelections(wxArrayInt
& aSelections
) const;
73 virtual bool IsSelected(int n
) const;
75 // For single or multiple choice list item
76 void Command(wxCommandEvent
& event
);
79 virtual void ChangeBackgroundColour();
80 virtual void ChangeForegroundColour();
81 WXWidget
GetTopWidget() const;
83 #if wxUSE_CHECKLISTBOX
84 virtual void DoToggleItem(int item
, int x
) {};
87 virtual wxSize
DoGetBestSize() const;
91 // List mapping positions->client data
92 wxClientDataDictionary m_clientDataDict
;
94 void SetSelectionPolicy();