Use GetWidgets() in the widgets samples instead of GetWidget2().
Add a function which can be overridden to return an arbitrary number of widgets instead of having just GetWidget() and GetWidget2(): spin control page already uses 3 widgets (and defines GetWidget3() which is never called) and we could have even more in the future. Just use a generic solution which will always work. The practical consequence of this is that the "Enable/Disable" menu item now also enables and disables the wxSpinCtrlDouble in the spin page, see #12045. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64301 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -52,6 +52,7 @@ class WXDLLIMPEXP_FWD_CORE WidgetsBookCtrl;
|
||||
class WidgetsPageInfo;
|
||||
|
||||
#include "wx/panel.h"
|
||||
#include "wx/vector.h"
|
||||
|
||||
// INTRODUCING NEW PAGES DON'T FORGET TO ADD ENTRIES TO 'WidgetsCategories'
|
||||
enum
|
||||
@@ -83,6 +84,8 @@ enum
|
||||
ALL_CTRLS = 1 << ALL_PAGE
|
||||
};
|
||||
|
||||
typedef wxVector<wxControl *> Widgets;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WidgetsPage: a book page demonstrating some widget
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -103,8 +106,14 @@ public:
|
||||
// lazy creation of the content
|
||||
virtual void CreateContent() = 0;
|
||||
|
||||
// some pages show 2 controls, in this case override this one as well
|
||||
virtual wxControl *GetWidget2() const { return NULL; }
|
||||
// some pages show additional controls, in this case override this one to
|
||||
// return all of them (including the one returned by GetWidget())
|
||||
virtual Widgets GetWidgets() const
|
||||
{
|
||||
Widgets widgets;
|
||||
widgets.push_back(GetWidget());
|
||||
return widgets;
|
||||
}
|
||||
|
||||
// recreate the control shown by this page
|
||||
//
|
||||
|
Reference in New Issue
Block a user