]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: checklst.h | |
3 | // Purpose: wxCheckListBox class - a listbox with checkable items | |
4 | // Note: this is an optional class. | |
a31a5f85 JS |
5 | // Author: Stefan Csomor |
6 | // Modified by: | |
7 | // Created: 1998-01-01 | |
0dbd6262 | 8 | // RCS-ID: $Id$ |
a31a5f85 | 9 | // Copyright: (c) Stefan Csomor |
0dbd6262 SC |
10 | // Licence: wxWindows licence |
11 | /////////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef _WX_CHECKLST_H_ | |
14 | #define _WX_CHECKLST_H_ | |
15 | ||
12028905 | 16 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
0dbd6262 SC |
17 | #pragma interface "checklst.h" |
18 | #endif | |
19 | ||
03e11df5 | 20 | #if !defined(__MWERKS__) && !defined(__UNIX__) |
0dbd6262 SC |
21 | typedef unsigned int size_t; |
22 | #endif | |
23 | ||
dde587d9 | 24 | class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase |
0dbd6262 SC |
25 | { |
26 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
27 | public: | |
28 | // ctors | |
f5705626 SC |
29 | wxCheckListBox() { Init(); } |
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 | ||
45 | bool Create(wxWindow *parent, | |
46 | wxWindowID id, | |
47 | const wxPoint& pos = wxDefaultPosition, | |
48 | const wxSize& size = wxDefaultSize, | |
49 | int nStrings = 0, | |
50 | const wxString *choices = NULL, | |
51 | long style = 0, | |
52 | const wxValidator& validator = wxDefaultValidator, | |
53 | const wxString& name = wxListBoxNameStr); | |
0dbd6262 SC |
54 | |
55 | // items may be checked | |
56 | bool IsChecked(size_t uiIndex) const; | |
57 | void Check(size_t uiIndex, bool bCheck = TRUE); | |
f5705626 SC |
58 | void OnChar(wxKeyEvent& event) ; |
59 | void OnLeftClick(wxMouseEvent& event) ; | |
60 | ||
d921af51 JS |
61 | // metrics |
62 | wxInt32 m_checkBoxWidth; | |
50b30d83 | 63 | wxInt32 m_checkBoxHeight; |
d921af51 JS |
64 | wxInt32 m_TextBaseLineOffset; |
65 | ||
f5705626 SC |
66 | // the array containing the checked status of the items |
67 | wxArrayInt m_checks; | |
0dbd6262 | 68 | |
f5705626 SC |
69 | // override all methods which add/delete items to update m_checks array as |
70 | // well | |
71 | virtual void Delete(int n); | |
72 | protected: | |
73 | virtual int DoAppend(const wxString& item); | |
74 | virtual void DoInsertItems(const wxArrayString& items, int pos); | |
75 | virtual void DoSetItems(const wxArrayString& items, void **clientData); | |
76 | virtual void DoClear(); | |
77 | // common part of all ctors | |
78 | void Init(); | |
79 | private: | |
0dbd6262 SC |
80 | DECLARE_EVENT_TABLE() |
81 | }; | |
82 | ||
83 | #endif | |
84 | // _WX_CHECKLST_H_ |