Exemplo n.º 1
0
GUIComponent *GUIComponent::get_top_level_component()
{
	GUIComponent *parent = this;

	while (true)
	{
		if (parent->get_parent_component())
			parent = parent->get_parent_component();
		else 
			break;
	}

	return parent;
}
Exemplo n.º 2
0
GUIComponent *GUIComponent::get_next_component_in_tree()
{
	if (has_child_components())
		return get_first_child();

	if (impl->next_sibling)
		return impl->next_sibling;

	GUIComponent *parent = impl->parent;
	while (parent)
	{
		if (parent->get_next_sibling())
			return parent->get_next_sibling();
		parent = parent->get_parent_component();
	}

	// Reached end of tree. Return first item.
	return get_top_level_component();
}