]>
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 | |
37f214d5 | 20 | class wxCheckListBoxItem; // fwd decl, define in checklst.cpp |
0e320a79 | 21 | |
37f214d5 | 22 | class WXDLLEXPORT wxCheckListBox : public wxListBox |
0e320a79 DW |
23 | { |
24 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
25 | public: | |
26 | // ctors | |
27 | wxCheckListBox(); | |
28 | wxCheckListBox(wxWindow *parent, wxWindowID id, | |
29 | const wxPoint& pos = wxDefaultPosition, | |
30 | const wxSize& size = wxDefaultSize, | |
a419c3b1 | 31 | int nStrings = 0, |
0e320a79 DW |
32 | const wxString choices[] = NULL, |
33 | long style = 0, | |
57c4d796 | 34 | #if wxUSE_VALIDATORS |
0e320a79 | 35 | const wxValidator& validator = wxDefaultValidator, |
57c4d796 | 36 | #endif |
0e320a79 DW |
37 | const wxString& name = wxListBoxNameStr); |
38 | ||
37f214d5 DW |
39 | // override base class virtuals |
40 | virtual void Delete(int n); | |
41 | virtual void InsertItems(int nItems, const wxString items[], int pos); | |
42 | ||
43 | virtual bool SetFont( const wxFont &font ); | |
44 | ||
0e320a79 | 45 | // items may be checked |
37f214d5 DW |
46 | bool IsChecked(size_t uiIndex) const; |
47 | void Check(size_t uiIndex, bool bCheck = TRUE); | |
48 | ||
49 | // accessors | |
50 | size_t GetItemHeight() const { return m_nItemHeight; } | |
51 | ||
52 | protected: | |
53 | // we create our items ourselves and they have non-standard size, | |
54 | // so we need to override these functions | |
55 | virtual wxOwnerDrawn *CreateItem(size_t n); | |
56 | // virtual bool OS2OnMeasure(WXMEASUREITEMSTRUCT *item); | |
57 | ||
58 | // pressing space or clicking the check box toggles the item | |
59 | void OnChar(wxKeyEvent& event); | |
60 | void OnLeftClick(wxMouseEvent& event); | |
61 | ||
62 | private: | |
63 | size_t m_nItemHeight; // height of checklistbox items (the same for all) | |
64 | ||
65 | //Virtual function hiding suppression, do not use | |
66 | virtual wxControl *CreateItem(const wxItemResource* childResource, | |
67 | const wxItemResource* parentResource, | |
68 | const wxResourceTable *table = (const wxResourceTable *) NULL) | |
69 | { return(wxWindowBase::CreateItem(childResource, parentResource, table));}; | |
0e320a79 DW |
70 | |
71 | DECLARE_EVENT_TABLE() | |
72 | }; | |
73 | ||
74 | #endif | |
a419c3b1 | 75 | // _WX_CHECKLST_H_ |