]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/collpaneg.h
Don't use wstring for MinGW versions that don't support it
[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;
51 m_pStatLine = NULL;
52 m_pPane = NULL;
53 }
54
55 bool Create(wxWindow *parent,
56 wxWindowID winid,
57 const wxString& label,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
61 const wxValidator& val = wxDefaultValidator,
62 const wxString& name = wxGenericCollapsiblePaneNameStr);
63
64
2cbf7014
VZ
65 // public wxCollapsiblePane API
66 virtual void Collapse(bool collapse = true);
67 virtual void SetLabel(const wxString &label);
3c1f8cb1 68
2cbf7014 69 virtual bool IsCollapsed() const
3c1f8cb1 70 { return m_pPane==NULL || !m_pPane->IsShown(); }
2cbf7014 71 virtual wxWindow *GetPane() const
3c1f8cb1 72 { return m_pPane; }
2cbf7014 73 virtual wxString GetLabel() const
3c1f8cb1
VZ
74 { return m_strLabel; }
75
4223cec5
VZ
76
77 // implementation only, don't use
78 void OnStateChange(const wxSize& sizeNew);
79
abbe3d37 80protected:
2cbf7014
VZ
81 // overridden methods
82 virtual wxSize DoGetBestSize() const;
3c1f8cb1 83
2cbf7014 84 // internal helpers
3c1f8cb1
VZ
85 void LayoutChildren();
86
87 wxString GetBtnLabel() const;
3c1f8cb1 88
3c1f8cb1 89
2cbf7014 90 // child controls
3c1f8cb1
VZ
91 wxButton *m_pButton;
92 wxStaticLine *m_pStatLine;
93 wxWindow *m_pPane;
94
95 // the button label without ">>" or "<<"
96 wxString m_strLabel;
97
98private:
2cbf7014
VZ
99 // event handlers
100 void OnButton(wxCommandEvent &ev);
101 void OnSize(wxSizeEvent &ev);
102
3c1f8cb1
VZ
103 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
104 DECLARE_EVENT_TABLE()
105};
106
687b91d2
VS
107#endif // wxUSE_BUTTON && wxUSE_STATLINE
108
3c1f8cb1 109
2cbf7014 110#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_