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