本文整理汇总了C++中core::Element::GetNumChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ Element::GetNumChildren方法的具体用法?C++ Element::GetNumChildren怎么用?C++ Element::GetNumChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::Element
的用法示例。
在下文中一共展示了Element::GetNumChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ProcessEvent
// Process the incoming event.
void ElementTabSet::ProcessEvent(Core::Event& event)
{
Core::Element::ProcessEvent(event);
if (event.GetCurrentElement() == this && event == "click")
{
// Find the tab that this click occured on
Core::Element* tabs = GetChildByTag("tabs");
Core::Element* tab = event.GetTargetElement();
while (tab && tab != this && tab->GetParentNode() != tabs)
tab = tab->GetParentNode();
// Abort if we couldn't find the tab the click occured on
if (!tab || tab == this)
return;
// Determine the new active tab index
int new_active_tab = active_tab;
for (int i = 0; i < tabs->GetNumChildren(); i++)
{
if (tabs->GetChild(i) == tab)
{
new_active_tab = i;
break;
}
}
SetActiveTab(new_active_tab);
}
}
示例3: 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);
}
示例4: 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);
}
示例5: Render
// Renders any debug elements in the debug context.
void Plugin::Render()
{
// Render the outlines of the debug context's elements.
if (render_outlines &&
debug_context != NULL)
{
for (int i = 0; i < debug_context->GetNumDocuments(); ++i)
{
Core::ElementDocument* document = debug_context->GetDocument(i);
if (document->GetId().Find("rkt-debug-") == 0)
continue;
std::stack< Core::Element* > element_stack;
element_stack.push(document);
while (!element_stack.empty())
{
Core::Element* element = element_stack.top();
element_stack.pop();
if (element->IsVisible())
{
for (int j = 0; j < element->GetNumBoxes(); ++j)
{
const Core::Box& box = element->GetBox(j);
Geometry::RenderOutline(element->GetAbsoluteOffset(Core::Box::BORDER) + box.GetPosition(Core::Box::BORDER), box.GetSize(Core::Box::BORDER), Core::Colourb(255, 0, 0, 128), 1);
}
for (int j = 0; j < element->GetNumChildren(); ++j)
element_stack.push(element->GetChild(j));
}
}
}
}
// Render the info element's boxes.
if (info_element != NULL &&
info_element->IsVisible())
{
info_element->RenderHoverElement();
info_element->RenderSourceElement();
}
}
示例6: 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;
}