1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/listbox.h
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 #include "wx/ctrlsub.h"
16 #include "wx/clntdata.h"
18 // forward decl for GetSelections()
19 class WXDLLIMPEXP_FWD_CORE wxArrayInt
;
22 class WXDLLEXPORT wxListBox
: public wxListBoxBase
24 DECLARE_DYNAMIC_CLASS(wxListBox
)
28 wxListBox(wxWindow
*parent
, wxWindowID id
,
29 const wxPoint
& pos
= wxDefaultPosition
,
30 const wxSize
& size
= wxDefaultSize
,
31 int n
= 0, const wxString choices
[] = NULL
,
33 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxListBoxNameStr
)
36 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
39 wxListBox(wxWindow
*parent
, wxWindowID id
,
42 const wxArrayString
& choices
,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxListBoxNameStr
)
47 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
50 bool Create(wxWindow
*parent
, wxWindowID id
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
53 int n
= 0, const wxString choices
[] = NULL
,
55 const wxValidator
& validator
= wxDefaultValidator
,
56 const wxString
& name
= wxListBoxNameStr
);
58 bool Create(wxWindow
*parent
, wxWindowID id
,
61 const wxArrayString
& choices
,
63 const wxValidator
& validator
= wxDefaultValidator
,
64 const wxString
& name
= wxListBoxNameStr
);
68 // implementation of wxControlWithItems
69 virtual unsigned int GetCount() const;
70 virtual int DoAppend(const wxString
& item
);
71 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
72 virtual void* DoGetItemClientData(unsigned int n
) const;
73 virtual void DoSetItemClientObject(unsigned int n
, wxClientData
* clientData
);
74 virtual wxClientData
* DoGetItemClientObject(unsigned int n
) const;
75 virtual int GetSelection() const;
76 virtual void Delete(unsigned int n
);
77 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
79 virtual void SetString(unsigned int n
, const wxString
& s
);
80 virtual wxString
GetString(unsigned int n
) const;
82 // implementation of wxListBoxbase
83 virtual void DoSetSelection(int n
, bool select
);
84 virtual void DoInsertItems(const wxArrayString
& items
, unsigned int pos
);
85 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
86 virtual void DoSetFirstItem(int n
);
87 virtual int GetSelections(wxArrayInt
& aSelections
) const;
88 virtual bool IsSelected(int n
) const;
90 // For single or multiple choice list item
91 void Command(wxCommandEvent
& event
);
94 virtual void ChangeBackgroundColour();
95 virtual void ChangeForegroundColour();
96 WXWidget
GetTopWidget() const;
98 #if wxUSE_CHECKLISTBOX
99 virtual void DoToggleItem(int WXUNUSED(item
), int WXUNUSED(x
)) {};
102 virtual wxSize
DoGetBestSize() const;
104 unsigned int m_noItems
;
106 // List mapping positions->client data
107 wxClientDataDictionary m_clientDataDict
;
109 void SetSelectionPolicy();