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