Exemplo n.º 1
0
bool UINode::addLastFocus ()
{
	bool focus = false;
	for (UINodeListRevIter i = _nodes.rbegin(); i != _nodes.rend(); ++i) {
		UINode* nodePtr = *i;
		nodePtr->removeFocus();
		if (!focus) {
			focus = nodePtr->addLastFocus();
			if (focus) {
				addFocus(0, 0);
			}
		}
	}

	if (_nodes.empty() && isActive()) {
		addFocus(0, 0);
		return true;
	}
	return focus;
}
Exemplo n.º 2
0
bool UINode::prevFocus ()
{
	if (_nodes.empty()) {
		if (!isActive())
			return false;
		if (hasFocus())
			return false;
		addFocus(0, 0);
		return true;
	}

	for (UINodeListRevIter i = _nodes.rbegin(); i != _nodes.rend(); ++i) {
		UINode* nodePtr = *i;
		// search the node that currently has the focus
		if (!nodePtr->hasFocus())
			continue;

		if (nodePtr->prevFocus()) {
			addFocus(0, 0);
			return true;
		}

		nodePtr->removeFocus();
		for (++i; i != _nodes.rend(); ++i) {
			UINode* focusNodePtr = *i;
			if (focusNodePtr->addLastFocus()) {
				addFocus(0, 0);
				return true;
			}
		}
		break;
	}

	removeFocus();

	return false;
}