]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: checklst.h | |
3 | // Purpose: wxCheckListBox class - a listbox with checkable items | |
4 | // Author: Vadim Zeitlin | |
0c35333e | 5 | // Modified by: |
2bda0e17 KB |
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 | ||
3f1af920 JS |
19 | // No! |
20 | // typedef unsigned int size_t; | |
21 | #include <stddef.h> | |
2bda0e17 | 22 | |
916d0b61 HH |
23 | #include "wx/setup.h" |
24 | ||
f97c9854 | 25 | #if !wxUSE_OWNER_DRAWN |
2bda0e17 KB |
26 | #error "wxCheckListBox class requires owner-drawn functionality." |
27 | #endif | |
28 | ||
29 | class wxCheckListBoxItem; // fwd decl, define in checklst.cpp | |
30 | ||
6c905cb7 | 31 | class WXDLLEXPORT wxCheckListBox : public wxListBox |
2bda0e17 KB |
32 | { |
33 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
34 | public: | |
35 | // ctors | |
36 | wxCheckListBox(); | |
debe6624 | 37 | wxCheckListBox(wxWindow *parent, wxWindowID id, |
2bda0e17 KB |
38 | const wxPoint& pos = wxDefaultPosition, |
39 | const wxSize& size = wxDefaultSize, | |
0c35333e | 40 | int nStrings = 0, |
2bda0e17 | 41 | const wxString choices[] = NULL, |
debe6624 | 42 | long style = 0, |
2bda0e17 KB |
43 | const wxValidator& validator = wxDefaultValidator, |
44 | const wxString& name = wxListBoxNameStr); | |
dd3c394a VZ |
45 | |
46 | // override base class virtuals | |
47 | virtual void Delete(int n); | |
48 | virtual void InsertItems(int nItems, const wxString items[], int pos); | |
2bda0e17 | 49 | |
0c35333e RD |
50 | virtual bool SetFont( const wxFont &font ); |
51 | ||
2bda0e17 | 52 | // items may be checked |
dd3c394a VZ |
53 | bool IsChecked(size_t uiIndex) const; |
54 | void Check(size_t uiIndex, bool bCheck = TRUE); | |
2bda0e17 KB |
55 | |
56 | // accessors | |
dd3c394a | 57 | size_t GetItemHeight() const { return m_nItemHeight; } |
2bda0e17 KB |
58 | |
59 | protected: | |
60 | // we create our items ourselves and they have non-standard size, | |
61 | // so we need to override these functions | |
3cda6353 | 62 | virtual wxOwnerDrawn *CreateItem(size_t n); |
2bda0e17 KB |
63 | virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); |
64 | ||
65 | // pressing space or clicking the check box toggles the item | |
66 | void OnChar(wxKeyEvent& event); | |
67 | void OnLeftClick(wxMouseEvent& event); | |
68 | ||
69 | private: | |
3cda6353 | 70 | size_t m_nItemHeight; // height of checklistbox items (the same for all) |
2bda0e17 KB |
71 | |
72 | DECLARE_EVENT_TABLE() | |
73 | }; | |
74 | ||
75 | #endif //_CHECKLST_H |