Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: checklst.h | |
3 | // Purpose: wxCheckListBox class - a listbox with checkable items | |
4 | // Note: this is an optional class. | |
37f214d5 | 5 | // Author: David Webster |
a419c3b1 | 6 | // Modified by: |
37f214d5 | 7 | // Created: 10/13/99 |
0e320a79 | 8 | // RCS-ID: $Id$ |
37f214d5 | 9 | // Copyright: (c) David Webster |
0e320a79 DW |
10 | // Licence: wxWindows licence |
11 | /////////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef _WX_CHECKLST_H_ | |
14 | #define _WX_CHECKLST_H_ | |
15 | ||
37f214d5 | 16 | #include <stddef.h> |
0e320a79 | 17 | |
37f214d5 | 18 | #include "wx/setup.h" |
0e320a79 | 19 | |
023d13a6 SN |
20 | class wxOwnerDrawn; // so the compiler knows, it is a class. |
21 | ||
37f214d5 | 22 | class wxCheckListBoxItem; // fwd decl, define in checklst.cpp |
0e320a79 | 23 | |
37f214d5 | 24 | class WXDLLEXPORT wxCheckListBox : public wxListBox |
0e320a79 DW |
25 | { |
26 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
27 | public: | |
28 | // ctors | |
29 | wxCheckListBox(); | |
30 | wxCheckListBox(wxWindow *parent, wxWindowID id, | |
31 | const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, | |
a419c3b1 | 33 | int nStrings = 0, |
0e320a79 DW |
34 | const wxString choices[] = NULL, |
35 | long style = 0, | |
57c4d796 | 36 | #if wxUSE_VALIDATORS |
0e320a79 | 37 | const wxValidator& validator = wxDefaultValidator, |
57c4d796 | 38 | #endif |
0e320a79 DW |
39 | const wxString& name = wxListBoxNameStr); |
40 | ||
37f214d5 DW |
41 | // override base class virtuals |
42 | virtual void Delete(int n); | |
43 | virtual void InsertItems(int nItems, const wxString items[], int pos); | |
44 | ||
45 | virtual bool SetFont( const wxFont &font ); | |
46 | ||
0e320a79 | 47 | // items may be checked |
37f214d5 DW |
48 | bool IsChecked(size_t uiIndex) const; |
49 | void Check(size_t uiIndex, bool bCheck = TRUE); | |
50 | ||
51 | // accessors | |
52 | size_t GetItemHeight() const { return m_nItemHeight; } | |
53 | ||
54 | protected: | |
55 | // we create our items ourselves and they have non-standard size, | |
56 | // so we need to override these functions | |
57 | virtual wxOwnerDrawn *CreateItem(size_t n); | |
58 | // virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT *item); | |
59 | ||
60 | // pressing space or clicking the check box toggles the item | |
61 | void OnChar(wxKeyEvent& event); | |
62 | void OnLeftClick(wxMouseEvent& event); | |
63 | ||
64 | private: | |
65 | size_t m_nItemHeight; // height of checklistbox items (the same for all) | |
66 | ||
67 | //Virtual function hiding suppression, do not use | |
68 | virtual wxControl *CreateItem(const wxItemResource* childResource, | |
69 | const wxItemResource* parentResource, | |
70 | const wxResourceTable *table = (const wxResourceTable *) NULL) | |
71 | { return(wxWindowBase::CreateItem(childResource, parentResource, table));}; | |
0e320a79 DW |
72 | |
73 | DECLARE_EVENT_TABLE() | |
74 | }; | |
75 | ||
76 | #endif | |
a419c3b1 | 77 | // _WX_CHECKLST_H_ |