]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/collpaneg.h
optimize rendering code by calling GetClientSize(), GetTextExtent() and CalculateAbsW...
[wxWidgets.git] / include / wx / generic / collpaneg.h
CommitLineData
3c1f8cb1
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/collpaneg.h
3// Purpose: wxGenericCollapsiblePane
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_GENERIC_
13#define _WX_COLLAPSABLE_PANE_H_GENERIC_
14
3c1f8cb1 15// forward declared
b5dbe15d
VS
16class WXDLLIMPEXP_FWD_CORE wxButton;
17class WXDLLIMPEXP_FWD_CORE wxStaticLine;
5ea93bd3 18#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
162adae5
SC
19class WXDLLIMPEXP_FWD_CORE wxDisclosureTriangle;
20#endif
3c1f8cb1 21
68b1c878
VZ
22#include "wx/containr.h"
23
3c1f8cb1
VZ
24// ----------------------------------------------------------------------------
25// wxGenericCollapsiblePane
26// ----------------------------------------------------------------------------
27
3c6fa826 28class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase
3c1f8cb1
VZ
29{
30public:
31 wxGenericCollapsiblePane() { Init(); }
32
33 wxGenericCollapsiblePane(wxWindow *parent,
34 wxWindowID winid,
35 const wxString& label,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
037c7b4c 38 long style = wxCP_DEFAULT_STYLE,
3c1f8cb1 39 const wxValidator& val = wxDefaultValidator,
037c7b4c 40 const wxString& name = wxCollapsiblePaneNameStr)
3c1f8cb1
VZ
41 {
42 Init();
43
44 Create(parent, winid, label, pos, size, style, val, name);
45 }
46
68b1c878 47 virtual ~wxGenericCollapsiblePane();
912c3932 48
3c1f8cb1
VZ
49 bool Create(wxWindow *parent,
50 wxWindowID winid,
51 const wxString& label,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
037c7b4c 54 long style = wxCP_DEFAULT_STYLE,
3c1f8cb1 55 const wxValidator& val = wxDefaultValidator,
037c7b4c 56 const wxString& name = wxCollapsiblePaneNameStr);
3c1f8cb1 57
2cbf7014
VZ
58 // public wxCollapsiblePane API
59 virtual void Collapse(bool collapse = true);
60 virtual void SetLabel(const wxString &label);
3c1f8cb1 61
2cbf7014 62 virtual bool IsCollapsed() const
3c1f8cb1 63 { return m_pPane==NULL || !m_pPane->IsShown(); }
2cbf7014 64 virtual wxWindow *GetPane() const
3c1f8cb1 65 { return m_pPane; }
2cbf7014 66 virtual wxString GetLabel() const
3c1f8cb1
VZ
67 { return m_strLabel; }
68
bc48a5d7 69 virtual bool Layout();
4223cec5 70
7737e2fd
FM
71
72 // for the generic collapsible pane only:
73 wxControl* GetControlWidget() const
6dbf7a37 74 { return (wxControl*)m_pButton; }
7737e2fd 75
4223cec5
VZ
76 // implementation only, don't use
77 void OnStateChange(const wxSize& sizeNew);
78
abbe3d37 79protected:
2cbf7014
VZ
80 // overridden methods
81 virtual wxSize DoGetBestSize() const;
3c1f8cb1
VZ
82
83 wxString GetBtnLabel() const;
912c3932 84 int GetBorder() const;
3c1f8cb1 85
2cbf7014 86 // child controls
5ea93bd3 87#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
47922888
RR
88 wxDisclosureTriangle *m_pButton;
89#else
3c1f8cb1 90 wxButton *m_pButton;
47922888 91#endif
912c3932 92 wxStaticLine *m_pStaticLine;
3c1f8cb1 93 wxWindow *m_pPane;
912c3932 94 wxSizer *m_sz;
3c1f8cb1
VZ
95
96 // the button label without ">>" or "<<"
97 wxString m_strLabel;
98
99private:
68b1c878
VZ
100 void Init();
101
2cbf7014
VZ
102 // event handlers
103 void OnButton(wxCommandEvent &ev);
104 void OnSize(wxSizeEvent &ev);
105
68b1c878 106 WX_DECLARE_CONTROL_CONTAINER();
3c1f8cb1
VZ
107 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
108 DECLARE_EVENT_TABLE()
109};
110
2cbf7014 111#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_