Code::Blocks  SVN r11506
scrollingdialog.h
Go to the documentation of this file.
1 // Name: scrollingdialog.h
3 // Purpose: wxScrollingDialog
4 // Author: Julian Smart
5 // Modified by: Jens Lody
6 // Created: 2007-12-11
7 // RCS-ID: $Id: scrollingdialog.h 11399 2018-05-08 21:54:03Z fuscated $
8 // Copyright: (c) Julian Smart
9 // Licence:
11 
12 #ifndef _WX_SCROLLINGDIALOG_H_
13 #define _WX_SCROLLINGDIALOG_H_
14 
15 #include "wx/dialog.h"
16 #include "wx/propdlg.h"
17 #include "settings.h" // DLLIMPORT
18 
26 class wxScrollingDialog;
27 class wxDialogHelper;
28 
29 class wxBoxSizer;
30 class wxButton;
31 class wxScrolledWindow;
32 
33 #if !wxCHECK_VERSION(3, 0, 0)
34 class wxDialogLayoutAdapter: public wxObject
35 {
36  DECLARE_CLASS(wxDialogLayoutAdapter)
37 public:
39 
41  virtual bool CanDoLayoutAdaptation(wxDialogHelper* dialog) = 0;
42 
44  virtual bool DoLayoutAdaptation(wxDialogHelper* dialog) = 0;
45 };
46 
52 class wxStandardDialogLayoutAdapter: public wxDialogLayoutAdapter
53 {
54  DECLARE_CLASS(wxStandardDialogLayoutAdapter)
55 public:
56  wxStandardDialogLayoutAdapter() {}
57 
58 // Overrides
59 
61  bool CanDoLayoutAdaptation(wxDialogHelper* dialog) override;
62 
64  bool DoLayoutAdaptation(wxDialogHelper* dialog) override;
65 
66 // Implementation
67 
69  virtual wxSizer* FindButtonSizer(bool stdButtonSizer, wxDialogHelper* dialog, wxSizer* sizer, int& retBorder, int accumlatedBorder = 0);
70 
72  virtual bool IsOrdinaryButtonSizer(wxDialogHelper* dialog, wxBoxSizer* sizer);
73 
75  virtual bool IsStandardButton(wxDialogHelper* dialog, wxButton* button);
76 
78  virtual bool FindLooseButtons(wxDialogHelper* dialog, wxStdDialogButtonSizer* buttonSizer, wxSizer* sizer, int& count);
79 
81  virtual void ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL);
82 
85  virtual bool FitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow);
86  virtual bool FitWithScrolling(wxDialog* dialog, wxWindowList& windows);
87 
89  virtual int MustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize);
90 };
91 
97 class wxDialogHelper
98 {
99 public:
100 
101  wxDialogHelper(wxDialog* dialog = NULL) { Init(); m_dialog = dialog; }
102  virtual ~wxDialogHelper() {}
103 
104  void Init();
105 
106  void SetDialog(wxDialog* dialog) { m_dialog = dialog; }
107  wxDialog* GetDialog() const { return m_dialog; }
108 
110  virtual bool DoLayoutAdaptation();
111 
113  virtual bool CanDoLayoutAdaptation();
114 
116  virtual wxWindow* GetContentWindow() const { return NULL; }
117 
119  void AddButtonId(wxWindowID id) { m_buttonIds.Add((int) id); }
120  wxArrayInt& GetButtonIds() { return m_buttonIds; }
121 
123  bool IsUserButtonId(wxWindowID id) { return (m_buttonIds.Index((int) id) != wxNOT_FOUND); }
124 
125 // ACCESSORS
126 
131  void SetLayoutAdaptationLevel(int level) { m_layoutAdaptationLevel = level; }
132 
134  int GetLayoutAdaptationLevel() const { return m_layoutAdaptationLevel; }
135 
137  void SetLayoutAdaptationDone(bool adaptationDone) { m_layoutLayoutAdaptationDone = adaptationDone; }
138  bool GetLayoutAdaptationDone() const { return m_layoutLayoutAdaptationDone; }
139 
141  static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter);
142  static wxDialogLayoutAdapter* GetLayoutAdapter() { return sm_layoutAdapter; }
143 
145  static bool GetLayoutAdaptation() { return sm_layoutAdaptation; }
146  static void SetLayoutAdaptation(bool enable) { sm_layoutAdaptation = enable; }
147 
148 protected:
149 
150  wxDialog* m_dialog;
151  bool m_layoutLayoutAdaptationDone;
152  wxArrayInt m_buttonIds;
153  int m_layoutAdaptationLevel;
154  static wxDialogLayoutAdapter* sm_layoutAdapter;
155  static bool sm_layoutAdaptation;
156 };
157 #endif //#if !wxCHECK_VERSION(3, 0, 0)
158 
164 #if !wxCHECK_VERSION(3, 0, 0)
165  , public wxDialogHelper
166 #endif
167 {
168  DECLARE_CLASS(wxScrollingDialog)
169 public:
170 
172  {
173 #if !wxCHECK_VERSION(3, 0, 0)
174  Init();
175 #else
176  SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
177 #endif
178  }
180  int id = wxID_ANY,
181  const wxString& title = wxEmptyString,
182  const wxPoint& pos = wxDefaultPosition,
183  const wxSize& size = wxDefaultSize,
184  long style = wxDEFAULT_DIALOG_STYLE,
185  const wxString& name = _("dialogBox"))
186  {
187 #if !wxCHECK_VERSION(3, 0, 0)
188  Init();
189 #else
190  SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
191 #endif
192  Create(parent, id, title, pos, size, style, name);
193  }
194 #if !wxCHECK_VERSION(3, 0, 0)
195  bool Create(wxWindow *parent,
196  int id = wxID_ANY,
197  const wxString& title = wxEmptyString,
198  const wxPoint& pos = wxDefaultPosition,
199  const wxSize& size = wxDefaultSize,
200  long style = wxDEFAULT_DIALOG_STYLE,
201  const wxString& name = _("dialogBox"));
202 
203  void Init();
204 
206  bool Show(bool show = true) override;
207 
209  int ShowModal() override;
210 #endif
211 };
212 
218 #if !wxCHECK_VERSION(3, 0, 0)
219  , public wxDialogHelper
220 #endif
221 
222 {
223 public:
225  {
226 #if !wxCHECK_VERSION(3, 0, 0)
227  Init();
228 #else
229  SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
230 #endif
231  }
232 
234  const wxString& title,
235  const wxPoint& pos = wxDefaultPosition,
236  const wxSize& sz = wxDefaultSize,
237  long style = wxDEFAULT_DIALOG_STYLE,
238  const wxString& name = wxDialogNameStr)
239  {
240 #if !wxCHECK_VERSION(3, 0, 0)
241  Init();
242 #else
243  SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
244 #endif
245  Create(parent, id, title, pos, sz, style, name);
246  }
247 
248 #if !wxCHECK_VERSION(3, 0, 0)
249 
252  wxWindow* GetContentWindow() const override;
253 
255 
257  bool Show(bool show = true) override;
258 
260  int ShowModal() override;
261 
262 private:
263  void Init();
264 #endif
265 
266 protected:
267 
268  DECLARE_DYNAMIC_CLASS(wxScrollingPropertySheetDialog)
269 };
270 
271 #endif
272  // _WX_SCROLLINGDIALOG_H_
273 
wxScrollingPropertySheetDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &sz=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=wxDialogNameStr)
virtual bool DoLayoutAdaptation(wxDialog *dialog)=0
#define wxNOT_FOUND
#define DLLIMPORT
Definition: settings.h:16
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
wxScrollingDialog(wxWindow *parent, int id=wxID_ANY, const wxString &title=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("dialogBox"))
#define wxDEFAULT_DIALOG_STYLE
virtual bool CanDoLayoutAdaptation(wxDialog *dialog)=0
wxString wxEmptyString
const wxString & _(const wxString &string)
wxArray< int > wxArrayInt
#define NULL
Definition: prefix.cpp:59
int wxWindowID