]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: checklst.h | |
3 | // Purpose: wxCheckListBox class - a listbox with checkable items | |
4 | // Note: this is an optional class. | |
5 | // Author: Stefan Csomor | |
6 | // Modified by: | |
7 | // Created: 1998-01-01 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) Stefan Csomor | |
10 | // Licence: wxWindows licence | |
11 | /////////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef _WX_CHECKLST_H_ | |
14 | #define _WX_CHECKLST_H_ | |
15 | ||
16 | #if !defined(__MWERKS__) && !defined(__UNIX__) | |
17 | typedef unsigned int size_t; | |
18 | #endif | |
19 | ||
20 | class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase | |
21 | { | |
22 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
23 | public: | |
24 | // ctors | |
25 | wxCheckListBox() { Init(); } | |
26 | wxCheckListBox(wxWindow *parent, | |
27 | wxWindowID id, | |
28 | const wxPoint& pos = wxDefaultPosition, | |
29 | const wxSize& size = wxDefaultSize, | |
30 | int nStrings = 0, | |
31 | const wxString *choices = NULL, | |
32 | long style = 0, | |
33 | const wxValidator& validator = wxDefaultValidator, | |
34 | const wxString& name = wxListBoxNameStr) | |
35 | { | |
36 | Init(); | |
37 | ||
38 | Create(parent, id, pos, size, nStrings, choices, style, validator, name); | |
39 | } | |
40 | wxCheckListBox(wxWindow *parent, | |
41 | wxWindowID id, | |
42 | const wxPoint& pos, | |
43 | const wxSize& size, | |
44 | const wxArrayString& choices, | |
45 | long style = 0, | |
46 | const wxValidator& validator = wxDefaultValidator, | |
47 | const wxString& name = wxListBoxNameStr) | |
48 | { | |
49 | Init(); | |
50 | ||
51 | Create(parent, id, pos, size, choices, style, validator, name); | |
52 | } | |
53 | ||
54 | bool Create(wxWindow *parent, | |
55 | wxWindowID id, | |
56 | const wxPoint& pos = wxDefaultPosition, | |
57 | const wxSize& size = wxDefaultSize, | |
58 | int nStrings = 0, | |
59 | const wxString *choices = NULL, | |
60 | long style = 0, | |
61 | const wxValidator& validator = wxDefaultValidator, | |
62 | const wxString& name = wxListBoxNameStr); | |
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); | |
71 | ||
72 | // items may be checked | |
73 | bool IsChecked(size_t uiIndex) const; | |
74 | void Check(size_t uiIndex, bool bCheck = TRUE); | |
75 | ||
76 | ||
77 | // override all methods which add/delete items to update m_checks array as | |
78 | // well | |
79 | virtual void Delete(int n); | |
80 | // the array containing the checked status of the items | |
81 | wxArrayInt m_checks; | |
82 | ||
83 | protected: | |
84 | virtual int DoAppend(const wxString& item); | |
85 | virtual void DoInsertItems(const wxArrayString& items, int pos); | |
86 | virtual void DoSetItems(const wxArrayString& items, void **clientData); | |
87 | virtual void DoClear(); | |
88 | // common part of all ctors | |
89 | void Init(); | |
90 | private: | |
91 | ||
92 | DECLARE_EVENT_TABLE() | |
93 | }; | |
94 | ||
95 | #endif | |
96 | // _WX_CHECKLST_H_ |