]>
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 | |
1e6feb95 | 7 | // Copyright: (c) Vadim Zeitlin |
65571936 | 8 | // Licence: wxWindows licence |
1e6feb95 VZ |
9 | /////////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_UNIV_CHECKLST_H_ | |
12 | #define _WX_UNIV_CHECKLST_H_ | |
13 | ||
1e6feb95 VZ |
14 | // ---------------------------------------------------------------------------- |
15 | // actions | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
9a83f860 | 18 | #define wxACTION_CHECKLISTBOX_TOGGLE wxT("toggle") |
1e6feb95 VZ |
19 | |
20 | // ---------------------------------------------------------------------------- | |
21 | // wxCheckListBox | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
53a2db12 | 24 | class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase |
1e6feb95 VZ |
25 | { |
26 | public: | |
27 | // ctors | |
6463b9f5 | 28 | wxCheckListBox() { Init(); } |
1e6feb95 VZ |
29 | |
30 | wxCheckListBox(wxWindow *parent, | |
31 | wxWindowID id, | |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, | |
34 | int nStrings = 0, | |
ba1e9d6c | 35 | const wxString choices[] = NULL, |
1e6feb95 VZ |
36 | long style = 0, |
37 | const wxValidator& validator = wxDefaultValidator, | |
6463b9f5 JS |
38 | const wxString& name = wxListBoxNameStr) |
39 | { | |
40 | Init(); | |
41 | ||
42 | Create(parent, id, pos, size, nStrings, choices, style, validator, name); | |
43 | } | |
584ad2a3 MB |
44 | wxCheckListBox(wxWindow *parent, |
45 | wxWindowID id, | |
46 | const wxPoint& pos, | |
47 | const wxSize& size, | |
48 | const wxArrayString& choices, | |
49 | long style = 0, | |
50 | const wxValidator& validator = wxDefaultValidator, | |
51 | const wxString& name = wxListBoxNameStr); | |
1e6feb95 VZ |
52 | |
53 | bool Create(wxWindow *parent, | |
54 | wxWindowID id, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | int nStrings = 0, | |
ba1e9d6c | 58 | const wxString choices[] = (const wxString *) NULL, |
1e6feb95 VZ |
59 | long style = 0, |
60 | const wxValidator& validator = wxDefaultValidator, | |
61 | const wxString& name = wxListBoxNameStr); | |
584ad2a3 MB |
62 | bool Create(wxWindow *parent, |
63 | wxWindowID id, | |
64 | const wxPoint& pos, | |
65 | const wxSize& size, | |
66 | const wxArrayString& choices, | |
67 | long style = 0, | |
68 | const wxValidator& validator = wxDefaultValidator, | |
69 | const wxString& name = wxListBoxNameStr); | |
1e6feb95 VZ |
70 | |
71 | // implement check list box methods | |
aa61d352 VZ |
72 | virtual bool IsChecked(unsigned int item) const; |
73 | virtual void Check(unsigned int item, bool check = true); | |
1e6feb95 VZ |
74 | |
75 | // and input handling | |
76 | virtual bool PerformAction(const wxControlAction& action, | |
77 | long numArg = -1l, | |
78 | const wxString& strArg = wxEmptyString); | |
79 | ||
9467bdb7 VZ |
80 | static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); |
81 | virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) | |
82 | { | |
83 | return GetStdInputHandler(handlerDef); | |
84 | } | |
85 | ||
a236aa20 | 86 | protected: |
1e6feb95 VZ |
87 | // override all methods which add/delete items to update m_checks array as |
88 | // well | |
a236aa20 VZ |
89 | virtual void OnItemInserted(unsigned int pos); |
90 | virtual void DoDeleteOneItem(unsigned int n); | |
1e6feb95 VZ |
91 | virtual void DoClear(); |
92 | ||
93 | // draw the check items instead of the usual ones | |
94 | virtual void DoDrawRange(wxControlRenderer *renderer, | |
95 | int itemFirst, int itemLast); | |
96 | ||
97 | // take them also into account for size calculation | |
98 | virtual wxSize DoGetBestClientSize() const; | |
99 | ||
100 | // common part of all ctors | |
101 | void Init(); | |
102 | ||
103 | private: | |
104 | // the array containing the checked status of the items | |
105 | wxArrayInt m_checks; | |
106 | ||
107 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
108 | }; | |
109 | ||
1e6feb95 | 110 | #endif // _WX_UNIV_CHECKLST_H_ |