Exemple #1
0
Widget* TabList::getNext(bool inner) {
	if (widgets.size() == 0)
		return NULL;

	if (current_is_valid()) {
		if (inner && widgets.at(current)->getNext())
			return NULL;

		widgets.at(current)->defocus();
	}
	++current;

	if (current >= (int)widgets.size())
		current = 0;

	widgets.at(current)->in_focus = true;
	return widgets.at(current);
}
Exemple #2
0
Widget* TabList::getPrev(bool inner) {
	if (widgets.size() == 0)
		return NULL;

	if (current_is_valid()) {
		if (inner && widgets.at(current)->getPrev())
			return NULL;

		widgets.at(current)->defocus();
	}

	--current;

	if (current <= -1)
		current = widgets.size()-1;

	widgets.at(current)->in_focus = true;
	return widgets.at(current);
}
Exemple #3
0
void TabList::logic(bool allow_keyboard) {
	if (locked) return;
	if (NO_MOUSE || allow_keyboard) {
		if (scrolltype == VERTICAL || scrolltype == TWO_DIRECTIONS) {
			if (inpt->pressing[DOWN] && !inpt->lock[DOWN]) {
				inpt->lock[DOWN] = true;
				getNext();
			}
			else if (inpt->pressing[UP] && !inpt->lock[UP]) {
				inpt->lock[UP] = true;
				getPrev();
			}
		}

		if (scrolltype == HORIZONTAL || scrolltype == TWO_DIRECTIONS) {
			if (inpt->pressing[MV_LEFT] && !inpt->lock[MV_LEFT]) {
				inpt->lock[MV_LEFT] = true;
				getPrev(false);
			}
			else if (inpt->pressing[MV_RIGHT] && !inpt->lock[MV_RIGHT]) {
				inpt->lock[MV_RIGHT] = true;
				getNext(false);
			}
		}

		if (inpt->pressing[ACTIVATE] && !inpt->lock[ACTIVATE]) {
			inpt->lock[ACTIVATE] = true;
			deactivatePrevious(); //Deactivate previously activated item
			activate();	// Activate the currently infocus item
		}
	}

	// If mouse is clicked, defocus current tabindex item
	if (inpt->pressing[MAIN1] && !inpt->lock[MAIN1] && current_is_valid() && !isWithin(widgets[getCurrent()]->pos, inpt->mouse)) {
		defocus();
	}
}
Exemple #4
0
void TabList::unlock() {
	locked = false;
	if (current_is_valid())
		widgets.at(current)->in_focus = true;
}
Exemple #5
0
void TabList::lock() {
	locked = true;
	if (current_is_valid())
		widgets.at(current)->defocus();
}
Exemple #6
0
void TabList::activate() {
	if (current_is_valid()) {
		widgets.at(current)->activate();
		previous = current;
	}
}