]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: checklst.h | |
3 | // Purpose: interface of wxCheckListBox | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
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 | @beginEventTable{wxCommandEvent} | |
19 | @event{EVT_CHECKLISTBOX(id, func)} | |
20 | Process a wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event, when an item in | |
21 | the check list box is checked or unchecked. | |
22 | @endEventTable | |
23 | ||
24 | @library{wxcore} | |
25 | @category{ctrl} | |
26 | @appearance{checklistbox.png} | |
27 | ||
28 | @see wxListBox, wxChoice, wxComboBox, wxListCtrl, wxCommandEvent | |
29 | */ | |
30 | class wxCheckListBox : public wxListBox | |
31 | { | |
32 | public: | |
33 | /** | |
34 | Default constructor. | |
35 | */ | |
36 | wxCheckListBox(); | |
37 | ||
38 | //@{ | |
39 | /** | |
40 | Constructor, creating and showing a list box. | |
41 | ||
42 | @param parent | |
43 | Parent window. Must not be @NULL. | |
44 | @param id | |
45 | Window identifier. The value wxID_ANY indicates a default value. | |
46 | @param pos | |
47 | Window position. | |
48 | @param size | |
49 | Window size. If wxDefaultSize is specified then the window is sized | |
50 | appropriately. | |
51 | @param n | |
52 | Number of strings with which to initialise the control. | |
53 | @param choices | |
54 | An array of strings with which to initialise the control. | |
55 | @param style | |
56 | Window style. See wxCheckListBox. | |
57 | @param validator | |
58 | Window validator. | |
59 | @param name | |
60 | Window name. | |
61 | */ | |
62 | wxCheckListBox(wxWindow* parent, wxWindowID id, | |
63 | const wxPoint& pos = wxDefaultPosition, | |
64 | const wxSize& size = wxDefaultSize, | |
65 | int n = 0, | |
66 | const wxString choices[] = NULL, | |
67 | long style = 0, | |
68 | const wxValidator& validator = wxDefaultValidator, | |
69 | const wxString& name = "listBox"); | |
70 | /** | |
71 | Constructor, creating and showing a list box. | |
72 | ||
73 | @param parent | |
74 | Parent window. Must not be @NULL. | |
75 | @param id | |
76 | Window identifier. The value wxID_ANY indicates a default value. | |
77 | @param pos | |
78 | Window position. | |
79 | @param size | |
80 | Window size. If wxDefaultSize is specified then the window is sized | |
81 | appropriately. | |
82 | @param choices | |
83 | An array of strings with which to initialise the control. | |
84 | @param style | |
85 | Window style. See wxCheckListBox. | |
86 | @param validator | |
87 | Window validator. | |
88 | @param name | |
89 | Window name. | |
90 | */ | |
91 | wxCheckListBox(wxWindow* parent, wxWindowID id, | |
92 | const wxPoint& pos, | |
93 | const wxSize& size, | |
94 | const wxArrayString& choices, | |
95 | long style = 0, | |
96 | const wxValidator& validator = wxDefaultValidator, | |
97 | const wxString& name = "listBox"); | |
98 | //@} | |
99 | ||
100 | /** | |
101 | Destructor, destroying the list box. | |
102 | */ | |
103 | virtual ~wxCheckListBox(); | |
104 | ||
105 | /** | |
106 | Checks the given item. Note that calling this method does not result in | |
107 | a wxEVT_COMMAND_CHECKLISTBOX_TOGGLE event being emitted. | |
108 | ||
109 | @param item | |
110 | Index of item to check. | |
111 | @param check | |
112 | @true if the item is to be checked, @false otherwise. | |
113 | */ | |
114 | void Check(unsigned int item, bool check = true); | |
115 | ||
116 | /** | |
117 | Returns @true if the given item is checked, @false otherwise. | |
118 | ||
119 | @param item | |
120 | Index of item whose check status is to be returned. | |
121 | */ | |
122 | bool IsChecked(unsigned int item) const; | |
123 | }; | |
124 |