added insert_at property for the object nodes (patch 1185138)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38778 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -30,14 +30,14 @@ Note: see also http://ldaptool.sourceforge.net/XRCGuide/XRCGuideSingle/
|
|||||||
1. Terminology
|
1. Terminology
|
||||||
==============
|
==============
|
||||||
|
|
||||||
The usual XML terminology applies. In particular, we shall use the terms
|
The usual XML terminology applies. In particular, we shall use the terms
|
||||||
NODE, PROPERTY and VALUE in the XML sense:
|
NODE, PROPERTY and VALUE in the XML sense:
|
||||||
|
|
||||||
<node property1="value1" property2="value2">...</node>
|
<node property1="value1" property2="value2">...</node>
|
||||||
|
|
||||||
The term ATTRIBUTE is specific to XRC and refers to a subnode
|
The term ATTRIBUTE is specific to XRC and refers to a subnode
|
||||||
of an <object> or <object_ref> node that is itself not <object> or <object_ref>.
|
of an <object> or <object_ref> node that is itself not <object> or <object_ref>.
|
||||||
In the example below, <pos>, <label> and <style> are attributes, while neither
|
In the example below, <pos>, <label> and <style> are attributes, while neither
|
||||||
<resource> nor either of <object>s is:
|
<resource> nor either of <object>s is:
|
||||||
|
|
||||||
<?xml version="1.0" encoding="utf-8">
|
<?xml version="1.0" encoding="utf-8">
|
||||||
@@ -62,17 +62,17 @@ can think of it as attribute value syntax definition).
|
|||||||
=========================
|
=========================
|
||||||
|
|
||||||
XRC resource file is a well-formed XML 1.0 document. All elements of XRC file
|
XRC resource file is a well-formed XML 1.0 document. All elements of XRC file
|
||||||
are from the http://www.wxwidgets.org/wxxrc namespace.
|
are from the http://www.wxwidgets.org/wxxrc namespace.
|
||||||
|
|
||||||
The root node of XRC document must be <resource>. The <resource> node has
|
The root node of XRC document must be <resource>. The <resource> node has
|
||||||
optional "version" property. Default version (in absence of the version
|
optional "version" property. Default version (in absence of the version
|
||||||
property) is "0.0.0.0". The version consists of four integers separated by
|
property) is "0.0.0.0". The version consists of four integers separated by
|
||||||
periods. Version of XRC format changes only if there was an incompatible
|
periods. Version of XRC format changes only if there was an incompatible
|
||||||
change introduced (i.e. either the library cannot understand old resource
|
change introduced (i.e. either the library cannot understand old resource
|
||||||
files or older versions of the library wouldn't understand the new format).
|
files or older versions of the library wouldn't understand the new format).
|
||||||
The first three integers are major, minor and release number of the wxWidgets
|
The first three integers are major, minor and release number of the wxWidgets
|
||||||
release when the change was introduced, the last one is revision number and
|
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
|
is 0 for the first incompatible change in given wxWidgets release, 1 for
|
||||||
the second etc.
|
the second etc.
|
||||||
|
|
||||||
Differences between versions are described within this document in paragraphs
|
Differences between versions are described within this document in paragraphs
|
||||||
@@ -86,7 +86,7 @@ The <resource> node is only allowed to have <object> and <object_ref>
|
|||||||
subnodes, all of which must have the "name" property.
|
subnodes, all of which must have the "name" property.
|
||||||
|
|
||||||
The <object> node represents a single object (GUI element) and it usually maps
|
The <object> node represents a single object (GUI element) and it usually maps
|
||||||
directly to a wxWidgets class instance. It three properties: "name", "class"
|
directly to a wxWidgets class instance. It has the properties: "name", "class"
|
||||||
and "subclass". "class" must always be present, it tells XRC what wxWidgets
|
and "subclass". "class" must always be present, it tells XRC what wxWidgets
|
||||||
object should be created in this place. The other two are optional. "name" is
|
object should be created in this place. The other two are optional. "name" is
|
||||||
ID used to identify the object. It is the value passed to the XRCID() macro and
|
ID used to identify the object. It is the value passed to the XRCID() macro and
|
||||||
@@ -99,12 +99,17 @@ constructor for "class". Subclass must be available in the program that loads
|
|||||||
the resource, must be derived from "class" and must be registered within
|
the resource, must be derived from "class" and must be registered within
|
||||||
wxWidgets' RTTI system.
|
wxWidgets' RTTI system.
|
||||||
|
|
||||||
|
Finally, an optional "insert_at" property may be present. Currently only the
|
||||||
|
values "begin" and "end" are supported, meaning to insert the object in the
|
||||||
|
beginning of the parent node objects list or to append it at the end (which is
|
||||||
|
the default if this property is absent).
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
<object name="MyList1" class="wxListCtrl" subclass="MyListCtrlClass">
|
<object name="MyList1" class="wxListCtrl" subclass="MyListCtrlClass">
|
||||||
...
|
...
|
||||||
</object>
|
</object>
|
||||||
|
|
||||||
<object> node may have arbitrary child nodes. What child nodes and their
|
<object> node may have arbitrary child nodes. What child nodes and their
|
||||||
semantics are class-dependent and are defined later in this document. The user
|
semantics are class-dependent and are defined later in this document. The user
|
||||||
is allowed to register new object handlers within XRC and extend it to accept
|
is allowed to register new object handlers within XRC and extend it to accept
|
||||||
@@ -129,7 +134,7 @@ Example:
|
|||||||
<value>bar</value> <!-- override! -->
|
<value>bar</value> <!-- override! -->
|
||||||
</object_ref>
|
</object_ref>
|
||||||
|
|
||||||
is identical to:
|
is identical to:
|
||||||
|
|
||||||
<object name="foo" class="wxTextCtrl">
|
<object name="foo" class="wxTextCtrl">
|
||||||
<value>hello</value>
|
<value>hello</value>
|
||||||
@@ -215,7 +220,7 @@ define own constants, effectively any string is legal here). Examples are
|
|||||||
"wxART_FILE_OPEN" (id) or "wxART_MENU" (client).
|
"wxART_FILE_OPEN" (id) or "wxART_MENU" (client).
|
||||||
|
|
||||||
Any of "stock_id" or "stock_client" properties or the filename may be omitted.
|
Any of "stock_id" or "stock_client" properties or the filename may be omitted.
|
||||||
XRC determines the bitmap to use according to this algorithm:
|
XRC determines the bitmap to use according to this algorithm:
|
||||||
1. If there is non-empty "stock_id" property, query wxArtProvider for the
|
1. If there is non-empty "stock_id" property, query wxArtProvider for the
|
||||||
bitmap (if there is no "stock_client", use default one, which is usually
|
bitmap (if there is no "stock_client", use default one, which is usually
|
||||||
wxART_OTHER; exceptions are noted in class-specific sections below). If
|
wxART_OTHER; exceptions are noted in class-specific sections below). If
|
||||||
@@ -251,12 +256,12 @@ relativesize Float, font size relative to choosen system font's size;
|
|||||||
All of them are optional, if they are missing, wxFont default is used.
|
All of them are optional, if they are missing, wxFont default is used.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
<font>
|
<font>
|
||||||
<face>arial,helvetica</face>
|
<face>arial,helvetica</face>
|
||||||
<size>12</size>
|
<size>12</size>
|
||||||
</font>
|
</font>
|
||||||
|
|
||||||
<font>
|
<font>
|
||||||
<sysfont>wxSYS_DEFAULT_GUI_FONT</sysfont>
|
<sysfont>wxSYS_DEFAULT_GUI_FONT</sysfont>
|
||||||
<weight>bold</weight>
|
<weight>bold</weight>
|
||||||
@@ -288,7 +293,7 @@ attribute name attribute type default value, if any
|
|||||||
|
|
||||||
wxBitmap
|
wxBitmap
|
||||||
--------
|
--------
|
||||||
This is a special case, because it does not create a wxWindow instance but
|
This is a special case, because it does not create a wxWindow instance but
|
||||||
creates wxBitmap instead. Another exceptional thing is that it does not have
|
creates wxBitmap instead. Another exceptional thing is that it does not have
|
||||||
any attributes. Instead, the node itself is interpreted as if it were attribute
|
any attributes. Instead, the node itself is interpreted as if it were attribute
|
||||||
of type Bitmap.
|
of type Bitmap.
|
||||||
@@ -305,7 +310,7 @@ wxButton
|
|||||||
--------
|
--------
|
||||||
pos Position -1,-1
|
pos Position -1,-1
|
||||||
size Size -1,-1
|
size Size -1,-1
|
||||||
style Style[wxButton]
|
style Style[wxButton]
|
||||||
|
|
||||||
label I18nString
|
label I18nString
|
||||||
default Boolean false
|
default Boolean false
|
||||||
@@ -455,7 +460,7 @@ appear within wxToolBar node. Their attributes are as follows:
|
|||||||
|
|
||||||
tool
|
tool
|
||||||
----
|
----
|
||||||
bitmap Bitmap
|
bitmap Bitmap
|
||||||
bitmap2 Bitmap wxNullBitmap
|
bitmap2 Bitmap wxNullBitmap
|
||||||
toggle Boolean 0
|
toggle Boolean 0
|
||||||
radio Boolean 0
|
radio Boolean 0
|
||||||
@@ -469,7 +474,7 @@ appear within wxToolBar node. Their attributes are as follows:
|
|||||||
At most one of "toggle" and "radio" attributes may be 1.
|
At most one of "toggle" and "radio" attributes may be 1.
|
||||||
Attribute "pos" may not appear if "label" or "radio" attributes
|
Attribute "pos" may not appear if "label" or "radio" attributes
|
||||||
are used or if parent wxToolBar's style contains wxTB_TEXT.
|
are used or if parent wxToolBar's style contains wxTB_TEXT.
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
Use of "pos" attribute is strongly discouraged, it is deprecated
|
Use of "pos" attribute is strongly discouraged, it is deprecated
|
||||||
usage of wxToolBar and it is not supported by MSW and GTK
|
usage of wxToolBar and it is not supported by MSW and GTK
|
||||||
|
@@ -625,7 +625,18 @@ static void MergeNodes(wxXmlNode& dest, wxXmlNode& with)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !dnode )
|
if ( !dnode )
|
||||||
dest.AddChild(new wxXmlNode(*node));
|
{
|
||||||
|
static const wxChar *AT_END = wxT("end");
|
||||||
|
wxString insert_pos = node->GetPropVal(wxT("insert_at"), AT_END);
|
||||||
|
if ( insert_pos == AT_END )
|
||||||
|
{
|
||||||
|
dest.AddChild(new wxXmlNode(*node));
|
||||||
|
}
|
||||||
|
else if ( insert_pos == wxT("begin") )
|
||||||
|
{
|
||||||
|
dest.InsertChild(new wxXmlNode(*node), dest.GetChildren());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( dest.GetType() == wxXML_TEXT_NODE && with.GetContent().Length() )
|
if ( dest.GetType() == wxXML_TEXT_NODE && with.GetContent().Length() )
|
||||||
|
Reference in New Issue
Block a user