]>
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 | ||
687b91d2 VS |
15 | #if wxUSE_BUTTON && wxUSE_STATLINE |
16 | ||
3c1f8cb1 | 17 | // forward declared |
2cbf7014 | 18 | class WXDLLEXPORT wxButton; |
3c1f8cb1 VZ |
19 | class WXDLLEXPORT wxStaticLine; |
20 | ||
21 | // class name | |
037c7b4c | 22 | extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[]; |
3c1f8cb1 | 23 | |
3c1f8cb1 VZ |
24 | // ---------------------------------------------------------------------------- |
25 | // wxGenericCollapsiblePane | |
26 | // ---------------------------------------------------------------------------- | |
27 | ||
3c6fa826 | 28 | class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase |
3c1f8cb1 VZ |
29 | { |
30 | public: | |
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 | ||
47 | void Init() | |
48 | { | |
49 | m_pButton = NULL; | |
3c1f8cb1 | 50 | m_pPane = NULL; |
912c3932 VZ |
51 | m_pStaticLine = NULL; |
52 | m_sz = NULL; | |
3c1f8cb1 VZ |
53 | } |
54 | ||
912c3932 VZ |
55 | ~wxGenericCollapsiblePane(); |
56 | ||
3c1f8cb1 VZ |
57 | bool Create(wxWindow *parent, |
58 | wxWindowID winid, | |
59 | const wxString& label, | |
60 | const wxPoint& pos = wxDefaultPosition, | |
61 | const wxSize& size = wxDefaultSize, | |
037c7b4c | 62 | long style = wxCP_DEFAULT_STYLE, |
3c1f8cb1 | 63 | const wxValidator& val = wxDefaultValidator, |
037c7b4c | 64 | const wxString& name = wxCollapsiblePaneNameStr); |
3c1f8cb1 | 65 | |
2cbf7014 VZ |
66 | // public wxCollapsiblePane API |
67 | virtual void Collapse(bool collapse = true); | |
68 | virtual void SetLabel(const wxString &label); | |
3c1f8cb1 | 69 | |
2cbf7014 | 70 | virtual bool IsCollapsed() const |
3c1f8cb1 | 71 | { return m_pPane==NULL || !m_pPane->IsShown(); } |
2cbf7014 | 72 | virtual wxWindow *GetPane() const |
3c1f8cb1 | 73 | { return m_pPane; } |
2cbf7014 | 74 | virtual wxString GetLabel() const |
3c1f8cb1 VZ |
75 | { return m_strLabel; } |
76 | ||
bc48a5d7 | 77 | virtual bool Layout(); |
4223cec5 VZ |
78 | |
79 | // implementation only, don't use | |
80 | void OnStateChange(const wxSize& sizeNew); | |
81 | ||
abbe3d37 | 82 | protected: |
2cbf7014 VZ |
83 | // overridden methods |
84 | virtual wxSize DoGetBestSize() const; | |
3c1f8cb1 VZ |
85 | |
86 | wxString GetBtnLabel() const; | |
912c3932 | 87 | int GetBorder() const; |
3c1f8cb1 | 88 | |
2cbf7014 | 89 | // child controls |
3c1f8cb1 | 90 | wxButton *m_pButton; |
912c3932 | 91 | wxStaticLine *m_pStaticLine; |
3c1f8cb1 | 92 | wxWindow *m_pPane; |
912c3932 | 93 | wxSizer *m_sz; |
3c1f8cb1 VZ |
94 | |
95 | // the button label without ">>" or "<<" | |
96 | wxString m_strLabel; | |
97 | ||
98 | private: | |
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 | 107 | #endif // wxUSE_BUTTON && wxUSE_STATLINE |
2cbf7014 | 108 | #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_ |