]>
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 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
853dcc57 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_LISTBOX_H_ | |
13 | #define _WX_LISTBOX_H_ | |
14 | ||
6adaedf0 | 15 | #include "wx/ctrlsub.h" |
99ab3e3f | 16 | #include "wx/clntdata.h" |
9b6dbb09 | 17 | |
9b6dbb09 JS |
18 | // forward decl for GetSelections() |
19 | class WXDLLEXPORT wxArrayInt; | |
20 | ||
9b6dbb09 | 21 | // List box item |
d7d38ea4 | 22 | class WXDLLEXPORT wxListBox: public wxListBoxBase |
9b6dbb09 | 23 | { |
83df96d6 | 24 | DECLARE_DYNAMIC_CLASS(wxListBox) |
853dcc57 | 25 | |
bfc6fde4 VZ |
26 | public: |
27 | wxListBox(); | |
28 | wxListBox(wxWindow *parent, wxWindowID id, | |
83df96d6 JS |
29 | const wxPoint& pos = wxDefaultPosition, |
30 | const wxSize& size = wxDefaultSize, | |
31 | int n = 0, const wxString choices[] = NULL, | |
32 | long style = 0, | |
33 | const wxValidator& validator = wxDefaultValidator, | |
99ab3e3f | 34 | const wxString& name = wxListBoxNameStr) |
83df96d6 JS |
35 | { |
36 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
37 | } | |
853dcc57 | 38 | |
584ad2a3 MB |
39 | wxListBox(wxWindow *parent, wxWindowID id, |
40 | const wxPoint& pos, | |
41 | const wxSize& size, | |
42 | const wxArrayString& choices, | |
43 | long style = 0, | |
44 | const wxValidator& validator = wxDefaultValidator, | |
45 | const wxString& name = wxListBoxNameStr) | |
46 | { | |
47 | Create(parent, id, pos, size, choices, style, validator, name); | |
48 | } | |
853dcc57 | 49 | |
bfc6fde4 | 50 | bool Create(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
51 | const wxPoint& pos = wxDefaultPosition, |
52 | const wxSize& size = wxDefaultSize, | |
53 | int n = 0, const wxString choices[] = NULL, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxListBoxNameStr); | |
853dcc57 | 57 | |
584ad2a3 MB |
58 | bool Create(wxWindow *parent, wxWindowID id, |
59 | const wxPoint& pos, | |
60 | const wxSize& size, | |
61 | const wxArrayString& choices, | |
62 | long style = 0, | |
63 | const wxValidator& validator = wxDefaultValidator, | |
64 | const wxString& name = wxListBoxNameStr); | |
853dcc57 | 65 | |
bfc6fde4 | 66 | ~wxListBox(); |
853dcc57 | 67 | |
ef41d80c | 68 | // implementation of wxControlWithItems |
6adaedf0 JS |
69 | virtual int GetCount() const; |
70 | virtual int DoAppend(const wxString& item); | |
99ab3e3f MB |
71 | virtual void DoSetItemClientData(int n, void* clientData); |
72 | virtual void* DoGetItemClientData(int n) const; | |
73 | virtual void DoSetItemClientObject(int n, wxClientData* clientData); | |
74 | virtual wxClientData* DoGetItemClientObject(int n) const; | |
ef41d80c MB |
75 | virtual int GetSelection() const; |
76 | virtual void Delete(int n); | |
853dcc57 | 77 | virtual int FindString(const wxString& s, bool bCase = false) const; |
ef41d80c MB |
78 | virtual void Clear(); |
79 | virtual void SetString(int n, const wxString& s); | |
80 | virtual wxString GetString(int n) const; | |
81 | ||
82 | // implementation of wxListBoxbase | |
c6179a84 | 83 | virtual void DoSetSelection(int n, bool select); |
6adaedf0 JS |
84 | virtual void DoInsertItems(const wxArrayString& items, int pos); |
85 | virtual void DoSetItems(const wxArrayString& items, void **clientData); | |
86 | virtual void DoSetFirstItem(int n); | |
bfc6fde4 | 87 | virtual int GetSelections(wxArrayInt& aSelections) const; |
ef41d80c | 88 | virtual bool IsSelected(int n) const; |
18128cbb | 89 | |
ef41d80c | 90 | // For single or multiple choice list item |
bfc6fde4 | 91 | void Command(wxCommandEvent& event); |
853dcc57 | 92 | |
bfc6fde4 | 93 | // Implementation |
bfc6fde4 VZ |
94 | virtual void ChangeBackgroundColour(); |
95 | virtual void ChangeForegroundColour(); | |
96 | WXWidget GetTopWidget() const; | |
ef41d80c MB |
97 | |
98 | #if wxUSE_CHECKLISTBOX | |
55034339 | 99 | virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {}; |
ef41d80c | 100 | #endif |
f97c9854 | 101 | protected: |
e1aae528 MB |
102 | virtual wxSize DoGetBestSize() const; |
103 | ||
bfc6fde4 | 104 | int m_noItems; |
853dcc57 | 105 | |
bfc6fde4 | 106 | // List mapping positions->client data |
99ab3e3f MB |
107 | wxClientDataDictionary m_clientDataDict; |
108 | private: | |
109 | void SetSelectionPolicy(); | |
9b6dbb09 JS |
110 | }; |
111 | ||
112 | #endif | |
83df96d6 | 113 | // _WX_LISTBOX_H_ |