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