]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/collpaneg.h
Robert Lang's patch [ 1583183 ] Fixes printing/print preview inconsistencies
[wxWidgets.git] / include / wx / generic / collpaneg.h
... / ...
CommitLineData
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
16class WXDLLEXPORT wxButton;
17class WXDLLEXPORT wxStaticLine;
18
19// class name
20extern WXDLLIMPEXP_DATA_ADV(const wxChar) wxGenericCollapsiblePaneNameStr[];
21
22
23// ----------------------------------------------------------------------------
24// wxGenericCollapsiblePane
25// ----------------------------------------------------------------------------
26
27class WXDLLIMPEXP_ADV wxGenericCollapsiblePane : public wxCollapsiblePaneBase
28{
29public:
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
63 // public wxCollapsiblePane API
64 virtual void Collapse(bool collapse = true);
65 virtual void SetLabel(const wxString &label);
66
67 virtual bool IsCollapsed() const
68 { return m_pPane==NULL || !m_pPane->IsShown(); }
69 virtual wxWindow *GetPane() const
70 { return m_pPane; }
71 virtual wxString GetLabel() const
72 { return m_strLabel; }
73
74
75 // implementation only, don't use
76 void OnStateChange(const wxSize& sizeNew);
77
78protected:
79 // overridden methods
80 virtual wxSize DoGetBestSize() const;
81
82 // internal helpers
83 void LayoutChildren();
84
85 wxString GetBtnLabel() const;
86
87
88 // child controls
89 wxButton *m_pButton;
90 wxStaticLine *m_pStatLine;
91 wxWindow *m_pPane;
92
93 // the button label without ">>" or "<<"
94 wxString m_strLabel;
95
96private:
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
106#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_