# wxSizerXmlHandler Class Reference

`#include </home/work/projects/wx/2.9/wx/interface/wx/xrc/xh_sizer.h>`

Inheritance diagram for wxSizerXmlHandler:
[legend]

## Public Member Functions

| wxSizerXmlHandler ()
| Constructor.
virtual wxObject * | DoCreateResource ()
| Creates a sizer, sizeritem or spacer object, depending on the current handled node.
virtual bool | CanHandle (wxXmlNode *node)
| Returns true if the given node can be handled by this class.

## Protected Member Functions

virtual wxSizer * | DoCreateSizer (const wxString &name)
| Creates an object of type wxSizer from the XML node content.
virtual bool | IsSizerNode (wxXmlNode *node) const
| Used by CanHandle() to know if the given node contains a sizer supported by this class.

List of all members.

## Constructor & Destructor Documentation

wxSizerXmlHandler::wxSizerXmlHandler | ( |  | ) |

Constructor.

Initializes the attributes and adds the supported styles.

## Member Function Documentation

virtual bool wxSizerXmlHandler::CanHandle | ( | wxXmlNode * | node | ) | `[virtual]`

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 also:
  wxXmlResourceHandler::CanHandle().

Implements wxXmlResourceHandler.

virtual wxObject* wxSizerXmlHandler::DoCreateResource | ( |  | ) | `[virtual]`

Creates a sizer, sizeritem or spacer object, depending on the current handled node.

See also:
  wxXmlResourceHandler::DoCreateResource().

Implements wxXmlResourceHandler.

virtual wxSizer* wxSizerXmlHandler::DoCreateSizer | ( | const wxString & | name | ) | `[protected, virtual]`

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:

            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.
                }
            };

Since:
  2.9.2

virtual bool wxSizerXmlHandler::IsSizerNode | ( | wxXmlNode * | node | ) | const`[protected, virtual]`

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

|  | [ top ]