Version: 3.2.7
wxSizerXmlHandler Class Reference

#include <wx/xrc/xh_sizer.h>

+ Inheritance diagram for wxSizerXmlHandler:

Public Member Functions

 wxSizerXmlHandler ()
 Constructor. More...
 
virtual wxObjectDoCreateResource ()
 Creates a sizer, sizeritem or spacer object, depending on the current handled node. More...
 
virtual bool CanHandle (wxXmlNode *node)
 Returns true if the given node can be handled by this class. More...
 
- Public Member Functions inherited from wxXmlResourceHandler
 wxXmlResourceHandler ()
 Default constructor. More...
 
virtual ~wxXmlResourceHandler ()
 Destructor. More...
 
wxObjectCreateResource (wxXmlNode *node, wxObject *parent, wxObject *instance)
 Creates an object (menu, dialog, control, ...) from an XML node. More...
 
void SetParentResource (wxXmlResource *res)
 Sets the parent resource. More...
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data. More...
 
 wxObject (const wxObject &other)
 Copy ctor. More...
 
virtual ~wxObject ()
 Destructor. More...
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class. More...
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj. More...
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone. More...
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer. More...
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public. More...
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 
void * operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 

Protected Member Functions

virtual wxSizerDoCreateSizer (const wxString &name)
 Creates an object of type wxSizer from the XML node content. More...
 
virtual bool IsSizerNode (wxXmlNode *node) const
 Used by CanHandle() to know if the given node contains a sizer supported by this class. More...
 
- Protected Member Functions inherited from wxXmlResourceHandler
void AddStyle (const wxString &name, int value)
 Add a style flag (e.g. More...
 
void AddWindowStyles ()
 Add styles common to all wxWindow-derived classes. More...
 
void CreateChildren (wxObject *parent, bool this_hnd_only=false)
 Creates children. More...
 
void CreateChildrenPrivately (wxObject *parent, wxXmlNode *rootnode=NULL)
 Helper function. More...
 
wxObjectCreateResFromNode (wxXmlNode *node, wxObject *parent, wxObject *instance=NULL)
 Creates a resource from a node. More...
 
wxAnimationGetAnimation (const wxString &param="animation", wxAnimationCtrlBase *ctrl=NULL)
 Creates an animation (see wxAnimation) from the filename specified in param. More...
 
wxBitmap GetBitmap (const wxString &param="bitmap", const wxArtClient &defaultArtClient=wxART_OTHER, wxSize size=wxDefaultSize)
 Gets a bitmap. More...
 
wxBitmap GetBitmap (const wxXmlNode *node, const wxArtClient &defaultArtClient=wxART_OTHER, wxSize size=wxDefaultSize)
 Gets a bitmap from an XmlNode. More...
 
wxBitmapBundle GetBitmapBundle (const wxString &param="bitmap", const wxArtClient &defaultArtClient=wxART_OTHER, wxSize size=wxDefaultSize)
 Gets a bitmap bundle. More...
 
wxBitmapBundle GetBitmapBundle (const wxXmlNode *node, const wxArtClient &defaultArtClient=wxART_OTHER, wxSize size=wxDefaultSize)
 Gets a bitmap bundle from the provided node. More...
 
bool GetBool (const wxString &param, bool defaultv=false)
 Gets a bool flag (1, t, yes, on, true are true, everything else is false). More...
 
wxColour GetColour (const wxString &param, const wxColour &defaultColour=wxNullColour)
 Gets colour in HTML syntax (#RRGGBB). More...
 
wxFileSystemGetCurFileSystem ()
 Returns the current file system. More...
 
wxCoord GetDimension (const wxString &param, wxCoord defaultv=0, wxWindow *windowToUse=0)
 Gets a dimension (may be in dialog units). More...
 
wxDirection GetDirection (const wxString &param, wxDirection dirDefault=wxLEFT)
 Gets a direction. More...
 
wxFont GetFont (const wxString &param="font")
 Gets a font. More...
 
int GetID ()
 Returns the XRCID. More...
 
wxIcon GetIcon (const wxString &param="icon", const wxArtClient &defaultArtClient=wxART_OTHER, wxSize size=wxDefaultSize)
 Returns an icon. More...
 
wxIcon GetIcon (const wxXmlNode *node, const wxArtClient &defaultArtClient=wxART_OTHER, wxSize size=wxDefaultSize)
 Gets an icon from an XmlNode. More...
 
wxIconBundle GetIconBundle (const wxString &param, const wxArtClient &defaultArtClient=wxART_OTHER)
 Returns an icon bundle. More...
 
wxImageListGetImageList (const wxString &param="imagelist")
 Creates an image list from the param markup data. More...
 
long GetLong (const wxString &param, long defaultv=0)
 Gets the integer value from the parameter. More...
 
float GetFloat (const wxString &param, float defaultv=0)
 Gets a float value from the parameter. More...
 
wxString GetName ()
 Returns the resource name. More...
 
bool IsObjectNode (const wxXmlNode *node) const
 Checks if the given node is an object node. More...
 
wxString GetNodeContent (wxXmlNode *node)
 Gets node content from wxXML_ENTITY_NODE. More...
 
wxXmlNodeGetNodeParent (const wxXmlNode *node) const
 Gets the parent of the node given. More...
 
wxXmlNodeGetNodeNext (const wxXmlNode *node) const
 Gets the next sibling node related to the given node, possibly NULL. More...
 
wxXmlNodeGetNodeChildren (const wxXmlNode *node) const
 Gets the first child of the given node or NULL. More...
 
wxXmlNodeGetParamNode (const wxString &param)
 Finds the node or returns NULL. More...
 
wxString GetParamValue (const wxString &param)
 Finds the parameter value or returns the empty string. More...
 
wxString GetParamValue (const wxXmlNode *node)
 Returns the node parameter value. More...
 
wxPoint GetPosition (const wxString &param="pos")
 Gets the position (may be in dialog units). More...
 
wxSize GetSize (const wxString &param="size", wxWindow *windowToUse=0)
 Gets the size (may be in dialog units). More...
 
int GetStyle (const wxString &param="style", int defaults=0)
 Gets style flags from text in form "flag | flag2| flag3 |..." Only understands flags added with AddStyle(). More...
 
wxString GetText (const wxString &param, bool translate=true)
 Gets text from param and does some conversions: More...
 
wxString GetFilePath (const wxXmlNode *node)
 Gets a file path from the given node. More...
 
bool HasParam (const wxString &param)
 Check to see if a parameter exists. More...
 
bool IsOfClass (wxXmlNode *node, const wxString &classname)
 Convenience function. More...
 
void SetupWindow (wxWindow *wnd)
 Sets common window options. More...
 
void ReportError (wxXmlNode *context, const wxString &message)
 Reports error in XRC resources to the user. More...
 
void ReportError (const wxString &message)
 Like ReportError(wxXmlNode*, const wxString&), but uses the node of currently processed object (m_node) as the context. More...
 
void ReportParamError (const wxString &param, const wxString &message)
 Like ReportError(wxXmlNode*, const wxString&), but uses the node of parameter param of the currently processed object as the context. More...
 
wxXmlResourceGetResource () const
 After CreateResource has been called this will return the current wxXmlResource object. More...
 
wxXmlNodeGetNode () const
 After CreateResource has been called this will return the XML node being processed. More...
 
wxString GetClass () const
 After CreateResource has been called this will return the class name of the XML resource node being processed. More...
 
wxObjectGetParent () const
 After CreateResource has been called this will return the current item's parent, if any. More...
 
wxObjectGetInstance () const
 After CreateResource has been called this will return the instance that the XML resource content should be created upon, if it has already been created. More...
 
wxWindowGetParentAsWindow () const
 After CreateResource has been called this will return the item's parent as a wxWindow. More...
 
- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object. More...
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
 

Additional Inherited Members

- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Constructor & Destructor Documentation

◆ wxSizerXmlHandler()

wxSizerXmlHandler::wxSizerXmlHandler ( )

Constructor.

Initializes the attributes and adds the supported styles.

Member Function Documentation

◆ CanHandle()

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.

◆ DoCreateResource()

virtual wxObject* wxSizerXmlHandler::DoCreateResource ( )
virtual

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

See also
wxXmlResourceHandler::DoCreateResource().

Implements wxXmlResourceHandler.

◆ DoCreateSizer()

virtual wxSizer* wxSizerXmlHandler::DoCreateSizer ( const wxString name)
protectedvirtual

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") ||
}
void DoCreateSizer(const wxString& name)
{
if ( name == "MySizer" )
return Handle_MySizer();
else
}
private:
wxSizer* Handle_MySizer()
{
// Create your own sizer here from XRC content (see
// wxXmlResource methods) and return the instance.
}
};
wxSizer is the abstract base class used for laying out subwindows in a window.
Definition: sizer.h:121
Definition: xh_sizer.h:24
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.
String class for passing textual data to or receiving it from wxWidgets.
Definition: string.h:315
Represents a node in an XML document.
Definition: xml.h:74
bool IsOfClass(wxXmlNode *node, const wxString &classname)
Convenience function.
Since
2.9.2

◆ IsSizerNode()

virtual bool wxSizerXmlHandler::IsSizerNode ( wxXmlNode node) const
protectedvirtual

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