]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/collpaneg.h
don't propagate wxChildFocusEvent outside of wxTLWs
[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 // forward declared
16 class WXDLLEXPORT wxButton;
17 class WXDLLEXPORT wxStaticLine;
18
19 // class name
20 extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[];
21
22 // ----------------------------------------------------------------------------
23 // wxGenericCollapsiblePane
24 // ----------------------------------------------------------------------------
25
26 class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase
27 {
28 public:
29 wxGenericCollapsiblePane() { Init(); }
30
31 wxGenericCollapsiblePane(wxWindow *parent,
32 wxWindowID winid,
33 const wxString& label,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 long style = wxCP_DEFAULT_STYLE,
37 const wxValidator& val = wxDefaultValidator,
38 const wxString& name = wxCollapsiblePaneNameStr)
39 {
40 Init();
41
42 Create(parent, winid, label, pos, size, style, val, name);
43 }
44
45 void Init()
46 {
47 m_pButton = NULL;
48 m_pPane = NULL;
49 m_pStaticLine = NULL;
50 m_sz = NULL;
51 }
52
53 ~wxGenericCollapsiblePane();
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 = wxCP_DEFAULT_STYLE,
61 const wxValidator& val = wxDefaultValidator,
62 const wxString& name = wxCollapsiblePaneNameStr);
63
64 // public wxCollapsiblePane API
65 virtual void Collapse(bool collapse = true);
66 virtual void SetLabel(const wxString &label);
67
68 virtual bool IsCollapsed() const
69 { return m_pPane==NULL || !m_pPane->IsShown(); }
70 virtual wxWindow *GetPane() const
71 { return m_pPane; }
72 virtual wxString GetLabel() const
73 { return m_strLabel; }
74
75 virtual bool Layout();
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 wxString GetBtnLabel() const;
85 int GetBorder() const;
86
87 // child controls
88 wxButton *m_pButton;
89 wxStaticLine *m_pStaticLine;
90 wxWindow *m_pPane;
91 wxSizer *m_sz;
92
93 // the button label without ">>" or "<<"
94 wxString m_strLabel;
95
96 private:
97 // event handlers
98 void OnButton(wxCommandEvent &ev);
99 void OnSize(wxSizeEvent &ev);
100
101 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
102 DECLARE_EVENT_TABLE()
103 };
104
105 #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_