+
+ // The identifier for the affirmative button (usually wxID_OK)
+ int m_affirmativeId;
+
+ // The identifier for cancel button (usually wxID_CANCEL)
+ int m_escapeId;
+
+ // Flags whether layout adaptation has been done for this dialog
+ bool m_layoutAdaptationDone;
+
+ // Extra button identifiers to be taken as 'main' button identifiers
+ // to be placed in the non-scrolling area
+ wxArrayInt m_mainButtonIds;
+
+ // Adaptation level
+ int m_layoutAdaptationLevel;
+
+ // Local override for global adaptation enabled status
+ wxDialogLayoutAdaptationMode m_layoutAdaptationMode;
+
+ // Global layout adapter
+ static wxDialogLayoutAdapter* sm_layoutAdapter;
+
+ // Global adaptation switch
+ static bool sm_layoutAdaptation;
+
+private:
+ // common part of all ctors
+ void Init();
+
+ // handle Esc key presses
+ void OnCharHook(wxKeyEvent& event);
+
+ // handle closing the dialog window
+ void OnCloseWindow(wxCloseEvent& event);
+
+ // handle the standard buttons
+ void OnButton(wxCommandEvent& event);
+
+ // update the background colour
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
+
+
+ DECLARE_NO_COPY_CLASS(wxDialogBase)
+ DECLARE_EVENT_TABLE()
+};
+
+/*!
+ * Base class for layout adapters - code that, for example, turns a dialog into a
+ * scrolling dialog if there isn't enough screen space. You can derive further
+ * adapter classes to do any other kind of adaptation, such as applying a watermark, or adding
+ * a help mechanism.
+ */
+
+class WXDLLIMPEXP_CORE wxDialogLayoutAdapter: public wxObject
+{
+ DECLARE_CLASS(wxDialogLayoutAdapter)
+public:
+ wxDialogLayoutAdapter() {}
+
+ // Override this function to indicate that adaptation should be done
+ virtual bool CanDoLayoutAdaptation(wxDialog* dialog) = 0;
+
+ // Override this function to do the adaptation
+ virtual bool DoLayoutAdaptation(wxDialog* dialog) = 0;
+};
+
+/*!
+ * Standard adapter. Does scrolling adaptation for paged and regular dialogs.
+ *
+ */
+
+class WXDLLIMPEXP_CORE wxStandardDialogLayoutAdapter: public wxDialogLayoutAdapter
+{
+ DECLARE_CLASS(wxStandardDialogLayoutAdapter)
+public:
+ wxStandardDialogLayoutAdapter() {}
+
+// Overrides
+
+ // Indicate that adaptation should be done
+ virtual bool CanDoLayoutAdaptation(wxDialog* dialog);
+
+ // Do layout adaptation
+ virtual bool DoLayoutAdaptation(wxDialog* dialog);
+
+// Implementation
+
+ // Create the scrolled window
+ virtual wxScrolledWindow* CreateScrolledWindow(wxWindow* parent);
+
+ // Find a standard or horizontal box sizer
+ virtual wxSizer* FindButtonSizer(bool stdButtonSizer, wxDialog* dialog, wxSizer* sizer, int& retBorder, int accumlatedBorder = 0);
+
+ // Check if this sizer contains standard buttons, and so can be repositioned in the dialog
+ virtual bool IsOrdinaryButtonSizer(wxDialog* dialog, wxBoxSizer* sizer);
+
+ // Check if this is a standard button
+ virtual bool IsStandardButton(wxDialog* dialog, wxButton* button);
+
+ // Find 'loose' main buttons in the existing layout and add them to the standard dialog sizer
+ virtual bool FindLooseButtons(wxDialog* dialog, wxStdDialogButtonSizer* buttonSizer, wxSizer* sizer, int& count);
+
+ // Reparent the controls to the scrolled window, except those in buttonSizer
+ virtual void ReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL);
+ static void DoReparentControls(wxWindow* parent, wxWindow* reparentTo, wxSizer* buttonSizer = NULL);
+
+ // A function to fit the dialog around its contents, and then adjust for screen size.
+ // If scrolled windows are passed, scrolling is enabled in the required orientation(s).
+ virtual bool FitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow);
+ virtual bool FitWithScrolling(wxDialog* dialog, wxWindowList& windows);
+ static bool DoFitWithScrolling(wxDialog* dialog, wxScrolledWindow* scrolledWindow);
+ static bool DoFitWithScrolling(wxDialog* dialog, wxWindowList& windows);
+
+ // Find whether scrolling will be necessary for the dialog, returning wxVERTICAL, wxHORIZONTAL or both
+ virtual int MustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize);
+ static int DoMustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize);