]>
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 | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_UNIV_CHECKLST_H_ | |
13 | #define _WX_UNIV_CHECKLST_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
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 | |
33 | wxCheckListBox() { Init(); } | |
34 | ||
35 | wxCheckListBox(wxWindow *parent, | |
36 | wxWindowID id, | |
37 | const wxPoint& pos = wxDefaultPosition, | |
38 | const wxSize& size = wxDefaultSize, | |
39 | int nStrings = 0, | |
40 | const wxString *choices = NULL, | |
41 | long style = 0, | |
42 | const wxValidator& validator = wxDefaultValidator, | |
43 | const wxString& name = wxListBoxNameStr) | |
44 | { | |
45 | Init(); | |
46 | ||
47 | Create(parent, id, pos, size, nStrings, choices, style, validator, name); | |
48 | } | |
49 | ||
50 | bool Create(wxWindow *parent, | |
51 | wxWindowID id, | |
52 | const wxPoint& pos = wxDefaultPosition, | |
53 | const wxSize& size = wxDefaultSize, | |
54 | int nStrings = 0, | |
55 | const wxString *choices = NULL, | |
56 | long style = 0, | |
57 | const wxValidator& validator = wxDefaultValidator, | |
58 | const wxString& name = wxListBoxNameStr); | |
59 | ||
60 | // implement check list box methods | |
61 | virtual bool IsChecked(size_t item) const; | |
62 | virtual void Check(size_t item, bool check = TRUE); | |
63 | ||
64 | // and input handling | |
65 | virtual bool PerformAction(const wxControlAction& action, | |
66 | long numArg = -1l, | |
67 | const wxString& strArg = wxEmptyString); | |
68 | ||
69 | // override all methods which add/delete items to update m_checks array as | |
70 | // well | |
71 | virtual void Delete(int n); | |
72 | ||
73 | protected: | |
74 | virtual int DoAppend(const wxString& item); | |
75 | virtual void DoInsertItems(const wxArrayString& items, int pos); | |
76 | virtual void DoSetItems(const wxArrayString& items, void **clientData); | |
77 | virtual void DoClear(); | |
78 | ||
79 | // draw the check items instead of the usual ones | |
80 | virtual void DoDrawRange(wxControlRenderer *renderer, | |
81 | int itemFirst, int itemLast); | |
82 | ||
83 | // take them also into account for size calculation | |
84 | virtual wxSize DoGetBestClientSize() const; | |
85 | ||
86 | // common part of all ctors | |
87 | void Init(); | |
88 | ||
89 | private: | |
90 | // the array containing the checked status of the items | |
91 | wxArrayInt m_checks; | |
92 | ||
93 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
94 | }; | |
95 | ||
96 | // ---------------------------------------------------------------------------- | |
97 | // wxStdCheckListBoxInputHandler | |
98 | // ---------------------------------------------------------------------------- | |
99 | ||
100 | class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandler | |
101 | { | |
102 | public: | |
103 | wxStdCheckListboxInputHandler(wxInputHandler *inphand); | |
104 | ||
105 | virtual bool HandleKey(wxControl *control, | |
106 | const wxKeyEvent& event, | |
107 | bool pressed); | |
108 | virtual bool HandleMouse(wxControl *control, | |
109 | const wxMouseEvent& event); | |
110 | }; | |
111 | ||
112 | #endif // _WX_UNIV_CHECKLST_H_ | |
113 |