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