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