]>
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 | |
1de4baa3 | 20 | class wxOwnerDrawn; // so the compiler knows, it is a class. |
023d13a6 | 21 | |
37f214d5 | 22 | class wxCheckListBoxItem; // fwd decl, define in checklst.cpp |
0e320a79 | 23 | |
37f214d5 | 24 | class WXDLLEXPORT wxCheckListBox : public wxListBox |
0e320a79 | 25 | { |
0e320a79 | 26 | public: |
f5ea767e | 27 | // |
1de4baa3 DW |
28 | // Ctors |
29 | // | |
30 | wxCheckListBox(); | |
31 | wxCheckListBox( wxWindow* pParent | |
32 | ,wxWindowID vId | |
33 | ,const wxPoint& rPos = wxDefaultPosition | |
34 | ,const wxSize& vSize = wxDefaultSize | |
35 | ,int nStrings = 0 | |
36 | ,const wxString asChoices[] = NULL | |
37 | ,long lStyle = 0 | |
1de4baa3 | 38 | ,const wxValidator& rValidator = wxDefaultValidator |
1de4baa3 DW |
39 | ,const wxString& rsName = wxListBoxNameStr |
40 | ); | |
41 | ||
f5ea767e | 42 | // |
1de4baa3 DW |
43 | // Override base class virtuals |
44 | // | |
45 | virtual void Delete(int n); | |
46 | virtual void InsertItems( int nItems | |
47 | ,const wxString asItems[] | |
48 | ,int nPos | |
49 | ); | |
50 | ||
51 | virtual bool SetFont(const wxFont &rFont); | |
52 | ||
f5ea767e | 53 | // |
1de4baa3 DW |
54 | // Items may be checked |
55 | // | |
56 | bool IsChecked(size_t uiIndex) const; | |
57 | void Check( size_t uiIndex | |
58 | ,bool bCheck = TRUE | |
59 | ); | |
60 | ||
f5ea767e | 61 | // |
1de4baa3 DW |
62 | // Accessors |
63 | // | |
64 | size_t GetItemHeight(void) const { return m_nItemHeight; } | |
37f214d5 DW |
65 | |
66 | protected: | |
f5ea767e | 67 | // |
1de4baa3 DW |
68 | // We create our items ourselves and they have non-standard size, |
69 | // so we need to override these functions | |
70 | // | |
71 | virtual wxOwnerDrawn* CreateItem(size_t n); | |
f5ea767e | 72 | virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem); |
1de4baa3 | 73 | |
f5ea767e | 74 | // |
1de4baa3 DW |
75 | // Pressing space or clicking the check box toggles the item |
76 | // | |
77 | void OnChar(wxKeyEvent& rEvent); | |
78 | void OnLeftClick(wxMouseEvent& rEvent); | |
37f214d5 DW |
79 | |
80 | private: | |
1de4baa3 DW |
81 | size_t m_nItemHeight; // height of checklistbox items (the same for all) |
82 | ||
83 | // | |
84 | // Virtual function hiding suppression, do not use | |
85 | // | |
86 | virtual wxControl* CreateItem( const wxItemResource* pChildResource | |
87 | ,const wxItemResource* pParentResource | |
88 | ,const wxResourceTable* pTable = (const wxResourceTable *) NULL | |
89 | ) | |
f5ea767e | 90 | { |
1de4baa3 DW |
91 | return(wxWindowBase::CreateItem( pChildResource |
92 | ,pParentResource | |
93 | ,pTable | |
94 | )); | |
95 | } | |
96 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
97 | DECLARE_EVENT_TABLE() | |
98 | }; // end of CLASS wxCheckListBoxItem | |
0e320a79 DW |
99 | |
100 | #endif | |
a419c3b1 | 101 | // _WX_CHECKLST_H_ |