+/*!
+ * 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);
+
+#if wxUSE_BUTTON
+ // 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);
+#endif // wxUSE_BUTTON
+
+ // 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);
+};