]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: checklst.h | |
3 | // Purpose: interface of wxCheckListBox | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxCheckListBox | |
11 | ||
12 | A wxCheckListBox is like a wxListBox, but allows items to be checked or | |
13 | unchecked. | |
14 | ||
15 | When using this class under Windows wxWidgets must be compiled with | |
16 | wxUSE_OWNER_DRAWN set to 1. | |
17 | ||
18 | @beginEventEmissionTable{wxCommandEvent} | |
19 | @event{EVT_CHECKLISTBOX(id, func)} | |
20 | Process a @c wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event, when an item in | |
21 | the check list box is checked or unchecked. wxCommandEvent::GetInt() | |
22 | will contain the index of the item that was checked or unchecked. | |
23 | wxCommandEvent::IsChecked() is not valid! Use wxCheckListBox::IsChecked() | |
24 | instead. | |
25 | @endEventTable | |
26 | ||
27 | @library{wxcore} | |
28 | @category{ctrl} | |
29 | @appearance{checklistbox} | |
30 | ||
31 | @see wxListBox, wxChoice, wxComboBox, wxListCtrl, wxCommandEvent | |
32 | */ | |
33 | class wxCheckListBox : public wxListBox | |
34 | { | |
35 | public: | |
36 | /** | |
37 | Default constructor. | |
38 | */ | |
39 | wxCheckListBox(); | |
40 | ||
41 | //@{ | |
42 | /** | |
43 | Constructor, creating and showing a list box. | |
44 | ||
45 | @param parent | |
46 | Parent window. Must not be @NULL. | |
47 | @param id | |
48 | Window identifier. The value wxID_ANY indicates a default value. | |
49 | @param pos | |
50 | Window position. | |
51 | If ::wxDefaultPosition is specified then a default position is chosen. | |
52 | @param size | |
53 | Window size. | |
54 | If ::wxDefaultSize is specified then the window is sized appropriately. | |
55 | @param n | |
56 | Number of strings with which to initialise the control. | |
57 | @param choices | |
58 | An array of strings with which to initialise the control. | |
59 | @param style | |
60 | Window style. See wxCheckListBox. | |
61 | @param validator | |
62 | Window validator. | |
63 | @param name | |
64 | Window name. | |
65 | ||
66 | @beginWxPerlOnly | |
67 | Not supported by wxPerl. | |
68 | @endWxPerlOnly | |
69 | */ | |
70 | wxCheckListBox(wxWindow* parent, wxWindowID id, | |
71 | const wxPoint& pos = wxDefaultPosition, | |
72 | const wxSize& size = wxDefaultSize, | |
73 | int n = 0, | |
74 | const wxString choices[] = NULL, | |
75 | long style = 0, | |
76 | const wxValidator& validator = wxDefaultValidator, | |
77 | const wxString& name = "listBox"); | |
78 | /** | |
79 | Constructor, creating and showing a list box. | |
80 | ||
81 | @param parent | |
82 | Parent window. Must not be @NULL. | |
83 | @param id | |
84 | Window identifier. The value wxID_ANY indicates a default value. | |
85 | @param pos | |
86 | Window position. | |
87 | @param size | |
88 | Window size. If wxDefaultSize is specified then the window is sized | |
89 | appropriately. | |
90 | @param choices | |
91 | An array of strings with which to initialise the control. | |
92 | @param style | |
93 | Window style. See wxCheckListBox. | |
94 | @param validator | |
95 | Window validator. | |
96 | @param name | |
97 | Window name. | |
98 | ||
99 | @beginWxPerlOnly | |
100 | Use an array reference for the @a choices parameter. | |
101 | @endWxPerlOnly | |
102 | */ | |
103 | wxCheckListBox(wxWindow* parent, wxWindowID id, | |
104 | const wxPoint& pos, | |
105 | const wxSize& size, | |
106 | const wxArrayString& choices, | |
107 | long style = 0, | |
108 | const wxValidator& validator = wxDefaultValidator, | |
109 | const wxString& name = "listBox"); | |
110 | //@} | |
111 | ||
112 | bool Create(wxWindow *parent, | |
113 | wxWindowID id, | |
114 | const wxPoint& pos = wxDefaultPosition, | |
115 | const wxSize& size = wxDefaultSize, | |
116 | int nStrings = 0, | |
117 | const wxString choices[] = NULL, | |
118 | long style = 0, | |
119 | const wxValidator& validator = wxDefaultValidator, | |
120 | const wxString& name = wxListBoxNameStr); | |
121 | ||
122 | bool Create(wxWindow *parent, | |
123 | wxWindowID id, | |
124 | const wxPoint& pos, | |
125 | const wxSize& size, | |
126 | const wxArrayString& choices, | |
127 | long style = 0, | |
128 | const wxValidator& validator = wxDefaultValidator, | |
129 | const wxString& name = wxListBoxNameStr); | |
130 | ||
131 | /** | |
132 | Destructor, destroying the list box. | |
133 | */ | |
134 | virtual ~wxCheckListBox(); | |
135 | ||
136 | /** | |
137 | Checks the given item. Note that calling this method does not result in | |
138 | a @c wxEVT_COMMAND_CHECKLISTBOX_TOGGLE event being emitted. | |
139 | ||
140 | @param item | |
141 | Index of item to check. | |
142 | @param check | |
143 | @true if the item is to be checked, @false otherwise. | |
144 | */ | |
145 | void Check(unsigned int item, bool check = true); | |
146 | ||
147 | /** | |
148 | Returns @true if the given item is checked, @false otherwise. | |
149 | ||
150 | @param item | |
151 | Index of item whose check status is to be returned. | |
152 | */ | |
153 | bool IsChecked(unsigned int item) const; | |
154 | ||
155 | }; | |
156 |