- @b Customising scrolling adaptation
- In addition to switching adaptation on and off globally and per dialog, you can choose how aggressively wxWidgets will
- search for standard buttons by setting wxDialog::SetLayoutAdaptationLevel. By default,
- all the steps described above will be performed but by setting the level to 1, for example, you can choose to only look for wxStdDialogButtonSizer.
- You can use wxDialog::AddMainButtonId to add identifiers for buttons that should also be
- treated as standard buttons for the non-scrolling area.
- You can derive your own class from #wxDialogLayoutAdapter or wxStandardDialogLayoutAdapter and call
- wxDialog::SetLayoutAdapter, deleting the old object that this function returns. Override
- the functions CanDoLayoutAdaptation and DoLayoutAdaptation to test for adaptation applicability and perform the adaptation.
- You can also override wxDialog::CanDoLayoutAdaptation and wxDialog::DoLayoutAdaptation in a class derived from wxDialog.
- @b Situations where automatic scrolling adaptation may fail
- Because adaptation rearranges your sizer and window hierarchy, it is not fool-proof, and may fail in the following situations.
-
-
- The dialog doesn't use sizers.
- The dialog implementation makes assumptions about the window hierarchy, for example getting the parent of a control and casting to the dialog class.
- The dialog does custom painting and/or event handling not handled by the scrolled window. If this problem can be solved globally,
- you can derive a new adapter class from wxStandardDialogLayoutAdapter and override its CreateScrolledWindow function to return an instance of your own class.
- The dialog has unusual layout, for example a vertical sizer containing a mixture of standard buttons and other controls.
- The dialog makes assumptions about the sizer hierarchy, for example to show or hide children of the top-level sizer. However, the original sizer hierarchy will still hold
- until Show or ShowModal is called.
-
-
- You can help make sure that your dialogs will continue to function after adaptation by:
-
-
- avoiding the above situations and assumptions;
- using #wxStdDialogButtonSizer;
- only making assumptions about hierarchy immediately after the dialog is created;
- using an intermediate sizer under the main sizer, a @false top-level sizer that can be relied on to exist
- for the purposes of manipulating child sizers and windows;
- overriding wxDialog::GetContentWindow to return a book control if your dialog implements pages: wxWidgets will then only make the pages
- scrollable.
-
-
- @b wxPropertySheetDialog and wxWizard
- Adaptation for wxPropertySheetDialog is always done by simply making the pages scrollable, since wxDialog::GetContentWindow returns
- the dialog's book control and this is handled by the standard layout adapter.
- wxWizard uses its own CanDoLayoutAdaptation and DoLayoutAdaptation functions rather than the global adapter: again, only the wizard pages are made scrollable.
-
- */