]> git.saurik.com Git - wxWidgets.git/blame - include/wx/collpane.h
added wxTo/FromString(wxColour) (part of patch 1753875)
[wxWidgets.git] / include / wx / collpane.h
CommitLineData
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
912c3932
VZ
15#include "wx/defs.h"
16
17
18#if wxUSE_COLLPANE
19
3c1f8cb1
VZ
20#include "wx/control.h"
21
22
23// ----------------------------------------------------------------------------
24// wxCollapsiblePaneBase: interface for wxCollapsiblePane
25// ----------------------------------------------------------------------------
26
037c7b4c 27#define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER)
912c3932 28#define wxCP_NO_TLW_RESIZE (0x0002)
3c1f8cb1 29
3c6fa826 30class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl
3c1f8cb1
VZ
31{
32public:
33 wxCollapsiblePaneBase() {}
34
3c1f8cb1 35 virtual void Collapse(bool collapse = true) = 0;
550d433e
VZ
36 void Expand() { Collapse(false); }
37
3c1f8cb1 38 virtual bool IsCollapsed() const = 0;
550d433e
VZ
39 bool IsExpanded() const { return !IsCollapsed(); }
40
3c1f8cb1
VZ
41 virtual wxWindow *GetPane() const = 0;
42
43 virtual wxString GetLabel() const = 0;
550d433e 44 virtual void SetLabel(const wxString& label) = 0;
3c1f8cb1
VZ
45};
46
47
48// ----------------------------------------------------------------------------
49// event types and macros
50// ----------------------------------------------------------------------------
51
52BEGIN_DECLARE_EVENT_TYPES()
3c6fa826 53 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLLPANE_CHANGED, 1102)
3c1f8cb1
VZ
54END_DECLARE_EVENT_TYPES()
55
3c6fa826 56class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent
3c1f8cb1
VZ
57{
58public:
59 wxCollapsiblePaneEvent() {}
60 wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed)
61 : wxCommandEvent(wxEVT_COMMAND_COLLPANE_CHANGED, id),
62 m_bCollapsed(collapsed)
63 {
64 SetEventObject(generator);
65 }
66
67 bool GetCollapsed() const { return m_bCollapsed; }
68 void SetCollapsed(bool c) { m_bCollapsed = c; }
69
70
71 // default copy ctor, assignment operator and dtor are ok
72 virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); }
73
74private:
75 bool m_bCollapsed;
76
77 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent)
78};
79
80// ----------------------------------------------------------------------------
81// event types and macros
82// ----------------------------------------------------------------------------
83
84typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&);
85
86#define wxCollapsiblePaneEventHandler(func) \
87 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCollapsiblePaneEventFunction, &func)
88
89#define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
912c3932 90 wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
3c1f8cb1
VZ
91
92
99d625fc 93#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
3c1f8cb1
VZ
94 #include "wx/gtk/collpane.h"
95#else
96 #include "wx/generic/collpaneg.h"
912c3932 97
d34ad9ea
VZ
98 // use #define and not a typedef to allow forward declaring the class
99 #define wxCollapsiblePane wxGenericCollapsiblePane
3c1f8cb1
VZ
100#endif
101
d34ad9ea 102#endif // wxUSE_COLLPANE
912c3932 103
d34ad9ea 104#endif // _WX_COLLAPSABLE_PANE_H_BASE_