]>
Commit | Line | Data |
---|---|---|
1e6feb95 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/univ/checklst.h | |
3 | // Purpose: wxCheckListBox class for wxUniversal | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 12.09.00 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Vadim Zeitlin | |
65571936 | 9 | // Licence: wxWindows licence |
1e6feb95 VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_UNIV_CHECKLST_H_ | |
13 | #define _WX_UNIV_CHECKLST_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
a3870b2f | 16 | #pragma interface "univchecklst.h" |
1e6feb95 VZ |
17 | #endif |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
20 | // actions | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
23 | #define wxACTION_CHECKLISTBOX_TOGGLE _T("toggle") | |
24 | ||
25 | // ---------------------------------------------------------------------------- | |
26 | // wxCheckListBox | |
27 | // ---------------------------------------------------------------------------- | |
28 | ||
29 | class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase | |
30 | { | |
31 | public: | |
32 | // ctors | |
6463b9f5 | 33 | wxCheckListBox() { Init(); } |
1e6feb95 VZ |
34 | |
35 | wxCheckListBox(wxWindow *parent, | |
36 | wxWindowID id, | |
37 | const wxPoint& pos = wxDefaultPosition, | |
38 | const wxSize& size = wxDefaultSize, | |
39 | int nStrings = 0, | |
ba1e9d6c | 40 | const wxString choices[] = NULL, |
1e6feb95 VZ |
41 | long style = 0, |
42 | const wxValidator& validator = wxDefaultValidator, | |
6463b9f5 JS |
43 | const wxString& name = wxListBoxNameStr) |
44 | { | |
45 | Init(); | |
46 | ||
47 | Create(parent, id, pos, size, nStrings, choices, style, validator, name); | |
48 | } | |
584ad2a3 MB |
49 | wxCheckListBox(wxWindow *parent, |
50 | wxWindowID id, | |
51 | const wxPoint& pos, | |
52 | const wxSize& size, | |
53 | const wxArrayString& choices, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxListBoxNameStr); | |
1e6feb95 VZ |
57 | |
58 | bool Create(wxWindow *parent, | |
59 | wxWindowID id, | |
60 | const wxPoint& pos = wxDefaultPosition, | |
61 | const wxSize& size = wxDefaultSize, | |
62 | int nStrings = 0, | |
ba1e9d6c | 63 | const wxString choices[] = (const wxString *) NULL, |
1e6feb95 VZ |
64 | long style = 0, |
65 | const wxValidator& validator = wxDefaultValidator, | |
66 | const wxString& name = wxListBoxNameStr); | |
584ad2a3 MB |
67 | bool Create(wxWindow *parent, |
68 | wxWindowID id, | |
69 | const wxPoint& pos, | |
70 | const wxSize& size, | |
71 | const wxArrayString& choices, | |
72 | long style = 0, | |
73 | const wxValidator& validator = wxDefaultValidator, | |
74 | const wxString& name = wxListBoxNameStr); | |
1e6feb95 VZ |
75 | |
76 | // implement check list box methods | |
77 | virtual bool IsChecked(size_t item) const; | |
a290fa5a | 78 | virtual void Check(size_t item, bool check = true); |
1e6feb95 VZ |
79 | |
80 | // and input handling | |
81 | virtual bool PerformAction(const wxControlAction& action, | |
82 | long numArg = -1l, | |
83 | const wxString& strArg = wxEmptyString); | |
84 | ||
85 | // override all methods which add/delete items to update m_checks array as | |
86 | // well | |
87 | virtual void Delete(int n); | |
88 | ||
89 | protected: | |
90 | virtual int DoAppend(const wxString& item); | |
91 | virtual void DoInsertItems(const wxArrayString& items, int pos); | |
92 | virtual void DoSetItems(const wxArrayString& items, void **clientData); | |
93 | virtual void DoClear(); | |
94 | ||
95 | // draw the check items instead of the usual ones | |
96 | virtual void DoDrawRange(wxControlRenderer *renderer, | |
97 | int itemFirst, int itemLast); | |
98 | ||
99 | // take them also into account for size calculation | |
100 | virtual wxSize DoGetBestClientSize() const; | |
101 | ||
102 | // common part of all ctors | |
103 | void Init(); | |
104 | ||
105 | private: | |
106 | // the array containing the checked status of the items | |
107 | wxArrayInt m_checks; | |
108 | ||
109 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
110 | }; | |
111 | ||
112 | // ---------------------------------------------------------------------------- | |
113 | // wxStdCheckListBoxInputHandler | |
114 | // ---------------------------------------------------------------------------- | |
115 | ||
116 | class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandler | |
117 | { | |
118 | public: | |
119 | wxStdCheckListboxInputHandler(wxInputHandler *inphand); | |
120 | ||
23645bfa | 121 | virtual bool HandleKey(wxInputConsumer *consumer, |
1e6feb95 VZ |
122 | const wxKeyEvent& event, |
123 | bool pressed); | |
23645bfa | 124 | virtual bool HandleMouse(wxInputConsumer *consumer, |
1e6feb95 VZ |
125 | const wxMouseEvent& event); |
126 | }; | |
127 | ||
128 | #endif // _WX_UNIV_CHECKLST_H_ | |
129 |