]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/checklst.h
Applied patch [ 837515 ] wxIPaddress + docs patch
[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();
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 bool Create(wxWindow *parent,
46 wxWindowID id,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 int nStrings = 0,
50 const wxString *choices = NULL,
51 long style = 0,
52 const wxValidator& validator = wxDefaultValidator,
53 const wxString& name = wxListBoxNameStr);
54
55 // implement check list box methods
56 virtual bool IsChecked(size_t item) const;
57 virtual void Check(size_t item, bool check = TRUE);
58
59 // and input handling
60 virtual bool PerformAction(const wxControlAction& action,
61 long numArg = -1l,
62 const wxString& strArg = wxEmptyString);
63
64 // override all methods which add/delete items to update m_checks array as
65 // well
66 virtual void Delete(int n);
67
68 protected:
69 virtual int DoAppend(const wxString& item);
70 virtual void DoInsertItems(const wxArrayString& items, int pos);
71 virtual void DoSetItems(const wxArrayString& items, void **clientData);
72 virtual void DoClear();
73
74 // draw the check items instead of the usual ones
75 virtual void DoDrawRange(wxControlRenderer *renderer,
76 int itemFirst, int itemLast);
77
78 // take them also into account for size calculation
79 virtual wxSize DoGetBestClientSize() const;
80
81 // common part of all ctors
82 void Init();
83
84 private:
85 // the array containing the checked status of the items
86 wxArrayInt m_checks;
87
88 DECLARE_DYNAMIC_CLASS(wxCheckListBox)
89 };
90
91 // ----------------------------------------------------------------------------
92 // wxStdCheckListBoxInputHandler
93 // ----------------------------------------------------------------------------
94
95 class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandler
96 {
97 public:
98 wxStdCheckListboxInputHandler(wxInputHandler *inphand);
99
100 virtual bool HandleKey(wxInputConsumer *consumer,
101 const wxKeyEvent& event,
102 bool pressed);
103 virtual bool HandleMouse(wxInputConsumer *consumer,
104 const wxMouseEvent& event);
105 };
106
107 #endif // _WX_UNIV_CHECKLST_H_
108