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:
Vadim Zeitlin 2006-04-17 01:35:22 +00:00
parent 17af82fb4c
commit b26a650c10
2 changed files with 41 additions and 25 deletions

View File

@ -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.
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
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
@ -99,6 +99,11 @@ constructor for "class". Subclass must be available in the program that loads
the resource, must be derived from "class" and must be registered within
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:
<object name="MyList1" class="wxListCtrl" subclass="MyListCtrlClass">

View File

@ -625,7 +625,18 @@ static void MergeNodes(wxXmlNode& dest, wxXmlNode& with)
}
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() )