File: containr.h

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (67 lines) | stat: -rw-r--r-- 2,543 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/containr.h
// Purpose:     documentation of wxNavigationEnabled<>
// Author:      Vadim Zeitlin
// Created:     2011-07-23
// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    A helper class implementing TAB navigation among the window children.

    This class contains the functionality needed to correctly implement TAB
    navigation among the children of the window. Its exact contents is not
    important and is intentionally not documented as the only way to use this
    class is to inherit from it instead of inheriting from the usual base class
    directly. For example, if some class needs to inherit from wxControl but
    contains multiple sub-windows and needs to support keyboard navigation, it
    is enough to declare it in the following way:
    @code
        class MyControlWithSubChildren :
            public wxNavigationEnabled<wxControl>
        {
        public:
            // Default constructor is implemented in the same way as always.
            MyControlWithSubChildren() { }

            // Non-default constructor can't use wxControl ctor any more as
            // wxControl is not its direct base class, but it can use Create().
            MyControlWithSubChildren(wxWindow *parent, wxWindowID winid)
            {
                wxControl::Create(parent, winid);

                // More creation code...
            }

            // Everything else as usual ...
        };
    @endcode

    @library{wxcore}

    @since 2.9.3
 */
template <class W>
class wxNavigationEnabled : public W
{
public:
    /// The name of the real base window class that this class derives from.
    typedef W BaseWindowClass;

    /**
        Default constructor.

        This class provides only the default constructor as it's not possible,
        in general, to provide all the constructors of the real base class
        BaseWindowClass.

        This is however not usually a problem for wxWindow-derived classes as,
        by convention, they always define a Create() method such that calling
        it on an object initialized using the default constructor is equivalent
        to using a non-default constructor directly. So the classes inheriting
        from wxNavigationEnabled<W> should simply call W::Create() in their
        constructors.
     */
    wxNavigationEnabled();
};