本文整理汇总了C++中core::Element::AppendChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Element::AppendChild方法的具体用法?C++ Element::AppendChild怎么用?C++ Element::AppendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::Element
的用法示例。
在下文中一共展示了Element::AppendChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetTab
// Set the specifed tab index's title element.
void ElementTabSet::SetTab(int tab_index, Core::Element* element)
{
Core::Element* tabs = GetChildByTag("tabs");
if (tab_index >= 0 &&
tab_index < tabs->GetNumChildren())
tabs->ReplaceChild(GetChild(tab_index), element);
else
tabs->AppendChild(element);
}
示例2: ElementStart
Core::Element* XMLNodeHandlerDataGrid::ElementStart(Core::XMLParser* parser, const Rocket::Core::String& name, const Rocket::Core::XMLAttributes& attributes)
{
Core::Element* element = NULL;
Core::Element* parent = parser->GetParseFrame()->element;
ROCKET_ASSERT(name == "datagrid" ||
name == "col");
if (name == "datagrid")
{
// Attempt to instance the grid.
element = Core::Factory::InstanceElement(parent, name, name, attributes);
ElementDataGrid* grid = dynamic_cast< ElementDataGrid* >(element);
if (grid == NULL)
{
if (element != NULL)
element->RemoveReference();
Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create data grid for tag %s.", name.CString());
return NULL;
}
// Set the data source and table on the data grid.
Rocket::Core::String data_source = attributes.Get< Rocket::Core::String >("source", "");
grid->SetDataSource(data_source);
parent->AppendChild(grid);
grid->RemoveReference();
// Switch to this handler for all columns.
parser->PushHandler("datagrid");
}
else if (name == "col")
{
// Make a new node handler to handle the header elements.
element = Core::Factory::InstanceElement(parent, "datagridcolumn", "datagridcolumn", attributes);
if (element == NULL)
return NULL;
ElementDataGrid* grid = dynamic_cast< ElementDataGrid* >(parent);
if (grid != NULL)
{
grid->AddColumn(attributes.Get< Rocket::Core::String >("fields", ""), attributes.Get< Rocket::Core::String >("formatter", ""), attributes.Get< float >("width", 0), element);
element->RemoveReference();
}
// Switch to element handler for all children.
parser->PushDefaultHandler();
}
else
{
ROCKET_ERROR;
}
return element;
}
示例3: SetPanel
// Set the specified tab index's body element.
void ElementTabSet::SetPanel(int tab_index, Core::Element* element)
{
// Append the window
Core::Element* windows = GetChildByTag("panels");
if (tab_index >= 0 &&
tab_index < windows->GetNumChildren())
windows->ReplaceChild(GetChild(tab_index), element);
else
windows->AppendChild(element);
}
示例4: ElementStart
Core::Element* XMLNodeHandlerTabSet::ElementStart(Core::XMLParser* parser, const Rocket::Core::String& name, const Rocket::Core::XMLAttributes& attributes)
{
ROCKET_ASSERT(name == "tabset" ||
name == "tabs" ||
name == "tab" ||
name == "panels" ||
name == "panel");
if (name == "tabset")
{
// Call this node handler for all children
parser->PushHandler("tabset");
// Attempt to instance the tabset
Core::Element* element = Core::Factory::InstanceElement(parser->GetParseFrame()->element, name, name, attributes);
ElementTabSet* tabset = rocket_dynamic_cast< ElementTabSet* >(element);
if (!tabset)
{
if (element)
element->RemoveReference();
Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create element for tag %s.", name.CString());
return NULL;
}
// Add the TabSet into the document
parser->GetParseFrame()->element->AppendChild(element);
element->RemoveReference();
return element;
}
else if (name == "tab")
{
// Call default element handler for all children.
parser->PushDefaultHandler();
Core::Element* tab_element = Core::Factory::InstanceElement(parser->GetParseFrame()->element, "*", "tab", attributes);
ElementTabSet* tabset = rocket_dynamic_cast< ElementTabSet* >(parser->GetParseFrame()->element);
if (tabset)
{
tabset->SetTab(-1, tab_element);
tab_element->RemoveReference();
}
return tab_element;
}
else if (name == "panel")
{
// Call default element handler for all children.
parser->PushDefaultHandler();
Core::Element* panel_element = Core::Factory::InstanceElement(parser->GetParseFrame()->element, "*", "panel", attributes);
ElementTabSet* tabset = rocket_dynamic_cast< ElementTabSet* >(parser->GetParseFrame()->element);
if (tabset)
{
tabset->SetPanel(-1, panel_element);
panel_element->RemoveReference();
}
return panel_element;
}
else if (name == "tabs" || name == "panels")
{
// Use the element handler to add the tabs and panels elements to the the tabset (this allows users to
// style them nicely), but don't return the new element, as we still want the tabset to be the top of the
// parser's node stack.
Core::Element* parent = parser->GetParseFrame()->element;
// Attempt to instance the element with the instancer.
Core::Element* element = Core::Factory::InstanceElement(parent, name, name, attributes);
if (!element)
{
Core::Log::Message(Rocket::Core::Log::LT_ERROR, "Instancer failed to create element for tag %s.", name.CString());
return NULL;
}
// Add the element to its parent and remove the initial reference.
parent->AppendChild(element);
element->RemoveReference();
}
return NULL;
}