1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxCollapsiblePane
4 // Author: Francesco Montorsi
7 // Copyright: (c) Francesco Montorsi
8 // Licence: wxWindows Licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_COLLAPSABLE_PANE_H_BASE_
12 #define _WX_COLLAPSABLE_PANE_H_BASE_
19 #include "wx/control.h"
22 extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsiblePaneNameStr
[];
24 // ----------------------------------------------------------------------------
25 // wxCollapsiblePaneBase: interface for wxCollapsiblePane
26 // ----------------------------------------------------------------------------
28 #define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER)
29 #define wxCP_NO_TLW_RESIZE (0x0002)
31 class WXDLLIMPEXP_CORE wxCollapsiblePaneBase
: public wxControl
34 wxCollapsiblePaneBase() {}
36 virtual void Collapse(bool collapse
= true) = 0;
37 void Expand() { Collapse(false); }
39 virtual bool IsCollapsed() const = 0;
40 bool IsExpanded() const { return !IsCollapsed(); }
42 virtual wxWindow
*GetPane() const = 0;
44 virtual wxString
GetLabel() const = 0;
45 virtual void SetLabel(const wxString
& label
) = 0;
49 // ----------------------------------------------------------------------------
50 // event types and macros
51 // ----------------------------------------------------------------------------
53 class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent
;
55 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE
, wxEVT_COLLAPSIBLEPANE_CHANGED
, wxCollapsiblePaneEvent
);
57 class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent
: public wxCommandEvent
60 wxCollapsiblePaneEvent() {}
61 wxCollapsiblePaneEvent(wxObject
*generator
, int id
, bool collapsed
)
62 : wxCommandEvent(wxEVT_COLLAPSIBLEPANE_CHANGED
, id
),
63 m_bCollapsed(collapsed
)
65 SetEventObject(generator
);
68 bool GetCollapsed() const { return m_bCollapsed
; }
69 void SetCollapsed(bool c
) { m_bCollapsed
= c
; }
72 // default copy ctor, assignment operator and dtor are ok
73 virtual wxEvent
*Clone() const { return new wxCollapsiblePaneEvent(*this); }
78 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent
)
81 // ----------------------------------------------------------------------------
82 // event types and macros
83 // ----------------------------------------------------------------------------
85 typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction
)(wxCollapsiblePaneEvent
&);
87 #define wxCollapsiblePaneEventHandler(func) \
88 wxEVENT_HANDLER_CAST(wxCollapsiblePaneEventFunction, func)
90 #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
91 wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
94 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
95 #include "wx/gtk/collpane.h"
97 #include "wx/generic/collpaneg.h"
99 // use #define and not a typedef to allow forward declaring the class
100 #define wxCollapsiblePane wxGenericCollapsiblePane
103 // old wxEVT_COMMAND_* constant
104 #define wxEVT_COMMAND_COLLPANE_CHANGED wxEVT_COLLAPSIBLEPANE_CHANGED
106 #endif // wxUSE_COLLPANE
108 #endif // _WX_COLLAPSABLE_PANE_H_BASE_