Example #1
0
GUIComponent *GUIComponent::get_named_item(const std::string &id)
{
	GUIComponent *cur = impl->first_child;
	while (cur && cur != this)
	{
		if (cur->get_id() == id)
			return cur;

		if (cur->impl->first_child)
			cur = cur->impl->first_child;
		else if (cur->impl->next_sibling)
			cur = cur->impl->next_sibling;
		else
		{
			while (cur != this)
			{
				if (cur->impl->parent->impl->next_sibling)
				{
					cur = cur->impl->parent->impl->next_sibling;
					break;
				}
				else
					cur = cur->impl->parent;
			}
		}
	}

	return 0;
}