///////////////////////////////////////////////////////////////////////////// // Name: xrc_format.h // Purpose: XRC format specification // Author: Vaclav Slavik // RCS-ID: $Id$ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// /** @page xrc_format XRC file format Table of contents: - @ref xrc_format_overview - @ref xrc_format_root - @ref xrc_format_objects - @ref xrc_format_object - @ref xrc_format_object_ref - @ref xrc_format_datatypes - @ref xrc_format_windows - @ref xrc_format_std_props - @ref xrc_format_controls - @ref xrc_format_sizers - @ref xrc_format_other_objects - @ref xrc_format_platform - @ref xrc_format_extending - @ref xrc_format_extending_subclass - @ref xrc_format_extending_unknown - @ref xrc_format_extending_custom - @ref xrc_format_packed - @ref xrc_format_oldversions This document describes the format of XRC resource files, as used by wxXmlResource. @section xrc_format_overview Overview XRC file is a XML file with all of its elements in the @c http://www.wxwidgets.org/wxxrc namespace. For backward compatibility, @c http://www.wxwindows.org/wxxrc namespace is accepted as well (and treated as identical to @c http://www.wxwidgets.org/wxxrc), but it shouldn't be used in new XRC files. XRC file contains definitions for one or more @em objects -- typically windows. The objects may themselves contain child objects. Objects defined at the top level, under the @ref xrc_format_root "root element", can be accessed using wxXmlResource::LoadDialog() and other LoadXXX methods. They must have @c name attribute that is used as LoadXXX's argument (see @ref xrc_format_object for details). Child objects are not directly accessible via wxXmlResource, they can only be accessed using XRCCTRL(). @section xrc_format_root Root element: The root element is always @c . It has one optional attribute, @c version. If set, it specifies version of the file. In absence of @c version attribute, the default is @c "0.0.0.0". The version consists of four integers separated by periods. The first three components are major, minor and release number of the wxWidgets release when the change was introduced, the last one is revision number and is 0 for the first incompatible change in given wxWidgets release, 1 for the second and so on. The version changes only if there was an incompatible change introduced; merely adding new kind of objects does not constitute incompatible change. At the time of writing, the latest version is @c "2.5.3.0". Note that even though @c version attribute is optional, it should always be specified to take advantage of the latest capabilities: @code ... @endcode @c may have arbitrary number of @ref xrc_format_objects "object elements" as its children; they are referred to as @em toplevel objects in the rest of this document. Unlike objects defined deeper in the hierarchy, toplevel objects @em must have their @c name attribute set and it must be set to a value unique among root's children. @section xrc_format_objects Defining objects @subsection xrc_format_object The @c element represents a single object (typically a GUI element) and it usually maps directly to a wxWidgets class instance. It has one mandatory attribute, @c class, and optional @c name and @c subclass attributes. The @c class attribute must always be present, it tells XRC what wxWidgets object should be created and by which wxXmlResourceHandler. @c name is the identifier used to identify the object. This name serves three purposes: -# It is used by wxXmlResource's various LoadXXX() methods to find the resource by name passed as argument. -# wxWindow's name (see wxWindow::GetName()) is set to it. -# Numeric ID of a window or menu item is derived from the name. If the value represents an integer (in decimal notation), it is used for the numeric ID unmodified. If it is one of the wxID_XXX literals defined by wxWidgets (see @ref page_stockitems), its respective value is used. Otherwise, the name is transformed into dynamically generated ID. See wxXmlResource::GetXRCID() for more information. Name attributes must be unique at the top level (where the name is used to load resources) and should be unique among all controls within the same toplevel window (wxDialog, wxFrame). The @c subclass attribute optional name of class whose constructor will be called instead of the constructor for "class". See @ref xrc_format_extending_subclass for more details. @c element may -- and almost always do -- have children elements. These come in two varieties: -# Object's properties. A @em property is a value describing part of object's behaviour, for example the "label" property on wxButton defines its label. In the most common form, property is a single element with text content ("