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