File: xh_sizer.h

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (106 lines) | stat: -rw-r--r-- 3,117 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/////////////////////////////////////////////////////////////////////////////
// Name:        xrc/xh_sizer.h
// Purpose:     XML resource handler for wxSizer
// Author:      Kinaou Hervé
// Created:     2010-10-24
// Copyright:   (c) 2010 wxWidgets development team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxSizerXmlHandler

    @class wxXmlResourceHandler

    wxSizerXmlHandler is a class for resource handlers capable of creating
    a wxSizer object from an XML node.

    @see wxXmlResourceHandler, wxSizer

    @library{wxxrc}
    @category{xrc}
*/
class wxSizerXmlHandler : public wxXmlResourceHandler
{
public:
    /**
        Constructor.
        Initializes the attributes and adds the supported styles.
    */
    wxSizerXmlHandler();

    /**
        Creates a sizer, sizeritem or spacer object, depending on
        the current handled node.
        @see wxXmlResourceHandler::DoCreateResource().
    */
    virtual wxObject *DoCreateResource();

    /**
        Returns @true if the given node can be handled by this class.
        If the node concerns a sizer object, the method IsSizerNode is called
        to know if the class is managed or not.
        If the node concerns a sizer item or a spacer, @true is returned.
        Otherwise @false is returned.
        @see wxXmlResourceHandler::CanHandle().
    */
    virtual bool CanHandle(wxXmlNode *node);

protected:
    /**
        Creates an object of type wxSizer from the XML node content.

        This virtual method can be overridden to add support for custom sizer
        classes to the derived handler.

        Notice that if you override this method you would typically overload
        IsSizerNode() as well.

        Example of use of this method:
        @code
        class MySizerXmlHandler : public wxSizerXmlHandler
        {
            ...

        protected:
            bool IsSizerNode(wxXmlNode *node) const
            {
                return IsOfClass(node, "MySizer") ||
                        wxSizerXmlHandler::IsSizerNode(node));
            }

            void DoCreateSizer(const wxString& name)
            {
                if ( name == "MySizer" )
                    return Handle_MySizer();
                else
                    return wxSizerXmlHandler::DoCreateSizer(name);
            }

        private:
            wxSizer* Handle_MySizer()
            {
                // Create your own sizer here from XRC content (see
                // wxXmlResource methods) and return the instance.
            }
        };
        @endcode

        @since 2.9.2
    */
    virtual wxSizer* DoCreateSizer(const wxString& name);

    /**
        Used by CanHandle() to know if the given node contains a sizer
        supported by this class.

        This method should be overridden to allow this handler to be used for
        the custom sizer types.

        See the example in DoCreateSizer() description for how it can be used.

        @since 2.9.2
    */
    virtual bool IsSizerNode(wxXmlNode *node) const;

};