]> git.saurik.com Git - wxWidgets.git/blob - include/wx/collpane.h
Fix incorrect comparison
[wxWidgets.git] / include / wx / collpane.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/collpane.h
3 // Purpose: wxCollapsiblePane
4 // Author: Francesco Montorsi
5 // Modified by:
6 // Created: 8/10/2006
7 // RCS-ID: $Id$
8 // Copyright: (c) Francesco Montorsi
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COLLAPSABLE_PANE_H_BASE_
13 #define _WX_COLLAPSABLE_PANE_H_BASE_
14
15 #include "wx/control.h"
16
17
18 // ----------------------------------------------------------------------------
19 // wxCollapsiblePaneBase: interface for wxCollapsiblePane
20 // ----------------------------------------------------------------------------
21
22 #define wxCP_DEFAULT_STYLE (0)
23
24 class WXDLLEXPORT wxCollapsiblePaneBase : public wxControl
25 {
26 public:
27 wxCollapsiblePaneBase() {}
28
29 virtual void Collapse(bool collapse = true) = 0;
30 void Expand() { Collapse(false); }
31
32 virtual bool IsCollapsed() const = 0;
33 bool IsExpanded() const { return !IsCollapsed(); }
34
35 virtual wxWindow *GetPane() const = 0;
36
37 virtual wxString GetLabel() const = 0;
38 virtual void SetLabel(const wxString& label) = 0;
39 };
40
41
42 // ----------------------------------------------------------------------------
43 // event types and macros
44 // ----------------------------------------------------------------------------
45
46 BEGIN_DECLARE_EVENT_TYPES()
47 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLLPANE_CHANGED, 1102)
48 END_DECLARE_EVENT_TYPES()
49
50 class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent
51 {
52 public:
53 wxCollapsiblePaneEvent() {}
54 wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed)
55 : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED, id),
56 m_bCollapsed(collapsed)
57 {
58 SetEventObject(generator);
59 }
60
61 bool GetCollapsed() const { return m_bCollapsed; }
62 void SetCollapsed(bool c) { m_bCollapsed = c; }
63
64
65 // default copy ctor, assignment operator and dtor are ok
66 virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); }
67
68 private:
69 bool m_bCollapsed;
70
71 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent)
72 };
73
74 // ----------------------------------------------------------------------------
75 // event types and macros
76 // ----------------------------------------------------------------------------
77
78 typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&);
79
80 #define wxCollapsiblePaneEventHandler(func) \
81 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func)
82
83 #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
84 wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventFunction(fn))
85
86
87 #if defined(__WXGTK24__)
88 #include "wx/gtk/collpane.h"
89 #else
90 #include "wx/generic/collpaneg.h"
91 #define wxCollapsiblePane wxGenericCollapsiblePane
92 #endif
93
94 #endif
95 // _WX_COLLAPSABLE_PANE_H_BASE_