]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/mac/classic/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 | class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase | |
17 | { | |
18 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
19 | public: | |
20 | // ctors | |
21 | wxCheckListBox() { Init(); } | |
22 | wxCheckListBox(wxWindow *parent, | |
23 | wxWindowID id, | |
24 | const wxPoint& pos = wxDefaultPosition, | |
25 | const wxSize& size = wxDefaultSize, | |
26 | int nStrings = 0, | |
27 | const wxString *choices = NULL, | |
28 | long style = 0, | |
29 | const wxValidator& validator = wxDefaultValidator, | |
30 | const wxString& name = wxListBoxNameStr) | |
31 | { | |
32 | Init(); | |
33 | ||
34 | Create(parent, id, pos, size, nStrings, choices, style, validator, name); | |
35 | } | |
36 | wxCheckListBox(wxWindow *parent, | |
37 | wxWindowID id, | |
38 | const wxPoint& pos, | |
39 | const wxSize& size, | |
40 | const wxArrayString& choices, | |
41 | long style = 0, | |
42 | const wxValidator& validator = wxDefaultValidator, | |
43 | const wxString& name = wxListBoxNameStr) | |
44 | { | |
45 | Init(); | |
46 | ||
47 | Create(parent, id, pos, size, 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 | bool Create(wxWindow *parent, | |
60 | wxWindowID id, | |
61 | const wxPoint& pos, | |
62 | const wxSize& size, | |
63 | const wxArrayString& choices, | |
64 | long style = 0, | |
65 | const wxValidator& validator = wxDefaultValidator, | |
66 | const wxString& name = wxListBoxNameStr); | |
67 | ||
68 | // items may be checked | |
69 | bool IsChecked(unsigned int uiIndex) const; | |
70 | void Check(unsigned int uiIndex, bool bCheck = true); | |
71 | void OnChar(wxKeyEvent& event) ; | |
72 | void OnLeftClick(wxMouseEvent& event) ; | |
73 | ||
74 | // metrics | |
75 | wxInt32 m_checkBoxWidth; | |
76 | wxInt32 m_checkBoxHeight; | |
77 | wxInt32 m_TextBaseLineOffset; | |
78 | ||
79 | // the array containing the checked status of the items | |
80 | wxArrayInt m_checks; | |
81 | ||
82 | // override all methods which add/delete items to update m_checks array as | |
83 | // well | |
84 | virtual void Delete(unsigned int n); | |
85 | protected: | |
86 | virtual int DoAppend(const wxString& item); | |
87 | virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); | |
88 | virtual void DoSetItems(const wxArrayString& items, void **clientData); | |
89 | virtual void DoClear(); | |
90 | // common part of all ctors | |
91 | void Init(); | |
92 | private: | |
93 | DECLARE_EVENT_TABLE() | |
94 | }; | |
95 | ||
96 | #endif | |
97 | // _WX_CHECKLST_H_ |