]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/checklst.h
Try native method first in LoadFile() and SaveFile()
[wxWidgets.git] / interface / wx / checklst.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: checklst.h
e54c96f1 3// Purpose: interface of wxCheckListBox
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxCheckListBox
7c913512 10
bfac6166
BP
11 A wxCheckListBox is like a wxListBox, but allows items to be checked or
12 unchecked.
7c913512 13
23324ae1 14 When using this class under Windows wxWidgets must be compiled with
bfac6166 15 wxUSE_OWNER_DRAWN set to 1.
7c913512 16
3051a44a 17 @beginEventEmissionTable{wxCommandEvent}
8c6791e4 18 @event{EVT_CHECKLISTBOX(id, func)}
ce7fe42e 19 Process a @c wxEVT_CHECKLISTBOX event, when an item in
3051a44a
FM
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.
23324ae1 24 @endEventTable
7c913512 25
23324ae1
FM
26 @library{wxcore}
27 @category{ctrl}
ce154616 28 @appearance{checklistbox}
7c913512 29
e54c96f1 30 @see wxListBox, wxChoice, wxComboBox, wxListCtrl, wxCommandEvent
23324ae1
FM
31*/
32class wxCheckListBox : public wxListBox
33{
34public:
bfac6166
BP
35 /**
36 Default constructor.
37 */
38 wxCheckListBox();
39
23324ae1
FM
40 //@{
41 /**
42 Constructor, creating and showing a list box.
3c4f71cc 43
7c913512 44 @param parent
4cc4bfaf 45 Parent window. Must not be @NULL.
7c913512 46 @param id
4cc4bfaf 47 Window identifier. The value wxID_ANY indicates a default value.
7c913512 48 @param pos
4cc4bfaf 49 Window position.
dc1b07fd 50 If ::wxDefaultPosition is specified then a default position is chosen.
7c913512 51 @param size
dc1b07fd
FM
52 Window size.
53 If ::wxDefaultSize is specified then the window is sized appropriately.
7c913512 54 @param n
4cc4bfaf 55 Number of strings with which to initialise the control.
7c913512 56 @param choices
4cc4bfaf 57 An array of strings with which to initialise the control.
7c913512 58 @param style
4cc4bfaf 59 Window style. See wxCheckListBox.
7c913512 60 @param validator
4cc4bfaf 61 Window validator.
7c913512 62 @param name
4cc4bfaf 63 Window name.
1058f652
MB
64
65 @beginWxPerlOnly
66 Not supported by wxPerl.
67 @endWxPerlOnly
23324ae1 68 */
7c913512
FM
69 wxCheckListBox(wxWindow* parent, wxWindowID id,
70 const wxPoint& pos = wxDefaultPosition,
71 const wxSize& size = wxDefaultSize,
792255cc 72 int n = 0,
4cc4bfaf 73 const wxString choices[] = NULL,
7c913512
FM
74 long style = 0,
75 const wxValidator& validator = wxDefaultValidator,
76 const wxString& name = "listBox");
792255cc
VZ
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.
1058f652
MB
97
98 @beginWxPerlOnly
99 Use an array reference for the @a choices parameter.
100 @endWxPerlOnly
792255cc 101 */
7c913512
FM
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");
23324ae1
FM
109 //@}
110
e9321277
RD
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
23324ae1
FM
130 /**
131 Destructor, destroying the list box.
132 */
62a7da75 133 virtual ~wxCheckListBox();
23324ae1
FM
134
135 /**
bfac6166 136 Checks the given item. Note that calling this method does not result in
ce7fe42e 137 a @c wxEVT_CHECKLISTBOX event being emitted.
3c4f71cc 138
7c913512 139 @param item
4cc4bfaf 140 Index of item to check.
7c913512 141 @param check
4cc4bfaf 142 @true if the item is to be checked, @false otherwise.
23324ae1 143 */
62a7da75 144 void Check(unsigned int item, bool check = true);
bfac6166
BP
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;
ae72623b
VZ
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;
23324ae1 167};
e54c96f1 168