]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/containr.h
Applied #15226 with modifications: wxRichTextCtrl: Implement setting properties with...
[wxWidgets.git] / interface / wx / containr.h
CommitLineData
4d98817c
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/containr.h
3// Purpose: documentation of wxNavigationEnabled<>
4// Author: Vadim Zeitlin
5// Created: 2011-07-23
4d98817c
VZ
6// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10/**
11 A helper class implementing TAB navigation among the window children.
12
13 This class contains the functionality needed to correctly implement TAB
14 navigation among the children of the window. Its exact contents is not
15 important and is intentionally not documented as the only way to use this
16 class is to inherit from it instead of inheriting from the usual base class
17 directly. For example, if some class needs to inherit from wxControl but
18 contains multiple sub-windows and needs to support keyboard navigation, it
19 is enough to declare it in the following way:
20 @code
21 class MyControlWithSubChildren :
22 public wxNavigationEnabled<wxControl>
23 {
24 public:
25 // Default constructor is implemented in the same way as always.
26 MyControlWithSubChildren() { }
27
28 // Non-default constructor can't use wxControl ctor any more as
29 // wxControl is not its direct base class, but it can use Create().
30 MyControlWithSubChildren(wxWindow *parent, wxWindowID winid)
31 {
32 wxControl::Create(parent, winid);
33
34 // More creation code...
35 }
36
37 // Everything else as usual ...
38 };
39 @endcode
40
41 @library{wxcore}
42
43 @since 2.9.3
44 */
45template <class W>
46class wxNavigationEnabled : public W
47{
48public:
49 /// The name of the real base window class that this class derives from.
50 typedef W BaseWindowClass;
51
52 /**
53 Default constructor.
54
55 This class provides only the default constructor as it's not possible,
56 in general, to provide all the constructors of the real base class
57 BaseWindowClass.
58
59 This is however not usually a problem for wxWindow-derived classes as,
60 by convention, they always define a Create() method such that calling
61 it on an object initialized using the default constructor is equivalent
62 to using a non-default constructor directly. So the classes inheriting
63 from wxNavigationEnabled<W> should simply call W::Create() in their
64 constructors.
65 */
66 wxNavigationEnabled();
67};