本文整理汇总了C++中core::Element::RemoveChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Element::RemoveChild方法的具体用法?C++ Element::RemoveChild怎么用?C++ Element::RemoveChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::Element
的用法示例。
在下文中一共展示了Element::RemoveChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveTab
// Remove one of the tab set's panels and its corresponding tab.
void ElementTabSet::RemoveTab(int tab_index)
{
if (tab_index < 0)
return;
Core::Element* panels = GetChildByTag("panels");
Core::Element* tabs = GetChildByTag("tabs");
if (panels->GetNumChildren() > tab_index &&
tabs->GetNumChildren() > tab_index)
{
panels->RemoveChild(panels->GetChild(tab_index));
tabs->RemoveChild(tabs->GetChild(tab_index));
}
}
示例2: Load
// Adds the cell contents, and marks the row as loaded.
void ElementDataGridRow::Load(const DataQuery& row_information)
{
// Check for a data source. If they're both set then we set
// ourselves up with it.
if (row_information.IsFieldSet(DataSource::CHILD_SOURCE))
{
Rocket::Core::String data_source = row_information.Get< Rocket::Core::String >(DataSource::CHILD_SOURCE, "");
if (!data_source.Empty())
{
SetDataSource(data_source);
}
else
{
// If we've no data source, then we should remove any children.
RemoveChildren();
}
}
// Now load our cells.
for (int i = 0; i < parent_grid->GetNumColumns(); i++)
{
Core::Element* cell = GetChild(i);
if (cell)
{
// Fetch the column:
const ElementDataGrid::Column* column = parent_grid->GetColumn(i);
// Now we use the column's formatter to process the raw data into the
// XML string, and parse that into the actual Core::Elements. If there is
// no formatter, then we just send through the raw text, in CVS form.
Rocket::Core::StringList raw_data;
for (size_t i = 0; i < column->fields.size(); i++)
{
if (column->fields[i] == DataSource::DEPTH)
{
raw_data.push_back(Rocket::Core::String(8, "%d", depth));
}
else if (column->fields[i] == DataSource::NUM_CHILDREN)
{
raw_data.push_back(Rocket::Core::String(8, "%d", children.size()));
}
else
{
raw_data.push_back(row_information.Get< Rocket::Core::String >(column->fields[i], ""));
}
}
Rocket::Core::String cell_string;
if (column->formatter)
{
column->formatter->FormatData(cell_string, raw_data);
}
else
{
for (size_t i = 0; i < raw_data.size(); i++)
{
if (i > 0)
{
cell_string.Append(",");
}
cell_string.Append(raw_data[i]);
}
}
// Remove all the cell's current contents.
while (cell->GetNumChildren(true) > 0)
{
cell->RemoveChild(cell->GetChild(0));
}
// Add the new contents to the cell.
Core::Factory::InstanceElementText(cell, cell_string);
}
else
{
ROCKET_ERROR;
}
}
dirty_cells = false;
}