Exemple #1
0
int Inventory2::getHoveredItem(Common::Point *point) {
	int selId = getSelectedItemId();

	if (point->y <= 20 && !_isInventoryOut && !_isLocked)
		slideOut();

	if (!selId && point->y >= 55) {
		if (!_isInventoryOut)
			return 0;

		if (!_isLocked)
			slideIn();
	}

	if (!_isInventoryOut)
		return 0;

	for (uint i = 0; i < _inventoryIcons.size(); i++) {
		InventoryIcon *icn = _inventoryIcons[i];
		if (selId ||
			point->x < icn->x1 ||
			point->x > icn->x2 ||
			point->y < _topOffset + icn->y1 ||
			point->y > _topOffset + icn->y2) {
			icn->isMouseHover = false;
		} else {
			icn->isMouseHover = true;
			return icn->inventoryItemId;
		}
    }

	return 0;
}
bool FullScreenBar::eventFilter(QObject* object, QEvent* event)
{
    if (event->type() == QEvent::MouseMove) {
        QApplication::restoreOverrideCursor();
        d->mAutoHideCursorTimer->start();
        if (y() == 0) {
            if (d->shouldHide()) {
                slideOut();
            }
        } else {
            QMouseEvent* mouseEvent = static_cast<QMouseEvent *>(event);
            if (mouseEvent->buttons() == 0 && d->slideInTriggerRect().contains(QCursor::pos())) {
                slideIn();
            }
        }
        return false;
    }

    if (event->type() == QEvent::MouseButtonRelease) {
        // This can happen if user released the mouse after using a scrollbar
        // in the content (the bar does not hide while a button is down)
        if (y() == 0 && d->shouldHide()) {
            slideOut();
        }
        return false;
    }

    // Filtering message on tooltip text for CJK to remove accelerators.
    // Quoting ktoolbar.cpp:
    // """
    // CJK languages use more verbose accelerator marker: they add a Latin
    // letter in parenthesis, and put accelerator on that. Hence, the default
    // removal of ampersand only may not be enough there, instead the whole
    // parenthesis construct should be removed. Use KLocale's method to do this.
    // """
    if (event->type() == QEvent::Show || event->type() == QEvent::Paint) {
        QToolButton* button = qobject_cast<QToolButton*>(object);
        if (button && !button->actions().isEmpty()) {
            QAction* action = button->actions().first();
            QString toolTip = KGlobal::locale()->removeAcceleratorMarker(action->toolTip());
            // Filtering message requested by translators (scripting).
            button->setToolTip(i18nc("@info:tooltip of custom toolbar button", "%1", toolTip));
        }
    }

    return false;
}
Exemple #3
0
bool doTask(int task) {
	switch (task) {
		case GO_FORWARD: 		
			return goForward(false);
		case GO_BACKWARD:	
			return goBackward(); 
		case CALC_NEXT_LINE:	
			return calcNextLine();
		case GO_FORWARD_AND_COUNT:
			return goForwardAndCount();
		case TURN_LEFT:		
			return turn90(LEFT);	
		case TURN_RIGHT:		
			return turn90(RIGHT);
		case TURN_90:		
			// turn this based on the side
			return true;
		case TURN_180:
			return turn180();
		case TO_VERTICAL:
			return craneToVer();
		case TO_HORIZONTAL:
			return craneToHor();
		case SLIDE_OUT:
			return slideOut();
		case SLIDE_IN:
			return slideIn();
		case OPEN_GRIPPER:
			return openGripper();
		case CLOSE_GRIPPER:
			return closeGripper();
		case SWITCH_SIDE:
			return switchSide();
		default:		
			return true;
	}
}