]>
Commit | Line | Data |
---|---|---|
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 | // Copyright: (c) Vadim Zeitlin | |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_UNIV_CHECKLST_H_ | |
12 | #define _WX_UNIV_CHECKLST_H_ | |
13 | ||
14 | // ---------------------------------------------------------------------------- | |
15 | // actions | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
18 | #define wxACTION_CHECKLISTBOX_TOGGLE wxT("toggle") | |
19 | ||
20 | // ---------------------------------------------------------------------------- | |
21 | // wxCheckListBox | |
22 | // ---------------------------------------------------------------------------- | |
23 | ||
24 | class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase | |
25 | { | |
26 | public: | |
27 | // ctors | |
28 | wxCheckListBox() { Init(); } | |
29 | ||
30 | wxCheckListBox(wxWindow *parent, | |
31 | wxWindowID id, | |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, | |
34 | int nStrings = 0, | |
35 | const wxString choices[] = NULL, | |
36 | long style = 0, | |
37 | const wxValidator& validator = wxDefaultValidator, | |
38 | const wxString& name = wxListBoxNameStr) | |
39 | { | |
40 | Init(); | |
41 | ||
42 | Create(parent, id, pos, size, nStrings, choices, style, validator, name); | |
43 | } | |
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); | |
52 | ||
53 | bool Create(wxWindow *parent, | |
54 | wxWindowID id, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | int nStrings = 0, | |
58 | const wxString choices[] = (const wxString *) NULL, | |
59 | long style = 0, | |
60 | const wxValidator& validator = wxDefaultValidator, | |
61 | const wxString& name = wxListBoxNameStr); | |
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); | |
70 | ||
71 | // implement check list box methods | |
72 | virtual bool IsChecked(unsigned int item) const; | |
73 | virtual void Check(unsigned int item, bool check = true); | |
74 | ||
75 | // and input handling | |
76 | virtual bool PerformAction(const wxControlAction& action, | |
77 | long numArg = -1l, | |
78 | const wxString& strArg = wxEmptyString); | |
79 | ||
80 | static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef); | |
81 | virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef) | |
82 | { | |
83 | return GetStdInputHandler(handlerDef); | |
84 | } | |
85 | ||
86 | protected: | |
87 | // override all methods which add/delete items to update m_checks array as | |
88 | // well | |
89 | virtual void OnItemInserted(unsigned int pos); | |
90 | virtual void DoDeleteOneItem(unsigned int n); | |
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 | ||
110 | #endif // _WX_UNIV_CHECKLST_H_ |