]>
Commit | Line | Data |
---|---|---|
9b6dbb09 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/motif/listbox.h |
9b6dbb09 JS |
3 | // Purpose: wxListBox class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
9b6dbb09 | 7 | // Copyright: (c) Julian Smart |
853dcc57 | 8 | // Licence: wxWindows licence |
9b6dbb09 JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_LISTBOX_H_ | |
12 | #define _WX_LISTBOX_H_ | |
13 | ||
6adaedf0 | 14 | #include "wx/ctrlsub.h" |
99ab3e3f | 15 | #include "wx/clntdata.h" |
9b6dbb09 | 16 | |
9b6dbb09 | 17 | // forward decl for GetSelections() |
4f7d425f | 18 | class WXDLLIMPEXP_FWD_BASE wxArrayInt; |
9b6dbb09 | 19 | |
9b6dbb09 | 20 | // List box item |
53a2db12 | 21 | class WXDLLIMPEXP_CORE wxListBox: public wxListBoxBase |
9b6dbb09 | 22 | { |
83df96d6 | 23 | DECLARE_DYNAMIC_CLASS(wxListBox) |
853dcc57 | 24 | |
bfc6fde4 VZ |
25 | public: |
26 | wxListBox(); | |
27 | wxListBox(wxWindow *parent, wxWindowID id, | |
83df96d6 JS |
28 | const wxPoint& pos = wxDefaultPosition, |
29 | const wxSize& size = wxDefaultSize, | |
30 | int n = 0, const wxString choices[] = NULL, | |
31 | long style = 0, | |
32 | const wxValidator& validator = wxDefaultValidator, | |
99ab3e3f | 33 | const wxString& name = wxListBoxNameStr) |
83df96d6 JS |
34 | { |
35 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
36 | } | |
853dcc57 | 37 | |
584ad2a3 MB |
38 | wxListBox(wxWindow *parent, wxWindowID id, |
39 | const wxPoint& pos, | |
40 | const wxSize& size, | |
41 | const wxArrayString& choices, | |
42 | long style = 0, | |
43 | const wxValidator& validator = wxDefaultValidator, | |
44 | const wxString& name = wxListBoxNameStr) | |
45 | { | |
46 | Create(parent, id, pos, size, choices, style, validator, name); | |
47 | } | |
853dcc57 | 48 | |
bfc6fde4 | 49 | bool Create(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
50 | const wxPoint& pos = wxDefaultPosition, |
51 | const wxSize& size = wxDefaultSize, | |
52 | int n = 0, const wxString choices[] = NULL, | |
53 | long style = 0, | |
54 | const wxValidator& validator = wxDefaultValidator, | |
55 | const wxString& name = wxListBoxNameStr); | |
853dcc57 | 56 | |
584ad2a3 MB |
57 | bool Create(wxWindow *parent, wxWindowID id, |
58 | const wxPoint& pos, | |
59 | const wxSize& size, | |
60 | const wxArrayString& choices, | |
61 | long style = 0, | |
62 | const wxValidator& validator = wxDefaultValidator, | |
63 | const wxString& name = wxListBoxNameStr); | |
853dcc57 | 64 | |
ef41d80c | 65 | // implementation of wxControlWithItems |
aa61d352 | 66 | virtual unsigned int GetCount() const; |
a236aa20 VZ |
67 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
68 | unsigned int pos, | |
69 | void **clientData, wxClientDataType type); | |
ef41d80c | 70 | virtual int GetSelection() const; |
a236aa20 | 71 | virtual void DoDeleteOneItem(unsigned int n); |
853dcc57 | 72 | virtual int FindString(const wxString& s, bool bCase = false) const; |
a236aa20 | 73 | virtual void DoClear(); |
aa61d352 VZ |
74 | virtual void SetString(unsigned int n, const wxString& s); |
75 | virtual wxString GetString(unsigned int n) const; | |
ef41d80c MB |
76 | |
77 | // implementation of wxListBoxbase | |
c6179a84 | 78 | virtual void DoSetSelection(int n, bool select); |
6adaedf0 | 79 | virtual void DoSetFirstItem(int n); |
bfc6fde4 | 80 | virtual int GetSelections(wxArrayInt& aSelections) const; |
ef41d80c | 81 | virtual bool IsSelected(int n) const; |
18128cbb | 82 | |
ef41d80c | 83 | // For single or multiple choice list item |
bfc6fde4 | 84 | void Command(wxCommandEvent& event); |
853dcc57 | 85 | |
bfc6fde4 | 86 | // Implementation |
bfc6fde4 VZ |
87 | virtual void ChangeBackgroundColour(); |
88 | virtual void ChangeForegroundColour(); | |
89 | WXWidget GetTopWidget() const; | |
ef41d80c MB |
90 | |
91 | #if wxUSE_CHECKLISTBOX | |
a236aa20 | 92 | virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {} |
ef41d80c | 93 | #endif |
f97c9854 | 94 | protected: |
e1aae528 MB |
95 | virtual wxSize DoGetBestSize() const; |
96 | ||
aa61d352 | 97 | unsigned int m_noItems; |
853dcc57 | 98 | |
99ab3e3f MB |
99 | private: |
100 | void SetSelectionPolicy(); | |
9b6dbb09 JS |
101 | }; |
102 | ||
103 | #endif | |
83df96d6 | 104 | // _WX_LISTBOX_H_ |