Contents Up Previous Next

wxXmlResourceHandler

wxXmlResourceHandler is an abstract base class for resource handlers capable of creating a control from an XML node.

See XML-based resource system overview for details.

Derived from

wxObject

Include files

<wx/xrc/xmlres.h>

Members

wxXmlResourceHandler::wxXmlResourceHandler
wxXmlResourceHandler::~wxXmlResourceHandler
wxXmlResourceHandler::AddStyle
wxXmlResourceHandler::AddWindowStyles
wxXmlResourceHandler::CanHandle
wxXmlResourceHandler::CreateChildren
wxXmlResourceHandler::CreateChildrenPrivately
wxXmlResourceHandler::CreateResFromNode
wxXmlResourceHandler::CreateResource
wxXmlResourceHandler::DoCreateResource
wxXmlResourceHandler::GetBitmap
wxXmlResourceHandler::GetBool
wxXmlResourceHandler::GetColour
wxXmlResourceHandler::GetCurFileSystem
wxXmlResourceHandler::GetDimension
wxXmlResourceHandler::GetFont
wxXmlResourceHandler::GetID
wxXmlResourceHandler::GetIcon
wxXmlResourceHandler::GetLong
wxXmlResourceHandler::GetName
wxXmlResourceHandler::GetNodeContent
wxXmlResourceHandler::GetParamNode
wxXmlResourceHandler::GetParamValue
wxXmlResourceHandler::GetPosition
wxXmlResourceHandler::GetSize
wxXmlResourceHandler::GetStyle
wxXmlResourceHandler::GetText
wxXmlResourceHandler::HasParam
wxXmlResourceHandler::IsOfClass
wxXmlResourceHandler::SetParentResource
wxXmlResourceHandler::SetupWindow


wxXmlResourceHandler::wxXmlResourceHandler

wxXmlResourceHandler()

Default constructor.


wxXmlResourceHandler::~wxXmlResourceHandler

~wxXmlResourceHandler()

Destructor.


wxXmlResourceHandler::AddStyle

void AddStyle(const wxString& name, int value)

Add a style flag (e.g. wxMB_DOCKABLE) to the list of flags understood by this handler.


wxXmlResourceHandler::AddWindowStyles

void AddWindowStyles()

Add styles common to all wxWindow-derived classes.


wxXmlResourceHandler::CanHandle

bool CanHandle(wxXmlNode* node)

Returns true if it understands this node and can create a resource from it, false otherwise.

Note

You must not call any wxXmlResourceHandler methods except IsOfClass from this method! The instance is not yet initialized with node data at the time CanHandle is called and it is only safe to operate on node directly or to call IsOfClass.


wxXmlResourceHandler::CreateChildren

void CreateChildren(wxObject* parent, bool this_hnd_only = false)

Creates children.


wxXmlResourceHandler::CreateChildrenPrivately

void CreateChildrenPrivately(wxObject* parent, wxXmlNode* rootnode = NULL)

Helper function.


wxXmlResourceHandler::CreateResFromNode

wxObject* CreateResFromNode(wxXmlNode* node, wxObject* parent, wxObject* instance = NULL)

Creates a resource from a node.


wxXmlResourceHandler::CreateResource

wxObject* CreateResource(wxXmlNode* node, wxObject* parent, wxObject* instance)

Creates an object (menu, dialog, control, ...) from an XML node. Should check for validity. parent is a higher-level object (usually window, dialog or panel) that is often necessary to create the resource. If instance is non-NULL it should not create a new instance via 'new' but should rather use this one, and call its Create method.


wxXmlResourceHandler::DoCreateResource

wxObject* DoCreateResource()

Called from CreateResource after variables were filled.


wxXmlResourceHandler::GetBitmap

wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), wxSize size = wxDefaultSize)

Gets a bitmap.


wxXmlResourceHandler::GetBool

bool GetBool(const wxString& param, bool defaultv = false)

Gets a bool flag (1, t, yes, on, true are true, everything else is false).


wxXmlResourceHandler::GetColour

wxColour GetColour(const wxString& param)

Gets colour in HTML syntax (#RRGGBB).


wxXmlResourceHandler::GetCurFileSystem

wxFileSystem& GetCurFileSystem()

Returns the current file system.


wxXmlResourceHandler::GetDimension

wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0)

Gets a dimension (may be in dialog units).


wxXmlResourceHandler::GetFont

wxFont GetFont(const wxString& param = wxT("font"))

Gets a font.


wxXmlResourceHandler::GetID

int GetID()

Returns the XRCID.


wxXmlResourceHandler::GetIcon

wxIcon GetIcon(const wxString& param = wxT("icon"), wxSize size = wxDefaultSize)

Returns an icon.


wxXmlResourceHandler::GetLong

long GetLong(const wxString& param, long defaultv = 0)

Gets the integer value from the parameter.


wxXmlResourceHandler::GetName

wxString GetName()

Returns the resource name.


wxXmlResourceHandler::GetNodeContent

wxString GetNodeContent(wxXmlNode* node)

Gets node content from wxXML_ENTITY_NODE.


wxXmlResourceHandler::GetParamNode

wxXmlNode* GetParamNode(const wxString& param)

Finds the node or returns NULL.


wxXmlResourceHandler::GetParamValue

wxString GetParamValue(const wxString& param)

Finds the parameter value or returns the empty string.


wxXmlResourceHandler::GetPosition

wxPoint GetPosition(const wxString& param = wxT("pos"))

Gets the position (may be in dialog units).


wxXmlResourceHandler::GetSize

wxSize GetSize(const wxString& param = wxT("size"))

Gets the size (may be in dialog units).


wxXmlResourceHandler::GetStyle

int GetStyle(const wxString& param = wxT("style"), int defaults = 0)

Gets style flags from text in form "flag | flag2| flag3 |..." Only understands flags added with AddStyle.


wxXmlResourceHandler::GetText

wxString GetText(const wxString& param)

Gets text from param and does some conversions:


wxXmlResourceHandler::HasParam

bool HasParam(const wxString& param)

Check to see if a parameter exists.


wxXmlResourceHandler::IsOfClass

bool IsOfClass(wxXmlNode* node, const wxString& classname)

Convenience function. Returns true if the node has a property class equal to classname, e.g. <object class="wxDialog">.


wxXmlResourceHandler::SetParentResource

void SetParentResource(wxXmlResource* res)

Sets the parent resource.


wxXmlResourceHandler::SetupWindow

void SetupWindow(wxWindow* wnd)

Sets common window options.