]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/collpaneg.h
adding measuring contexts, streamlining printing code
[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
687b91d2
VS
15#if wxUSE_BUTTON && wxUSE_STATLINE
16
3c1f8cb1 17// forward declared
2cbf7014 18class WXDLLEXPORT wxButton;
3c1f8cb1
VZ
19class WXDLLEXPORT wxStaticLine;
20
21// class name
abbe3d37 22extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxGenericCollapsiblePaneNameStr[];
3c1f8cb1
VZ
23
24
3c1f8cb1
VZ
25// ----------------------------------------------------------------------------
26// wxGenericCollapsiblePane
27// ----------------------------------------------------------------------------
28
abbe3d37 29class WXDLLIMPEXP_ADV wxGenericCollapsiblePane : public wxCollapsiblePaneBase
3c1f8cb1
VZ
30{
31public:
32 wxGenericCollapsiblePane() { Init(); }
33
34 wxGenericCollapsiblePane(wxWindow *parent,
35 wxWindowID winid,
36 const wxString& label,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
40 const wxValidator& val = wxDefaultValidator,
41 const wxString& name = wxGenericCollapsiblePaneNameStr)
42 {
43 Init();
44
45 Create(parent, winid, label, pos, size, style, val, name);
46 }
47
48 void Init()
49 {
50 m_pButton = NULL;
3c1f8cb1 51 m_pPane = NULL;
912c3932
VZ
52 m_pStaticLine = NULL;
53 m_sz = NULL;
3c1f8cb1
VZ
54 }
55
912c3932
VZ
56 ~wxGenericCollapsiblePane();
57
3c1f8cb1
VZ
58 bool Create(wxWindow *parent,
59 wxWindowID winid,
60 const wxString& label,
61 const wxPoint& pos = wxDefaultPosition,
62 const wxSize& size = wxDefaultSize,
63 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
64 const wxValidator& val = wxDefaultValidator,
65 const wxString& name = wxGenericCollapsiblePaneNameStr);
66
67
2cbf7014
VZ
68 // public wxCollapsiblePane API
69 virtual void Collapse(bool collapse = true);
70 virtual void SetLabel(const wxString &label);
3c1f8cb1 71
2cbf7014 72 virtual bool IsCollapsed() const
3c1f8cb1 73 { return m_pPane==NULL || !m_pPane->IsShown(); }
2cbf7014 74 virtual wxWindow *GetPane() const
3c1f8cb1 75 { return m_pPane; }
2cbf7014 76 virtual wxString GetLabel() const
3c1f8cb1
VZ
77 { return m_strLabel; }
78
4223cec5
VZ
79
80 // implementation only, don't use
81 void OnStateChange(const wxSize& sizeNew);
82
abbe3d37 83protected:
2cbf7014
VZ
84 // overridden methods
85 virtual wxSize DoGetBestSize() const;
912c3932 86 bool Layout();
3c1f8cb1
VZ
87
88 wxString GetBtnLabel() const;
912c3932 89 int GetBorder() const;
3c1f8cb1 90
2cbf7014 91 // child controls
3c1f8cb1 92 wxButton *m_pButton;
912c3932 93 wxStaticLine *m_pStaticLine;
3c1f8cb1 94 wxWindow *m_pPane;
912c3932 95 wxSizer *m_sz;
3c1f8cb1
VZ
96
97 // the button label without ">>" or "<<"
98 wxString m_strLabel;
99
100private:
2cbf7014
VZ
101 // event handlers
102 void OnButton(wxCommandEvent &ev);
103 void OnSize(wxSizeEvent &ev);
104
3c1f8cb1
VZ
105 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
106 DECLARE_EVENT_TABLE()
107};
108
687b91d2
VS
109#endif // wxUSE_BUTTON && wxUSE_STATLINE
110
3c1f8cb1 111
2cbf7014 112#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_