]> git.saurik.com Git - wxWidgets.git/blob - include/wx/collpane.h
follow up parent chain to properly support modal dialog parents, see #15383
[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 // Copyright: (c) Francesco Montorsi
8 // Licence: wxWindows Licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_COLLAPSABLE_PANE_H_BASE_
12 #define _WX_COLLAPSABLE_PANE_H_BASE_
13
14 #include "wx/defs.h"
15
16
17 #if wxUSE_COLLPANE
18
19 #include "wx/control.h"
20
21 // class name
22 extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsiblePaneNameStr[];
23
24 // ----------------------------------------------------------------------------
25 // wxCollapsiblePaneBase: interface for wxCollapsiblePane
26 // ----------------------------------------------------------------------------
27
28 #define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER)
29 #define wxCP_NO_TLW_RESIZE (0x0002)
30
31 class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl
32 {
33 public:
34 wxCollapsiblePaneBase() {}
35
36 virtual void Collapse(bool collapse = true) = 0;
37 void Expand() { Collapse(false); }
38
39 virtual bool IsCollapsed() const = 0;
40 bool IsExpanded() const { return !IsCollapsed(); }
41
42 virtual wxWindow *GetPane() const = 0;
43
44 virtual wxString GetLabel() const = 0;
45 virtual void SetLabel(const wxString& label) = 0;
46 };
47
48
49 // ----------------------------------------------------------------------------
50 // event types and macros
51 // ----------------------------------------------------------------------------
52
53 class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent;
54
55 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEvent );
56
57 class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent
58 {
59 public:
60 wxCollapsiblePaneEvent() {}
61 wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed)
62 : wxCommandEvent(wxEVT_COLLAPSIBLEPANE_CHANGED, id),
63 m_bCollapsed(collapsed)
64 {
65 SetEventObject(generator);
66 }
67
68 bool GetCollapsed() const { return m_bCollapsed; }
69 void SetCollapsed(bool c) { m_bCollapsed = c; }
70
71
72 // default copy ctor, assignment operator and dtor are ok
73 virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); }
74
75 private:
76 bool m_bCollapsed;
77
78 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent)
79 };
80
81 // ----------------------------------------------------------------------------
82 // event types and macros
83 // ----------------------------------------------------------------------------
84
85 typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&);
86
87 #define wxCollapsiblePaneEventHandler(func) \
88 wxEVENT_HANDLER_CAST(wxCollapsiblePaneEventFunction, func)
89
90 #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
91 wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
92
93
94 #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
95 #include "wx/gtk/collpane.h"
96 #else
97 #include "wx/generic/collpaneg.h"
98
99 // use #define and not a typedef to allow forward declaring the class
100 #define wxCollapsiblePane wxGenericCollapsiblePane
101 #endif
102
103 // old wxEVT_COMMAND_* constant
104 #define wxEVT_COMMAND_COLLPANE_CHANGED wxEVT_COLLAPSIBLEPANE_CHANGED
105
106 #endif // wxUSE_COLLPANE
107
108 #endif // _WX_COLLAPSABLE_PANE_H_BASE_