]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/checklst.h
InitAsNeeded no longer inline in the header.
[wxWidgets.git] / include / wx / univ / checklst.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/checklst.h
3 // Purpose: wxCheckListBox class for wxUniversal
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 12.09.00
7 // RCS-ID: $Id$
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_UNIV_CHECKLST_H_
13 #define _WX_UNIV_CHECKLST_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "univchecklst.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // actions
21 // ----------------------------------------------------------------------------
22
23 #define wxACTION_CHECKLISTBOX_TOGGLE _T("toggle")
24
25 // ----------------------------------------------------------------------------
26 // wxCheckListBox
27 // ----------------------------------------------------------------------------
28
29 class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase
30 {
31 public:
32 // ctors
33 wxCheckListBox() { Init(); }
34
35 wxCheckListBox(wxWindow *parent,
36 wxWindowID id,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 int nStrings = 0,
40 const wxString choices[] = NULL,
41 long style = 0,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxListBoxNameStr)
44 {
45 Init();
46
47 Create(parent, id, pos, size, nStrings, choices, style, validator, name);
48 }
49 wxCheckListBox(wxWindow *parent,
50 wxWindowID id,
51 const wxPoint& pos,
52 const wxSize& size,
53 const wxArrayString& choices,
54 long style = 0,
55 const wxValidator& validator = wxDefaultValidator,
56 const wxString& name = wxListBoxNameStr);
57
58 bool Create(wxWindow *parent,
59 wxWindowID id,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 int nStrings = 0,
63 const wxString choices[] = (const wxString *) NULL,
64 long style = 0,
65 const wxValidator& validator = wxDefaultValidator,
66 const wxString& name = wxListBoxNameStr);
67 bool Create(wxWindow *parent,
68 wxWindowID id,
69 const wxPoint& pos,
70 const wxSize& size,
71 const wxArrayString& choices,
72 long style = 0,
73 const wxValidator& validator = wxDefaultValidator,
74 const wxString& name = wxListBoxNameStr);
75
76 // implement check list box methods
77 virtual bool IsChecked(size_t item) const;
78 virtual void Check(size_t item, bool check = TRUE);
79
80 // and input handling
81 virtual bool PerformAction(const wxControlAction& action,
82 long numArg = -1l,
83 const wxString& strArg = wxEmptyString);
84
85 // override all methods which add/delete items to update m_checks array as
86 // well
87 virtual void Delete(int n);
88
89 protected:
90 virtual int DoAppend(const wxString& item);
91 virtual void DoInsertItems(const wxArrayString& items, int pos);
92 virtual void DoSetItems(const wxArrayString& items, void **clientData);
93 virtual void DoClear();
94
95 // draw the check items instead of the usual ones
96 virtual void DoDrawRange(wxControlRenderer *renderer,
97 int itemFirst, int itemLast);
98
99 // take them also into account for size calculation
100 virtual wxSize DoGetBestClientSize() const;
101
102 // common part of all ctors
103 void Init();
104
105 private:
106 // the array containing the checked status of the items
107 wxArrayInt m_checks;
108
109 DECLARE_DYNAMIC_CLASS(wxCheckListBox)
110 };
111
112 // ----------------------------------------------------------------------------
113 // wxStdCheckListBoxInputHandler
114 // ----------------------------------------------------------------------------
115
116 class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandler
117 {
118 public:
119 wxStdCheckListboxInputHandler(wxInputHandler *inphand);
120
121 virtual bool HandleKey(wxInputConsumer *consumer,
122 const wxKeyEvent& event,
123 bool pressed);
124 virtual bool HandleMouse(wxInputConsumer *consumer,
125 const wxMouseEvent& event);
126 };
127
128 #endif // _WX_UNIV_CHECKLST_H_
129