]>
Commit | Line | Data |
---|---|---|
3c1f8cb1 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/collpane.h | |
3 | // Purpose: wxCollapsiblePane | |
4 | // Author: Francesco Montorsi | |
5 | // Modified by: | |
6 | // Created: 8/10/2006 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Francesco Montorsi | |
9 | // Licence: wxWindows Licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_COLLAPSABLE_PANE_H_BASE_ | |
13 | #define _WX_COLLAPSABLE_PANE_H_BASE_ | |
14 | ||
15 | #include "wx/control.h" | |
16 | ||
17 | ||
18 | // ---------------------------------------------------------------------------- | |
19 | // wxCollapsiblePaneBase: interface for wxCollapsiblePane | |
20 | // ---------------------------------------------------------------------------- | |
21 | ||
22 | #define wxCP_DEFAULT_STYLE (0) | |
23 | ||
00b3a749 | 24 | class WXDLLIMPEXP_ADV wxCollapsiblePaneBase : public wxControl |
3c1f8cb1 VZ |
25 | { |
26 | public: | |
27 | wxCollapsiblePaneBase() {} | |
28 | ||
3c1f8cb1 | 29 | virtual void Collapse(bool collapse = true) = 0; |
550d433e VZ |
30 | void Expand() { Collapse(false); } |
31 | ||
3c1f8cb1 | 32 | virtual bool IsCollapsed() const = 0; |
550d433e VZ |
33 | bool IsExpanded() const { return !IsCollapsed(); } |
34 | ||
3c1f8cb1 VZ |
35 | virtual wxWindow *GetPane() const = 0; |
36 | ||
37 | virtual wxString GetLabel() const = 0; | |
550d433e | 38 | virtual void SetLabel(const wxString& label) = 0; |
3c1f8cb1 VZ |
39 | }; |
40 | ||
41 | ||
42 | // ---------------------------------------------------------------------------- | |
43 | // event types and macros | |
44 | // ---------------------------------------------------------------------------- | |
45 | ||
46 | BEGIN_DECLARE_EVENT_TYPES() | |
cd983175 | 47 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV, wxEVT_COMMAND_COLLPANE_CHANGED, 1102) |
3c1f8cb1 VZ |
48 | END_DECLARE_EVENT_TYPES() |
49 | ||
cd983175 | 50 | class WXDLLIMPEXP_ADV wxCollapsiblePaneEvent : public wxCommandEvent |
3c1f8cb1 VZ |
51 | { |
52 | public: | |
53 | wxCollapsiblePaneEvent() {} | |
54 | wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed) | |
55 | : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED, id), | |
56 | m_bCollapsed(collapsed) | |
57 | { | |
58 | SetEventObject(generator); | |
59 | } | |
60 | ||
61 | bool GetCollapsed() const { return m_bCollapsed; } | |
62 | void SetCollapsed(bool c) { m_bCollapsed = c; } | |
63 | ||
64 | ||
65 | // default copy ctor, assignment operator and dtor are ok | |
66 | virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); } | |
67 | ||
68 | private: | |
69 | bool m_bCollapsed; | |
70 | ||
71 | DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent) | |
72 | }; | |
73 | ||
74 | // ---------------------------------------------------------------------------- | |
75 | // event types and macros | |
76 | // ---------------------------------------------------------------------------- | |
77 | ||
78 | typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&); | |
79 | ||
80 | #define wxCollapsiblePaneEventHandler(func) \ | |
81 | (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func) | |
82 | ||
83 | #define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \ | |
84 | wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventFunction(fn)) | |
85 | ||
86 | ||
87 | #if defined(__WXGTK24__) | |
88 | #include "wx/gtk/collpane.h" | |
89 | #else | |
90 | #include "wx/generic/collpaneg.h" | |
91 | #define wxCollapsiblePane wxGenericCollapsiblePane | |
92 | #endif | |
93 | ||
94 | #endif | |
95 | // _WX_COLLAPSABLE_PANE_H_BASE_ |