]>
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 | |
57c4d796 | 38 | #if wxUSE_VALIDATORS |
1de4baa3 | 39 | ,const wxValidator& rValidator = wxDefaultValidator |
57c4d796 | 40 | #endif |
1de4baa3 DW |
41 | ,const wxString& rsName = wxListBoxNameStr |
42 | ); | |
43 | ||
f5ea767e | 44 | // |
1de4baa3 DW |
45 | // Override base class virtuals |
46 | // | |
47 | virtual void Delete(int n); | |
48 | virtual void InsertItems( int nItems | |
49 | ,const wxString asItems[] | |
50 | ,int nPos | |
51 | ); | |
52 | ||
53 | virtual bool SetFont(const wxFont &rFont); | |
54 | ||
f5ea767e | 55 | // |
1de4baa3 DW |
56 | // Items may be checked |
57 | // | |
58 | bool IsChecked(size_t uiIndex) const; | |
59 | void Check( size_t uiIndex | |
60 | ,bool bCheck = TRUE | |
61 | ); | |
62 | ||
f5ea767e | 63 | // |
1de4baa3 DW |
64 | // Accessors |
65 | // | |
66 | size_t GetItemHeight(void) const { return m_nItemHeight; } | |
37f214d5 DW |
67 | |
68 | protected: | |
f5ea767e | 69 | // |
1de4baa3 DW |
70 | // We create our items ourselves and they have non-standard size, |
71 | // so we need to override these functions | |
72 | // | |
73 | virtual wxOwnerDrawn* CreateItem(size_t n); | |
f5ea767e | 74 | virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem); |
1de4baa3 | 75 | |
f5ea767e | 76 | // |
1de4baa3 DW |
77 | // Pressing space or clicking the check box toggles the item |
78 | // | |
79 | void OnChar(wxKeyEvent& rEvent); | |
80 | void OnLeftClick(wxMouseEvent& rEvent); | |
37f214d5 DW |
81 | |
82 | private: | |
1de4baa3 DW |
83 | size_t m_nItemHeight; // height of checklistbox items (the same for all) |
84 | ||
85 | // | |
86 | // Virtual function hiding suppression, do not use | |
87 | // | |
88 | virtual wxControl* CreateItem( const wxItemResource* pChildResource | |
89 | ,const wxItemResource* pParentResource | |
90 | ,const wxResourceTable* pTable = (const wxResourceTable *) NULL | |
91 | ) | |
f5ea767e | 92 | { |
1de4baa3 DW |
93 | return(wxWindowBase::CreateItem( pChildResource |
94 | ,pParentResource | |
95 | ,pTable | |
96 | )); | |
97 | } | |
98 | DECLARE_DYNAMIC_CLASS(wxCheckListBox) | |
99 | DECLARE_EVENT_TABLE() | |
100 | }; // end of CLASS wxCheckListBoxItem | |
0e320a79 DW |
101 | |
102 | #endif | |
a419c3b1 | 103 | // _WX_CHECKLST_H_ |