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 extern WXDLLIMPEXP_DATA_CORE(const wxChar
) wxCollapsiblePaneNameStr
[];
25 // ----------------------------------------------------------------------------
26 // wxCollapsiblePaneBase: interface for wxCollapsiblePane
27 // ----------------------------------------------------------------------------
29 #define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER)
30 #define wxCP_NO_TLW_RESIZE (0x0002)
32 class WXDLLIMPEXP_CORE wxCollapsiblePaneBase
: public wxControl
35 wxCollapsiblePaneBase() {}
37 virtual void Collapse(bool collapse
= true) = 0;
38 void Expand() { Collapse(false); }
40 virtual bool IsCollapsed() const = 0;
41 bool IsExpanded() const { return !IsCollapsed(); }
43 virtual wxWindow
*GetPane() const = 0;
45 virtual wxString
GetLabel() const = 0;
46 virtual void SetLabel(const wxString
& label
) = 0;
50 // ----------------------------------------------------------------------------
51 // event types and macros
52 // ----------------------------------------------------------------------------
54 BEGIN_DECLARE_EVENT_TYPES()
55 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_COLLPANE_CHANGED
, 1102)
56 END_DECLARE_EVENT_TYPES()
58 class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent
: public wxCommandEvent
61 wxCollapsiblePaneEvent() {}
62 wxCollapsiblePaneEvent(wxObject
*generator
, int id
, bool collapsed
)
63 : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED
, id
),
64 m_bCollapsed(collapsed
)
66 SetEventObject(generator
);
69 bool GetCollapsed() const { return m_bCollapsed
; }
70 void SetCollapsed(bool c
) { m_bCollapsed
= c
; }
73 // default copy ctor, assignment operator and dtor are ok
74 virtual wxEvent
*Clone() const { return new wxCollapsiblePaneEvent(*this); }
79 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent
)
82 // ----------------------------------------------------------------------------
83 // event types and macros
84 // ----------------------------------------------------------------------------
86 typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction
)(wxCollapsiblePaneEvent
&);
88 #define wxCollapsiblePaneEventHandler(func) \
89 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func)
91 #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
92 wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
95 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
96 #include "wx/gtk/collpane.h"
98 #include "wx/generic/collpaneg.h"
100 // use #define and not a typedef to allow forward declaring the class
101 #define wxCollapsiblePane wxGenericCollapsiblePane
104 #endif // wxUSE_COLLPANE
106 #endif // _WX_COLLAPSABLE_PANE_H_BASE_