1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxCollapsiblePane
4 // Author: Francesco Montorsi
8 // Copyright: (c) Francesco Montorsi
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COLLAPSABLE_PANE_H_BASE_
13 #define _WX_COLLAPSABLE_PANE_H_BASE_
15 #include "wx/control.h"
18 // ----------------------------------------------------------------------------
19 // wxCollapsiblePaneBase: interface for wxCollapsiblePane
20 // ----------------------------------------------------------------------------
22 #define wxCP_DEFAULT_STYLE (0)
24 class WXDLLIMPEXP_ADV wxCollapsiblePaneBase
: public wxControl
27 wxCollapsiblePaneBase() {}
29 virtual void Collapse(bool collapse
= true) = 0;
30 void Expand() { Collapse(false); }
32 virtual bool IsCollapsed() const = 0;
33 bool IsExpanded() const { return !IsCollapsed(); }
35 virtual wxWindow
*GetPane() const = 0;
37 virtual wxString
GetLabel() const = 0;
38 virtual void SetLabel(const wxString
& label
) = 0;
42 // ----------------------------------------------------------------------------
43 // event types and macros
44 // ----------------------------------------------------------------------------
46 BEGIN_DECLARE_EVENT_TYPES()
47 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_COLLPANE_CHANGED
, 1102)
48 END_DECLARE_EVENT_TYPES()
50 class WXDLLIMPEXP_ADV wxCollapsiblePaneEvent
: public wxCommandEvent
53 wxCollapsiblePaneEvent() {}
54 wxCollapsiblePaneEvent(wxObject
*generator
, int id
, bool collapsed
)
55 : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED
, id
),
56 m_bCollapsed(collapsed
)
58 SetEventObject(generator
);
61 bool GetCollapsed() const { return m_bCollapsed
; }
62 void SetCollapsed(bool c
) { m_bCollapsed
= c
; }
65 // default copy ctor, assignment operator and dtor are ok
66 virtual wxEvent
*Clone() const { return new wxCollapsiblePaneEvent(*this); }
71 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent
)
74 // ----------------------------------------------------------------------------
75 // event types and macros
76 // ----------------------------------------------------------------------------
78 typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction
)(wxCollapsiblePaneEvent
&);
80 #define wxCollapsiblePaneEventHandler(func) \
81 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func)
83 #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
84 wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventFunction(fn))
87 #if defined(__WXGTK24__)
88 #include "wx/gtk/collpane.h"
90 #include "wx/generic/collpaneg.h"
91 #define wxCollapsiblePane wxGenericCollapsiblePane
95 // _WX_COLLAPSABLE_PANE_H_BASE_