Esempio n. 1
0
void TabList::logic() {
	if (locked) return;
	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]) {
		defocus();
	}
}
Esempio n. 2
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();
	}
}