Ejemplo n.º 1
0
void DockingTooltipHandler::init()
{
	connect(m_dockingConfigurationProvider, SIGNAL(updated()), this, SLOT(updateTooltip()));
	connect(m_statusContainerManager, SIGNAL(statusUpdated(StatusContainer*)), this, SLOT(updateTooltip()));

	updateTooltip();
}
Ejemplo n.º 2
0
BOOL GUI::processMouseAction(MouseButton mouseButton, MouseAction mouseAction, int mouseX, int mouseY) {
	if (mouseAction == MOVED) {
		p_mouseCoords->set(mouseX, mouseY);
	}
	checkingPick = true;

	if (p_currentPicked != p_lastPicked) { // Hover handling
		updateTooltip("");

		if (p_lastPicked != nullptr) {
			p_lastPicked->onHoverOff(*p_mouseCoords);
		}

		if (p_currentPicked != nullptr) {
			p_currentPicked->onHover(*p_mouseCoords);

			if (p_currentPicked->getToolTip() != nullptr) {
				updateTooltip(*p_currentPicked->getToolTip());
			}
		}
		else {
			p_tooltip->setVisible(false);
		}
	}
	p_lastPicked = p_currentPicked;

	if (p_currentFocus != nullptr && mouseAction == PRESSED) { // Focus handling
		p_currentFocus->onLostFocus(*p_mouseCoords);
		p_currentFocus = nullptr;
	}

	if (p_currentPicked == nullptr) { // No need to continue
		return true;
	}

	switch (mouseAction) {
		case MOVED:
			p_currentPicked->mouseMoved(*p_mouseCoords);
		break;

		case PRESSED:
			if (!p_currentPicked->isVisible()) {
				return true;
			}
			p_currentPicked->bringToFront();
			p_currentFocus = (p_currentPicked->getPassFocusElement() == nullptr ? p_currentPicked : p_currentPicked->getPassFocusElement());
			p_currentFocus->onFocus(*p_mouseCoords);
			p_currentPicked->mousePressed(mouseButton, *p_mouseCoords);
		break;

		case RELEASED:
			if (!p_currentPicked->isVisible()) {
				return true;
			}
			p_currentPicked->mouseReleased(mouseButton, *p_mouseCoords);
		break;
	}
	return true;
}
//----[  update  ]-------------------------------------------------------------
void EvidyonGUIModule_TradeDialog::update(ActionTargeter* action_targeter) {
  if (pollAcceptTrade())   action_targeter->userEvent(TRADE_ACCEPT);
  if (pollCancelTrade())   action_targeter->userEvent(TRADE_CANCEL);
  if (pollWithdrawTrade()) action_targeter->userEvent(TRADE_WITHDRAW);

  unsigned int inventory_index;
  if (pollAddItemToTrade(&inventory_index)) {
    action_targeter->tradeAddItem()->inventory_index_ = inventory_index;
  }

  unsigned int trade_index;
  if (pollRemoveItemFromTrade(&trade_index)) {
    action_targeter->tradeRemoveItem()->inventory_index_ = trade_index;
  }

  updateTooltip();

  if (quantity_prompt_.isActive()) {
    //TODO:
    //CurrencyType quantity = quantity_prompt_.getValue();
    //if (quantity > myCharacter.money) { disable the OK button }
    if (quantity_prompt_.pollOK()) {
      action_targeter->tradeSetCurrency()->currency_ = quantity_prompt_.getValue();
      removeSubmodule(&quantity_prompt_);
    }
    if (quantity_prompt_.pollCancel()) {
      removeSubmodule(&quantity_prompt_);
    }
  } else {
    if (offer_currency_.pollPushed()) {
      addSubmodule(&quantity_prompt_);
      quantity_prompt_.initialize("How much gold do you want to offer?", "Add Gold", "Cancel");
    }
  }
}
Ejemplo n.º 4
0
bool CPetInventoryGlyph::doAction(CGlyphAction *action) {
	CInventoryGlyphAction *invAction = static_cast<CInventoryGlyphAction *>(action);
	CPetInventoryGlyphs *owner = dynamic_cast<CPetInventoryGlyphs *>(_owner);
	if (!invAction)
		return false;

	switch (invAction->getMode()) {
	case ACTION_REMOVED:
		if (invAction->_item == _item) {
			_item = nullptr;
			_background = nullptr;
			_field34 = 0;
		}
		break;

	case ACTION_REMOVE:
		if (_item == invAction->_item && _owner) {
			int v = populateItem(_item, 0);
			_background = owner->getBackground(v);

			if (isHighlighted()) {
				Point glyphPos = _owner->getHighlightedGlyphPos();
				reposition(glyphPos);
				updateTooltip();
			}
		}
		break;

	default:
		break;
	}

	return true;
}
Ejemplo n.º 5
0
void gTrayIcon::setToolTip(char* vl)
{
	if (buftext) 
		g_free(buftext);
		
	buftext = vl && *vl ? g_strdup(vl) : NULL;
	updateTooltip();
}
Ejemplo n.º 6
0
void RGBMatrixItem::slotRGBMatrixChanged(quint32)
{
    prepareGeometryChange();
    calculateWidth();
    if (m_function)
        m_function->setDuration(m_matrix->totalDuration());
    updateTooltip();
}
Ejemplo n.º 7
0
void ControlWidget::setName(QString name)
{
    if (m_name != name)
    {
        m_name = name;
        updateTooltip();
    }
}
Ejemplo n.º 8
0
	void TooltipItem::setItem(const Item *item)
	{
		if (mItem != item)
		{
			mItem = item;
			updateTooltip();
		}
	}
Ejemplo n.º 9
0
bool WWidget::event(QEvent* e) {
    if (e->type() == QEvent::ToolTip) {
        updateTooltip();
    } else if (isEnabled()) {
        switch(e->type()) {
        case QEvent::TouchBegin:
        case QEvent::TouchUpdate:
        case QEvent::TouchEnd:
        {
            QTouchEvent* touchEvent = dynamic_cast<QTouchEvent*>(e);
            if (touchEvent->deviceType() !=  QTouchEvent::TouchScreen) {
                break;
            }

            // fake a mouse event!
            QEvent::Type eventType = QEvent::None;
            switch (touchEvent->type()) {
            case QEvent::TouchBegin:
                eventType = QEvent::MouseButtonPress;
                if (touchIsRightButton()) {
                    // touch is right click
                    m_activeTouchButton = Qt::RightButton;
                } else {
                    m_activeTouchButton = Qt::LeftButton;
                }
                break;
            case QEvent::TouchUpdate:
                eventType = QEvent::MouseMove;
                break;
            case QEvent::TouchEnd:
                eventType = QEvent::MouseButtonRelease;
                break;
            default:
                DEBUG_ASSERT(false);
                break;
            }

            const QTouchEvent::TouchPoint &touchPoint =
                    touchEvent->touchPoints().first();
            QMouseEvent mouseEvent(eventType,
                    touchPoint.pos().toPoint(),
                    touchPoint.screenPos().toPoint(),
                    m_activeTouchButton, // Button that causes the event
                    Qt::NoButton, // Not used, so no need to fake a proper value.
                    touchEvent->modifiers());

            return QWidget::event(&mouseEvent);
        }
        default:
            break;
        }
    }

    return QWidget::event(e);
}
Ejemplo n.º 10
0
void
HippoCanvas::onHover(WPARAM wParam, LPARAM lParam)
{
    if (root_ == (HippoCanvasItem*) NULL)
        return;

    int x, y;
    if (!getMouseCoords(lParam, &x, &y))
        return;

    updateTooltip(true, x, y);
}
Ejemplo n.º 11
0
void CPetRoomsGlyph::selectGlyph(const Point &topLeft, const Point &pt) {
	if (isAssigned()) {
		bool isShiftPressed = g_vm->_window->getSpecialButtons() & MK_SHIFT;

		if (isShiftPressed) {
			int selection = getSelection(topLeft, pt);
			if (selection >= 0)
				_roomFlags |= 1 << selection;
		}

		updateTooltip();
	}
}
Ejemplo n.º 12
0
void gTrayIcon::setVisible(bool vl)
{
	if (vl)
	{
		if (!plug)
		{
			_loopLevel = gApplication::loopLevel() + 1;
			
			plug = gtk_status_icon_new();

			updatePicture();
			updateTooltip();

			#ifdef GDK_WINDOWING_X11
			// Needed, otherwise the icon does not appear in Gnome or XFCE notification area!
			XSizeHints hints;
			hints.flags = PMinSize;
			hints.min_width = _iconw;
			hints.min_height = _iconh;
			XSetWMNormalHints(gdk_x11_display_get_xdisplay(gdk_display_get_default()), gtk_status_icon_get_x11_window_id(plug), &hints);
			#endif

			gtk_status_icon_set_visible(plug, TRUE);

			//g_signal_connect(G_OBJECT(plug), "destroy", G_CALLBACK(cb_destroy),(gpointer)this);
			g_signal_connect(G_OBJECT(plug), "button-press-event", G_CALLBACK(cb_button_press), (gpointer)this);
			g_signal_connect(G_OBJECT(plug), "button-release-event", G_CALLBACK(cb_button_release),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug), "activate", G_CALLBACK(cb_activate),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"focus-in-event",G_CALLBACK(tray_focus_In),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"focus-out-event",G_CALLBACK(tray_focus_Out),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"enter-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"leave-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this);
			g_signal_connect(G_OBJECT(plug), "popup-menu", G_CALLBACK(cb_menu), (gpointer)this);
			g_signal_connect(G_OBJECT(plug), "scroll-event", G_CALLBACK(cb_scroll), (gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"expose-event", G_CALLBACK(cb_expose), (gpointer)this);
			
			_visible_count++;

			usleep(10000); // BUG: Embedding too fast sometimes fails with GTK+
		}
	}
	else
	{
		if (plug)
		{
			GB.Post((void (*)())hide_icon, (intptr_t)plug);
			plug = NULL;
			_visible_count--;
		}
	}
}
Ejemplo n.º 13
0
void ControlWidget::setSwitchOffPeriodMn(int mn)
{
    if (!mn)
    {
        SwitchOffTimer();
        refreshOnOff();  // icon on
    }
    else if (mn != m_configSwitchOffPeriodMn && m_timerSwitchOff.isActive())
        m_timerSwitchOff.start(mn * 60000);

    m_configSwitchOffPeriodMn = mn;

    updateTooltip(); // to display timeoff
}
Ejemplo n.º 14
0
void RGBMatrixItem::setDuration(quint32 msec, bool stretch)
{
    if (stretch == true)
    {
        m_matrix->setTotalDuration(msec);
    }
    else
    {
        if (m_function)
            m_function->setDuration(msec);
        prepareGeometryChange();
        calculateWidth();
        updateTooltip();
    }
}
Ejemplo n.º 15
0
void QgsColorSwatchGrid::mouseMoveEvent( QMouseEvent *event )
{
  //calculate box mouse cursor is over
  int newBox = swatchForPosition( event->pos() );

  mDrawBoxDepressed = event->buttons() & Qt::LeftButton;
  if ( newBox != mCurrentHoverBox )
  {
    //only repaint if changes are required
    mCurrentHoverBox = newBox;
    repaint();

    updateTooltip( newBox );
  }

  emit hovered();
}
Ejemplo n.º 16
0
CloudSync::CloudSync()
    : KStatusNotifierItem()
{
    setIconByName("weather-many-clouds");
    setCategory(KStatusNotifierItem::Communications);

    updateTooltip();

    // then, setup our actions
    setupActions();

    contextMenu()->setTitle("CloudSync");

    DirSyncer *syncer = new DirSyncer(Settings::localUrl(), Settings::remoteUrl());
    connect(syncer, SIGNAL(downloading(QString)), this, SLOT(transferring(QString)));
    connect(syncer, SIGNAL(finished(QString)), this, SLOT(finished(QString)));

    syncer->compareDirs();
}
Ejemplo n.º 17
0
bool WSplitter::event(QEvent* pEvent) {
    if (pEvent->type() == QEvent::ToolTip) {
        updateTooltip();
    }
    return QSplitter::event(pEvent);
}
Ejemplo n.º 18
0
void RGBMatrixItem::slotRGBMatrixChanged(quint32)
{
    prepareGeometryChange();
    calculateWidth();
    updateTooltip();
}
Ejemplo n.º 19
0
bool WComboBox::event(QEvent* pEvent) {
    if (pEvent->type() == QEvent::ToolTip) {
        updateTooltip();
    }
    return QComboBox::event(pEvent);
}
Ejemplo n.º 20
0
void EFXItem::slotEFXChanged(quint32)
{
    prepareGeometryChange();
    calculateWidth();
    updateTooltip();
}
Ejemplo n.º 21
0
void EarthquakeItem::setDateTime( const QDateTime &dateTime )
{
    m_dateTime = dateTime;
    updateTooltip();
}
Ejemplo n.º 22
0
bool WLabel::event(QEvent* pEvent) {
    if (pEvent->type() == QEvent::ToolTip) {
        updateTooltip();
    }
    return QLabel::event(pEvent);
}
Ejemplo n.º 23
0
void EarthquakeItem::setDepth( double depth )
{
    m_depth = depth;
    updateTooltip();
}
Ejemplo n.º 24
0
void EarthquakeItem::setMagnitude( double magnitude )
{
    m_magnitude = magnitude;
    setSize( QSize( m_magnitude * 10, m_magnitude * 10 ) );
    updateTooltip();
}
Ejemplo n.º 25
0
bool
HippoCanvas::tryAllocate(bool hscrollbar, bool vscrollbar)
{
    int w = getWidth();
    int h = getHeight();

    // If we get called with something other than the 'forWidth' passed to getHeightRequestImpl()
    // we need to redo that
    if (w != currentWidth_)
        getHeightRequestImpl(w);

    // If we get called with something smaller than our minimum size, just allocate as if we
    // had our minimum size
    if (w < canvasWidthReq_)
        w = canvasWidthReq_;
    if (h < canvasHeightReq_)
        h = canvasHeightReq_;

    // Compute scrollbar sizes
    int vWidth = vscrollbar ? vscroll_->getWidthRequest() : 0;
    int hWidth = hscrollbar ? w - vWidth : 0;
    int hHeight = hscrollbar ? hscroll_->getHeightRequest(hWidth) : 0;
    int vHeight = vscrollbar ? h - hHeight : 0;

    // See if this scrollbar combination is a possibility
    if (!hscrollbar) {
        if (w - vWidth < childWidthReq_)
            return false;
    }
    
    int childHeightRequest = getChildHeightRequest(hscrollbar, vscrollbar);
    if (!vscrollbar) {
        if (h - hHeight < childHeightRequest)
            return false;
    }

    // OK, it's possible

    hscrollNeeded_ = hscrollbar;
    vscrollNeeded_ = vscrollbar;

    // Compute the size we are going to allocate our child
    
    int childWidthAlloc;
    if (hscrollbar)
        childWidthAlloc = MAX(childWidthReq_, w - vWidth);
    else
        childWidthAlloc = w - vWidth;

    int childHeightAlloc;
    if (vscrollbar)
        childHeightAlloc = MAX(childHeightRequest, h - hHeight);
    else
        childHeightAlloc = h - hHeight;
    
#if 0
        g_debug("updating scrollbars %d x %d h=%d v=%d",
        w, h, hscrollNeeded_, vscrollNeeded_);
#endif

    // hide if needed, then resize, then show if needed,
    // means less flashing

    if (!vscrollNeeded_) {
        vscroll_->hide();
    }
    if (!hscrollNeeded_) {
        hscroll_->hide();
    }

    if (vscrollNeeded_) {
        //g_debug("setting size of vscrollbar to %d,%d %dx%d", w - vWidth, 0, vWidth, vHeight);
        vscroll_->setBounds(0, childHeightAlloc, vHeight);
        vscroll_->sizeAllocate(w - vWidth, 0, vWidth, vHeight);
        if (isShowing())
            vscroll_->show(false);
    } else {
        // needs to get an allocation to maintain invariants
        vscroll_->sizeAllocate(0, 0, 0, 0);
    }

    if (hscrollNeeded_) {
        //g_debug("setting size of hscrollbar %d,%d %dx%d", 0, h - hHeight, hWidth, hHeight);
        hscroll_->setBounds(0, childWidthAlloc, hWidth);
        hscroll_->sizeAllocate(0, h - hHeight, hWidth, hHeight);
        if (isShowing())
            hscroll_->show(false);
    } else {
        // needs to get an allocation to maintain invariants
        hscroll_->sizeAllocate(0, 0, 0, 0);
    }
    
    if (root_ != (HippoCanvasItem*) NULL) {
        hippo_canvas_item_allocate(root_, childWidthAlloc, childHeightAlloc, FALSE);
    }

    updateTooltip(false, lastMoveX_, lastMoveY_);

    return true;
}
Ejemplo n.º 26
0
void KeyboardApplet::layoutChanged()
{
    generatePixmap();
    updateTooltip();
    update();
}
Ejemplo n.º 27
0
bool WSpinny::event(QEvent* pEvent) {
    if (pEvent->type() == QEvent::ToolTip) {
        updateTooltip();
    }
    return QGLWidget::event(pEvent);
}
Ejemplo n.º 28
0
void
HippoCanvas::onRootTooltipChanged()
{
    updateTooltip(false, lastMoveX_, lastMoveY_);
}
Ejemplo n.º 29
0
bool WWidgetStack::event(QEvent* pEvent) {
    if (pEvent->type() == QEvent::ToolTip) {
        updateTooltip();
    }
    return QFrame::event(pEvent);
}
Ejemplo n.º 30
0
bool WSearchLineEdit::event(QEvent* pEvent) {
    if (pEvent->type() == QEvent::ToolTip) {
        updateTooltip();
    }
    return QLineEdit::event(pEvent);
}