]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/checklst.h
general docview.cpp code cleanup; use wxVector<> instead of manually-allocated arrays...
[wxWidgets.git] / interface / wx / checklst.h
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 Only the new functions for this class are documented; see also wxListBox.
19
20 Please note that wxCheckListBox uses client data in its implementation,
21 and therefore this is not available to the application.
22
23 @beginEventTable{wxCommandEvent}
24 @event{EVT_CHECKLISTBOX(id, func)}
25 Process a wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event, when an item in
26 the check list box is checked or unchecked.
27 @endEventTable
28
29 @library{wxcore}
30 @category{ctrl}
31 <!-- @appearance{checklistbox.png} -->
32
33 @see wxListBox, wxChoice, wxComboBox, wxListCtrl, wxCommandEvent
34 */
35 class wxCheckListBox : public wxListBox
36 {
37 public:
38 /**
39 Default constructor.
40 */
41 wxCheckListBox();
42
43 //@{
44 /**
45 Constructor, creating and showing a list box.
46
47 @param parent
48 Parent window. Must not be @NULL.
49 @param id
50 Window identifier. The value wxID_ANY indicates a default value.
51 @param pos
52 Window position.
53 @param size
54 Window size. If wxDefaultSize is specified then the window is sized
55 appropriately.
56 @param n
57 Number of strings with which to initialise the control.
58 @param choices
59 An array of strings with which to initialise the control.
60 @param style
61 Window style. See wxCheckListBox.
62 @param validator
63 Window validator.
64 @param name
65 Window name.
66 */
67 wxCheckListBox(wxWindow* parent, wxWindowID id,
68 const wxPoint& pos = wxDefaultPosition,
69 const wxSize& size = wxDefaultSize,
70 int n,
71 const wxString choices[] = NULL,
72 long style = 0,
73 const wxValidator& validator = wxDefaultValidator,
74 const wxString& name = "listBox");
75 wxCheckListBox(wxWindow* parent, wxWindowID id,
76 const wxPoint& pos,
77 const wxSize& size,
78 const wxArrayString& choices,
79 long style = 0,
80 const wxValidator& validator = wxDefaultValidator,
81 const wxString& name = "listBox");
82 //@}
83
84 /**
85 Destructor, destroying the list box.
86 */
87 ~wxCheckListBox();
88
89 /**
90 Checks the given item. Note that calling this method does not result in
91 a wxEVT_COMMAND_CHECKLISTBOX_TOGGLE event being emitted.
92
93 @param item
94 Index of item to check.
95 @param check
96 @true if the item is to be checked, @false otherwise.
97 */
98 void Check(int item, bool check = true);
99
100 /**
101 Returns @true if the given item is checked, @false otherwise.
102
103 @param item
104 Index of item whose check status is to be returned.
105 */
106 bool IsChecked(unsigned int item) const;
107 };
108