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