]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/collpaneg.h
SetTextColour is gone
[wxWidgets.git] / include / wx / generic / collpaneg.h
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
15 #if wxUSE_BUTTON && wxUSE_STATLINE
16
17 // forward declared
18 class WXDLLEXPORT wxButton;
19 class WXDLLEXPORT wxStaticLine;
20
21 // class name
22 extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxGenericCollapsiblePaneNameStr[];
23
24
25 // ----------------------------------------------------------------------------
26 // wxGenericCollapsiblePane
27 // ----------------------------------------------------------------------------
28
29 class WXDLLIMPEXP_ADV wxGenericCollapsiblePane : public wxCollapsiblePaneBase
30 {
31 public:
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
65 // public wxCollapsiblePane API
66 virtual void Collapse(bool collapse = true);
67 virtual void SetLabel(const wxString &label);
68
69 virtual bool IsCollapsed() const
70 { return m_pPane==NULL || !m_pPane->IsShown(); }
71 virtual wxWindow *GetPane() const
72 { return m_pPane; }
73 virtual wxString GetLabel() const
74 { return m_strLabel; }
75
76
77 // implementation only, don't use
78 void OnStateChange(const wxSize& sizeNew);
79
80 protected:
81 // overridden methods
82 virtual wxSize DoGetBestSize() const;
83
84 // internal helpers
85 void LayoutChildren();
86
87 wxString GetBtnLabel() const;
88
89
90 // child controls
91 wxButton *m_pButton;
92 wxStaticLine *m_pStatLine;
93 wxWindow *m_pPane;
94
95 // the button label without ">>" or "<<"
96 wxString m_strLabel;
97
98 private:
99 // event handlers
100 void OnButton(wxCommandEvent &ev);
101 void OnSize(wxSizeEvent &ev);
102
103 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
104 DECLARE_EVENT_TABLE()
105 };
106
107 #endif // wxUSE_BUTTON && wxUSE_STATLINE
108
109
110 #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_