]> git.saurik.com Git - wxWidgets.git/blame - include/wx/collpane.h
wxMessageBox off the main thread lost result code.
[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
3c1f8cb1
VZ
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
912c3932
VZ
14#include "wx/defs.h"
15
16
17#if wxUSE_COLLPANE
18
3c1f8cb1
VZ
19#include "wx/control.h"
20
ff654490 21// class name
23318a53 22extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsiblePaneNameStr[];
3c1f8cb1
VZ
23
24// ----------------------------------------------------------------------------
25// wxCollapsiblePaneBase: interface for wxCollapsiblePane
26// ----------------------------------------------------------------------------
27
037c7b4c 28#define wxCP_DEFAULT_STYLE (wxTAB_TRAVERSAL | wxNO_BORDER)
912c3932 29#define wxCP_NO_TLW_RESIZE (0x0002)
3c1f8cb1 30
3c6fa826 31class WXDLLIMPEXP_CORE wxCollapsiblePaneBase : public wxControl
3c1f8cb1
VZ
32{
33public:
34 wxCollapsiblePaneBase() {}
35
3c1f8cb1 36 virtual void Collapse(bool collapse = true) = 0;
550d433e
VZ
37 void Expand() { Collapse(false); }
38
3c1f8cb1 39 virtual bool IsCollapsed() const = 0;
550d433e
VZ
40 bool IsExpanded() const { return !IsCollapsed(); }
41
3c1f8cb1
VZ
42 virtual wxWindow *GetPane() const = 0;
43
44 virtual wxString GetLabel() const = 0;
550d433e 45 virtual void SetLabel(const wxString& label) = 0;
3c1f8cb1
VZ
46};
47
48
49// ----------------------------------------------------------------------------
50// event types and macros
51// ----------------------------------------------------------------------------
52
3c778901
VZ
53class WXDLLIMPEXP_FWD_CORE wxCollapsiblePaneEvent;
54
ce7fe42e 55wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEvent );
3c1f8cb1 56
3c6fa826 57class WXDLLIMPEXP_CORE wxCollapsiblePaneEvent : public wxCommandEvent
3c1f8cb1
VZ
58{
59public:
60 wxCollapsiblePaneEvent() {}
61 wxCollapsiblePaneEvent(wxObject *generator, int id, bool collapsed)
ce7fe42e 62 : wxCommandEvent(wxEVT_COLLAPSIBLEPANE_CHANGED, id),
3c1f8cb1
VZ
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
75private:
76 bool m_bCollapsed;
77
78 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent)
79};
80
81// ----------------------------------------------------------------------------
82// event types and macros
83// ----------------------------------------------------------------------------
84
85typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEvent&);
86
87#define wxCollapsiblePaneEventHandler(func) \
3c778901 88 wxEVENT_HANDLER_CAST(wxCollapsiblePaneEventFunction, func)
3c1f8cb1
VZ
89
90#define EVT_COLLAPSIBLEPANE_CHANGED(id, fn) \
ce7fe42e 91 wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
3c1f8cb1
VZ
92
93
ff654490 94#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
3c1f8cb1
VZ
95 #include "wx/gtk/collpane.h"
96#else
97 #include "wx/generic/collpaneg.h"
912c3932 98
d34ad9ea
VZ
99 // use #define and not a typedef to allow forward declaring the class
100 #define wxCollapsiblePane wxGenericCollapsiblePane
3c1f8cb1
VZ
101#endif
102
ce7fe42e
VZ
103// old wxEVT_COMMAND_* constant
104#define wxEVT_COMMAND_COLLPANE_CHANGED wxEVT_COLLAPSIBLEPANE_CHANGED
105
d34ad9ea 106#endif // wxUSE_COLLPANE
912c3932 107
d34ad9ea 108#endif // _WX_COLLAPSABLE_PANE_H_BASE_