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.
Wx::XRC_USE_LOCALE = 1
Wx::XRC_NO_SUBCLASSING = 2
Wx::XRC_NO_RELOADING = 4
XmlResource.new(String filemask, Integer flags = XRC_USE_LOCALE)
Constructor.
XmlResource.new(Integer flags = XRC_USE_LOCALE)
The flags in Wx::XmlResource are not useful in ruby. All XmlResources created will have the optimal flags.
Wx::XRC_USE_LOCALE: translatable strings will be translated via _().Wx::XRC_NO_SUBCLASSING: subclass property of object nodes will be ignored (useful for previews in XRC editors). Wx::XRC_NO_RELOADING will prevent the XRC files from being reloaded from disk in case they have been modified there since being last loaded (may slightly speed up loading them).XmlResource XmlResource.get()
Class method to get the global XmlResource object.
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.
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">.
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.
Integer get_flags()
Returns flags, which may be a bitlist of XRC_USE_LOCALE and XRC_NO_SUBCLASSING.
Integer get_version()
Returns version information (a.b.c.d = d+ 256c + 256b + 256a).
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.
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
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.
Bitmap load_bitmap(String name)
Loads a bitmap resource from a file.
Dialog load_dialog(Window parent, String name)
Loads a dialog. dlg points to a parent window (if any).
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
Frame load_frame(Window parent, String name)
Loads a frame.
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.
Icon load_icon(String name)
Loads an icon resource from a file.
Menu load_menu(String name)
Loads menu from resource. Returns NULL on failure.
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.
Panel load_panel(Window parent, String name)
Loads a panel. panel points to parent window (if any).
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.
ToolBar load_tool_bar(Window parent, String name)
Loads a toolbar.
set_flags(Integer flags)
Sets flags (bitlist of XRC_USE_LOCALE and XRC_NO_SUBCLASSING).
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]