wxRuby Documentation Home

Wx::XmlResource

This is the main class for interacting with the XML-based resource system.

The class holds XML resources from one or more .xml files, binary files or zip archive files.

See XML-based resource system overview for details.

Derived from

Object

Constants

Wx::XRC_USE_LOCALE     = 1
Wx::XRC_NO_SUBCLASSING = 2
Wx::XRC_NO_RELOADING   = 4

Methods

XmlResource.new

XmlResource.new(String filemask, Integer flags = XRC_USE_LOCALE)

Constructor.

The flags in Wx::XmlResource are not useful in ruby. All XmlResources created will have the optimal flags.

XmlResource#get

XmlResource XmlResource.get()

Class method to get the global XmlResource object.

XmlResource#set

XmlResource XmlResource.set(XmlResource res)

Class method to set the global resources object. Returns the pointer to the previous one, or nil if there was not one.

XmlResource#attach_unknown_control

Boolean attach_unknown_control(String name, Window control, 
                               Window parent = nil)

Attaches an unknown control to the given panel/window/dialog. Unknown controls are used in conjunction with <object class="unknown">.

XmlResource#compare_version

Integer compare_version(Integer major, Integer minor, 
                        Integer release, 
                        Integer revision)

Compares the XRC version to the argument. Returns -1 if the XRC version is less than the argument, +1 if greater, and 0 if they equal.

XmlResource#get_flags

Integer get_flags()

Returns flags, which may be a bitlist of XRC_USE_LOCALE and XRC_NO_SUBCLASSING.

XmlResource#get_version

Integer get_version()

Returns version information (a.b.c.d = d+ 256c + 256b + 256a).

XmlResource#get_xrcid

Integer *get_xrcid(Char str_id)

Returns a numeric ID that is equivalent to the string ID used in an XML resource. To be used in event tables. The module method Wx::xrcid(name) is provided for convenience.

XmlResource#init_all_handlers

init_all_handlers()

Initializes handlers for all supported controls/windows. In wxRuby versions 1.9.6 and later, this is called automatically for you, so there is no need to call this method

XmlResource#load

Boolean load(String file)

Loads resources from the XML file file. If this file does not exist, or contains invalid XML, an exception will be raised; if successful, the loaded file name will be returneed.

XmlResource#load_bitmap

Bitmap load_bitmap(String name)

Loads a bitmap resource from a file.

XmlResource#load_dialog

Dialog load_dialog(Window parent, String name)

Loads a dialog. dlg points to a parent window (if any).

XmlResource#load_dialog_subclass

Boolean load_dialog_subclass(Dialog dlg, Window parent, String name)

Loads a dialog. dlg points to parent window (if any).

This form is used to finish creation of an already existing instance (the main reason for this is that you may want to use derived class with a new event table).

Example:

dlg = MyDialog.new
the_xml_resource.load_dialog_subclass(dlg, main_frame, "my_dialog")
dlg.show_modal

XmlResource#load_frame

Frame load_frame(Window parent, String name)

Loads a frame.

XmlResource#load_frame_subclass

Boolean load_frame_subclass(Frame frame, Window parent, String name)

Loads a frame. This form is used to finish creation of an already existing instance.

XmlResource#load_icon

Icon load_icon(String name)

Loads an icon resource from a file.

XmlResource#load_menu

Menu load_menu(String name)

Loads menu from resource. Returns NULL on failure.

XmlResource#load_menu_bar

MenuBar load_menu_bar(Window parent, String name)

Loads a menubar from resource. Returns NULL on failure.

MenuBar load_menu_bar(String name)

Loads a menubar from resource. Returns NULL on failure.

XmlResource#load_panel

Panel load_panel(Window parent, String name)

Loads a panel. panel points to parent window (if any).

XmlResource#load_panel_subclass

Boolean load_panel_subclass(Panel panel, Window parent, String name)

Loads a panel. panel points to parent window (if any). This form is used to finish creation of an already existing instance.

XmlResource#load_tool_bar

ToolBar load_tool_bar(Window parent, String name)

Loads a toolbar.

XmlResource#set_flags

set_flags(Integer flags)

Sets flags (bitlist of XRC_USE_LOCALE and XRC_NO_SUBCLASSING).

XmlResource#unload

Boolean unload(String filename)

This function unloads a resource previously loaded by load().

Returns if the resource was successfully unloaded and if it hasn’t been found in the list of loaded resources.

[This page automatically generated from the Textile source at Thu May 01 00:50:49 +0100 2008]