]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/containr.h
a46f3235f6eca4d6fc1691538255a4ddc853536a
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation of wxNavigationEnabled<>
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 A helper class implementing TAB navigation among the window children.
14 This class contains the functionality needed to correctly implement TAB
15 navigation among the children of the window. Its exact contents is not
16 important and is intentionally not documented as the only way to use this
17 class is to inherit from it instead of inheriting from the usual base class
18 directly. For example, if some class needs to inherit from wxControl but
19 contains multiple sub-windows and needs to support keyboard navigation, it
20 is enough to declare it in the following way:
22 class MyControlWithSubChildren :
23 public wxNavigationEnabled<wxControl>
26 // Default constructor is implemented in the same way as always.
27 MyControlWithSubChildren() { }
29 // Non-default constructor can't use wxControl ctor any more as
30 // wxControl is not its direct base class, but it can use Create().
31 MyControlWithSubChildren(wxWindow *parent, wxWindowID winid)
33 wxControl::Create(parent, winid);
35 // More creation code...
38 // Everything else as usual ...
47 class wxNavigationEnabled
: public W
50 /// The name of the real base window class that this class derives from.
51 typedef W BaseWindowClass
;
56 This class provides only the default constructor as it's not possible,
57 in general, to provide all the constructors of the real base class
60 This is however not usually a problem for wxWindow-derived classes as,
61 by convention, they always define a Create() method such that calling
62 it on an object initialized using the default constructor is equivalent
63 to using a non-default constructor directly. So the classes inheriting
64 from wxNavigationEnabled<W> should simply call W::Create() in their
67 wxNavigationEnabled();