From a302d5958c111a6fe3dbdbc7718cc0f8188fced6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 6 Sep 2008 13:35:29 +0000 Subject: [PATCH] added XRC format documentation to the manual (per-class properties docs still missing) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55495 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/doxygen/Doxyfile_inc | 1 + docs/doxygen/overviews/xrc.h | 9 +- docs/doxygen/overviews/xrc_format.h | 1042 +++++++++++++++++++++++++++ interface/wx/xrc/xmlres.h | 2 +- 4 files changed, 1045 insertions(+), 9 deletions(-) create mode 100644 docs/doxygen/overviews/xrc_format.h diff --git a/docs/doxygen/Doxyfile_inc b/docs/doxygen/Doxyfile_inc index 087941eb80..c6a43b7363 100644 --- a/docs/doxygen/Doxyfile_inc +++ b/docs/doxygen/Doxyfile_inc @@ -132,6 +132,7 @@ ALIASES += row3col{7}="\1 \2 \3,\4,\5,\6,\7" ALIASES += row3col{8}="\1 \2 \3,\4,\5,\6,\7,\8" ALIASES += row3col{9}="\1 \2 \3,\4,\5,\6,\7,\8,\9" ALIASES += row3col{10}="\1 \2 \3,\4,\5,\6,\7,\8,\9,\10" +ALIASES += hdr3col{3}="\1 \2 \3" ALIASES += endTable="" # definition list aliases diff --git a/docs/doxygen/overviews/xrc.h b/docs/doxygen/overviews/xrc.h index 0ba7c0a3d1..e12d1660ab 100644 --- a/docs/doxygen/overviews/xrc.h +++ b/docs/doxygen/overviews/xrc.h @@ -41,10 +41,9 @@ XRC was written by Vaclav Slavik. @li @ref overview_xrc_embeddedresource @li @ref overview_xrc_cppsample @li @ref overview_xrc_sample -@li @ref overview_xrc_fileformat @li @ref overview_xrc_cppheader @li @ref overview_xrc_newresourcehandlers - +@li @ref xrc_format
@@ -444,12 +443,6 @@ This is the XML file (resource.xrc) for the XRC sample. @endcode -@section overview_xrc_fileformat XRC File Format - -Please see Technical Note 14 (docs/tech/tn0014.txt) in your wxWidgets -distribution. - - @section overview_xrc_cppheader C++ header file generation Using the @c -e switch together with @c -c, a C++ header file is written diff --git a/docs/doxygen/overviews/xrc_format.h b/docs/doxygen/overviews/xrc_format.h new file mode 100644 index 0000000000..bc37040f15 --- /dev/null +++ b/docs/doxygen/overviews/xrc_format.h @@ -0,0 +1,1042 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 + ("