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