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_
20 #include "wx/control.h"
23 // ----------------------------------------------------------------------------
24 // wxCollapsiblePaneBase: interface for wxCollapsiblePane
25 // ----------------------------------------------------------------------------
27 #define wxCP_DEFAULT_STYLE (wxNO_BORDER)
28 #define wxCP_NO_TLW_RESIZE (0x0002)
30 class WXDLLIMPEXP_ADV wxCollapsiblePaneBase
: public wxControl
33 wxCollapsiblePaneBase() {}
35 virtual void Collapse(bool collapse
= true) = 0;
36 void Expand() { Collapse(false); }
38 virtual bool IsCollapsed() const = 0;
39 bool IsExpanded() const { return !IsCollapsed(); }
41 virtual wxWindow
*GetPane() const = 0;
43 virtual wxString
GetLabel() const = 0;
44 virtual void SetLabel(const wxString
& label
) = 0;
48 // ----------------------------------------------------------------------------
49 // event types and macros
50 // ----------------------------------------------------------------------------
52 BEGIN_DECLARE_EVENT_TYPES()
53 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV
, wxEVT_COMMAND_COLLPANE_CHANGED
, 1102)
54 END_DECLARE_EVENT_TYPES()
56 class WXDLLIMPEXP_ADV wxCollapsiblePaneEvent
: public wxCommandEvent
59 wxCollapsiblePaneEvent() {}
60 wxCollapsiblePaneEvent(wxObject
*generator
, int id
, bool collapsed
)
61 : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED
, id
),
62 m_bCollapsed(collapsed
)
64 SetEventObject(generator
);
67 bool GetCollapsed() const { return m_bCollapsed
; }
68 void SetCollapsed(bool c
) { m_bCollapsed
= c
; }
71 // default copy ctor, assignment operator and dtor are ok
72 virtual wxEvent
*Clone() const { return new wxCollapsiblePaneEvent(*this); }
77 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent
)
80 // ----------------------------------------------------------------------------
81 // event types and macros
82 // ----------------------------------------------------------------------------
84 typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction
)(wxCollapsiblePaneEvent
&);
86 #define wxCollapsiblePaneEventHandler(func) \
87 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func)
89 #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
90 wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
93 #if defined(__WXGTK24__)
94 #include "wx/gtk/collpane.h"
96 #include "wx/generic/collpaneg.h"
98 // use #define and not a typedef to allow forward declaring the class
99 #define wxCollapsiblePane wxGenericCollapsiblePane
102 #endif // wxUSE_COLLPANE
104 #endif // _WX_COLLAPSABLE_PANE_H_BASE_