]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: checklst.h | |
3 | // Purpose: wxCheckListBox class - a listbox with checkable items | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 16.11.97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
bbcdf8bc | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef __CHECKLST__H_ |
13 | #define __CHECKLST__H_ | |
2bda0e17 | 14 | |
0d3820b3 JS |
15 | #ifdef __GNUG__ |
16 | #pragma interface "checklst.h" | |
17 | #endif | |
18 | ||
3cda6353 | 19 | typedef unsigned int size_t; |
2bda0e17 KB |
20 | |
21 | #if !USE_OWNER_DRAWN | |
22 | #error "wxCheckListBox class requires owner-drawn functionality." | |
23 | #endif | |
24 | ||
25 | class wxCheckListBoxItem; // fwd decl, define in checklst.cpp | |
26 | ||
27 | class wxCheckListBox : public wxListBox | |
28 | { | |
29 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
30 | public: | |
31 | // ctors | |
32 | wxCheckListBox(); | |
debe6624 | 33 | wxCheckListBox(wxWindow *parent, wxWindowID id, |
2bda0e17 KB |
34 | const wxPoint& pos = wxDefaultPosition, |
35 | const wxSize& size = wxDefaultSize, | |
debe6624 | 36 | int nStrings = 0, |
2bda0e17 | 37 | const wxString choices[] = NULL, |
debe6624 | 38 | long style = 0, |
2bda0e17 KB |
39 | const wxValidator& validator = wxDefaultValidator, |
40 | const wxString& name = wxListBoxNameStr); | |
41 | // const wxFont& font = wxNullFont); | |
42 | ||
43 | // items may be checked | |
3cda6353 VZ |
44 | bool IsChecked(size_t uiIndex) const; |
45 | void Check(size_t uiIndex, bool bCheck = TRUE); | |
2bda0e17 KB |
46 | |
47 | // accessors | |
3cda6353 | 48 | size_t GetItemHeight() const { return m_nItemHeight; } |
2bda0e17 KB |
49 | |
50 | protected: | |
51 | // we create our items ourselves and they have non-standard size, | |
52 | // so we need to override these functions | |
3cda6353 | 53 | virtual wxOwnerDrawn *CreateItem(size_t n); |
2bda0e17 KB |
54 | virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); |
55 | ||
56 | // pressing space or clicking the check box toggles the item | |
57 | void OnChar(wxKeyEvent& event); | |
58 | void OnLeftClick(wxMouseEvent& event); | |
59 | ||
60 | private: | |
3cda6353 | 61 | size_t m_nItemHeight; // height of checklistbox items (the same for all) |
2bda0e17 KB |
62 | |
63 | DECLARE_EVENT_TABLE() | |
64 | }; | |
65 | ||
66 | #endif //_CHECKLST_H |