wxRuby Documentation Home

# Wx::XmlResourceHandler

XmlResourceHandler 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

Object

## Methods

- XmlResourceHandler.new
- XmlResourceHandler#add_style
- XmlResourceHandler#add_window_styles
- XmlResourceHandler#can_handle
- XmlResourceHandler#create_children
- XmlResourceHandler#create_children_privately
- XmlResourceHandler#create_res_from_node
- XmlResourceHandler#create_resource
- XmlResourceHandler#do_create_resource
- XmlResourceHandler#get_bitmap
- XmlResourceHandler#get_bool
- XmlResourceHandler#get_colour
- XmlResourceHandler#get_cur_file_system
- XmlResourceHandler#get_dimension
- XmlResourceHandler#get_font
- XmlResourceHandler#get_id
- XmlResourceHandler#get_icon
- XmlResourceHandler#get_long
- XmlResourceHandler#get_name
- XmlResourceHandler#get_node_content
- XmlResourceHandler#get_param_node
- XmlResourceHandler#get_param_value
- XmlResourceHandler#get_position
- XmlResourceHandler#get_size
- XmlResourceHandler#get_style
- XmlResourceHandler#get_text
- XmlResourceHandler#has_param
- XmlResourceHandler#is_of_class
- XmlResourceHandler#set_parent_resource
- XmlResourceHandler#setup_window

### XmlResourceHandler.new

destructor()

Destructor.

### XmlResourceHandler#add_style

add_style(%(arg-type)String% name, Integer value)

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

### XmlResourceHandler#add_window_styles

add_window_styles()

Add styles common to all Window-derived classes.

### XmlResourceHandler#can_handle

Boolean can_handle(%(arg-type)XmlNode% node)

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

#### Note

You must not call any XmlResourceHandler methods except
is_of_class 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.

### XmlResourceHandler#create_children

create_children(%(arg-type)Object% parent, Boolean this_hnd_only = false)

Creates children.

### XmlResourceHandler#create_children_privately

create_children_privately(%(arg-type)Object% parent, XmlNode rootnode = nil)

Helper function.

### XmlResourceHandler#create_res_from_node

Object create_res_from_node(%(arg-type)XmlNode% node, Object parent, Object instance = nil)

Creates a resource from a node.

### XmlResourceHandler#create_resource

Object create_resource(%(arg-type)XmlNode% node, Object parent, Object 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.

### XmlResourceHandler#do_create_resource

Object do_create_resource()

Called from CreateResource after variables
were filled.

### XmlResourceHandler#get_bitmap

Bitmap get_bitmap(%(arg-type)String% param = T(“bitmap”), Size size = DEFAULT_SIZE)

Gets a bitmap.

### XmlResourceHandler#get_bool

Boolean get_bool(%(arg-type)String% param, Boolean defaultv = false)

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

### XmlResourceHandler#get_colour

Colour get_colour(%(arg-type)String% param)

Gets colour in HTML syntax (\#RRGGBB).

### XmlResourceHandler#get_cur_file_system

FileSystem get_cur_file_system()

Returns the current file system.

### XmlResourceHandler#get_dimension

Integer get_dimension(%(arg-type)String% param, Integer defaultv = 0)

Gets a dimension (may be in dialog units).

### XmlResourceHandler#get_font

Font get_font(%(arg-type)String% param = T(“font”))

Gets a font.

### XmlResourceHandler#get_id

Integer get_id()

Returns the XRCID.

### XmlResourceHandler#get_icon

Icon get_icon(%(arg-type)String% param = T(“icon”), Size size = DEFAULT_SIZE)

Returns an icon.

### XmlResourceHandler#get_long

Integer get_long(%(arg-type)String% param, Integer defaultv = 0)

Gets the integer value from the parameter.

### XmlResourceHandler#get_name

String get_name()

Returns the resource name.

### XmlResourceHandler#get_node_content

String get_node_content(%(arg-type)XmlNode% node)

Gets node content from XML_ENTITY_NODE.

### XmlResourceHandler#get_param_node

XmlNode get_param_node(%(arg-type)String% param)

Finds the node or returns NULL.

### XmlResourceHandler#get_param_value

String get_param_value(%(arg-type)String% param)

Finds the parameter value or returns the empty string.

### XmlResourceHandler#get_position

Point get_position(%(arg-type)String% param = T(“pos”))

Gets the position (may be in dialog units).

### XmlResourceHandler#get_size

Size get_size(%(arg-type)String% param = T(“size”))

Gets the size (may be in dialog units).

### XmlResourceHandler#get_style

Integer get_style(%(arg-type)String% param = T(“style”), Integer defaults = 0)

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

### XmlResourceHandler#get_text

String get_text(%(arg-type)String% param)

Gets text from param and does some conversions:

- replaces $$n, $$r, $$t by respective characters (according to C syntax)
- replaces \$ by & and \$\$ by \$ (needed for to &File
  translation because of XML syntax)
- calls GetTranslations (unless disabled in XmlResource)

### XmlResourceHandler#has_param

Boolean has_param(%(arg-type)String% param)

Check to see if a parameter exists.

### XmlResourceHandler#is_of_class

Boolean is_of_class(%(arg-type)XmlNode% node, String classname)

Convenience function. Returns true if the node has a property class equal to classname,
e.g.

### XmlResourceHandler#set_parent_resource

set_parent_resource(%(arg-type)XmlResource% res)

Sets the parent resource.

### XmlResourceHandler#setup_window

setup_window(%(arg-type)Window% wnd)

Sets common window options.

[This page automatically generated from the Textile source at 2023-06-09 00:45:30 +0000]