bool System::handleMouseWheel(int diff) { if(m_exclusiveInputWindow) return m_exclusiveInputWindow->onMouseWheel(diff); m_activateTooltip = false; hideTooltip(m_containsMouse); if(m_rootWindow) { WindowBase* target = m_containsMouse; if(m_captureWindow) { target = m_captureWindow; } if(!target) target = m_rootWindow.get(); while(target) { if(target->onMouseWheel(diff)) return true; target = const_cast<WindowBase*>(target->getParent()); } } return false; }
//------------------------------------------------------------------------ CMessageResult CTooltipSupport::notify (CBaseObject* sender, const char* msg) { if (msg == CVSTGUITimer::kMsgTimer) { if (state == kHiding) { hideTooltip (); timer->stop (); timer->setFireTime (delay); } else if (state == kShowing) { showTooltip (); timer->setFireTime (100); } else if (state == kForceVisible) { state = kVisible; timer->stop (); timer->setFireTime (delay); } return kMessageNotified; } return kMessageUnknown; }
bool System::handleMouseDouble(EventArgs::MouseButtons btn) { if(m_exclusiveInputWindow) return m_exclusiveInputWindow->onMouseDouble(btn); m_activateTooltip = false; hideTooltip(m_containsMouse); if(m_rootWindow) { WindowBase* target = m_containsMouse; if(m_captureWindow) { target = m_captureWindow; } if(!target) target = m_rootWindow.get(); target->rise(); while(target) { if(target->onMouseDouble(btn)) return true; target = const_cast<WindowBase*>(target->getParent()); } } return false; }
bool MarkupText::onMouseLeave(void) { hideTooltip(); m_selectedlnk.reset(); invalidate(); return true; }
void DefaultMapping::mapMouseEvent(MouseEvent * mouseEvent) { if (mouseEvent) { m_currentMousePosition = mouseEvent->pos() * static_cast<int>(m_window->devicePixelRatio()); } if (mouseEvent && mouseEvent->type() == MouseEvent::Type::Press) { switch (mouseEvent->button()) { case MouseButtonMiddle: m_navigation->reset(); break; case MouseButtonLeft: m_navigation->panBegin(m_currentMousePosition); break; case MouseButtonRight: m_navigation->rotateBegin(m_currentMousePosition); break; default: break; } } else if (mouseEvent && mouseEvent->type() == MouseEvent::Type::Move) { if (m_metaInformationCapability) { hideTooltip(); m_timer->start(); } switch (m_navigation->mode()) { case WorldInHandNavigation::InteractionMode::PanInteraction: m_navigation->panProcess(m_currentMousePosition); break; case WorldInHandNavigation::InteractionMode::RotateInteraction: m_navigation->rotateProcess(m_currentMousePosition); break; default: break; } } else if (mouseEvent && mouseEvent->type() == MouseEvent::Type::Release) { switch (mouseEvent->button()) { case MouseButtonLeft: m_navigation->panEnd(); break; case MouseButtonRight: m_navigation->rotateEnd(); break; default: break; } } }
void Creature::hide() { leave(); hideTooltip(); if (_model) _model->hide(); }
void Creature::highlight(bool enabled) { if (_model) _model->drawBound(enabled); if (enabled) showFeedbackTooltip(); else hideTooltip(); }
//------------------------------------------------------------------------ void CTooltipSupport::onMouseDown (CFrame* frame, const CPoint& where) { if (state != kHidden) { timer->stop (); timer->setFireTime (delay); hideTooltip (); } }
void Placeable::highlight(bool enabled) { if (_model) _model->drawBound(enabled); if (enabled) showTooltip(); else hideTooltip(); }
bool Object::showFeedbackTooltip() { hideTooltip(); if (!createFeedbackTooltip()) return false; _tooltip->show(Tooltip::getDefaultDelay()); return true; }
void Placeable::hide() { leave(); hideTooltip(); delete _tooltip; _tooltip = 0; Situated::hide(); }
bool System::handleMouseButton(EventArgs::MouseButtons btn, EventArgs::ButtonState state) { if(m_exclusiveInputWindow) return m_exclusiveInputWindow->onMouseButton(btn, state); m_activateTooltip = false; hideTooltip(m_containsMouse); if (!m_rootWindow) return false; WindowBase* target = m_captureWindow ? m_captureWindow : m_containsMouse; if(!target) target = m_rootWindow.get(); if(m_focusWindow != target) { auto focusWnd = target->isTabStop() ? target : NULL; queryInputFocus(focusWnd); } // Drag'n'Drop support if(btn == EventArgs::Left && !m_dragfired) { if(target != m_rootWindow.get() && target != m_captureWindow) { if(target->isDraggable() && state == EventArgs::Down) { m_dragfired = false; m_dragOffset = m_cursor.getPosition(); m_dragWindow = target; m_dragging = true; } } if(state == EventArgs::Up && m_dragging) { m_dragging = false; } } target->rise(); if(target != m_menuWindow.get()) getMenu()->reset(); while(target) { if(target->onMouseButton(btn, state)) return true; target = const_cast<WindowBase*>(target->getParent()); } return false; }
bool Object::showSpeechTooltip(const Common::UString &line) { hideTooltip(); if (!createSpeechTooltip(line)) return false; // Show the speech bubble immediately, for 12s (two rounds) _tooltip->show(0, 12000); return true; }
bool TreeViewTooltips::on_motion_event(GdkEventMotion* ev) { Gtk::TreeModel::Path path; Gtk::TreeViewColumn* column; int cell_x, cell_y; if ( m_buddyview->get_path_at_pos((int) ev->x, (int) ev->y, path, column, cell_x, cell_y) ) { hideTooltip(); return 0; } }
void System::tick(float delta) { m_inTick = true; std::vector<WindowBase*>::iterator i = m_tickedWnd.begin(); std::vector<WindowBase*>::iterator end = m_tickedWnd.end(); std::vector<WindowBase*>::size_type subscribeTickWndSize = m_subscribeTickWnd.size(); while(i != end) { WindowBase* wnd = (*i); if(wnd) wnd->onTick(delta); ++i; } if(m_tickClear) { m_tickedWnd.erase(std::remove_if(m_tickedWnd.begin(), end, tickClear()), end); m_tickClear = false; } if(subscribeTickWndSize) { std::vector<WindowBase*>::size_type tickedWndSize = m_tickedWnd.size(); m_tickedWnd.resize(tickedWndSize + subscribeTickWndSize); std::copy(m_subscribeTickWnd.begin(), m_subscribeTickWnd.end(), m_tickedWnd.begin() + tickedWndSize); m_subscribeTickWnd.clear(); } if(m_activateTooltip) { m_tttime += delta; if(m_tttime >= m_ttdelay) { m_tttime = 0.f; m_activateTooltip = false; showTooltip(m_containsMouse); } } if(m_tooltipWindow->getVisible() && m_ttlifetime > 1.f) { m_tttime += delta; if(m_tttime >= m_ttlifetime) { hideTooltip(m_containsMouse); } } m_inTick = false; }
bool MarkupText::onMouseMove(void) { m_pt = transformToWndCoord(m_system.getCursor().getPosition()); m_pt -= m_area.getPosition(); bool linkhit = false; if(m_selectedlnk) { linkhit = isHitChunk<LinkArea>(m_selectedlnk.get(), m_pt); if(!linkhit) { setHovered(m_selectedlnk.get(), false); m_selectedlnk.reset(); invalidate(); } } if(!m_selectedlnk) { std::vector<PLinkArea>::iterator ilink = std::find_if(m_links.begin(), m_links.end(), hovertester<LinkArea>(m_pt, *this)); if(ilink != m_links.end()) { m_selectedlnk = (*ilink); setHovered(m_selectedlnk.get(), true); invalidate(); } } if(m_selectedtt) { bool hit = isHitChunk<TooltipArea>(m_selectedtt.get(), m_pt); if(hit) return true; else { hideTooltip(); } } std::vector<PTooltipArea>::iterator itt = std::find_if(m_tooltips.begin(), m_tooltips.end(), hovertester<TooltipArea>(m_pt, *this)); if(itt != m_tooltips.end()) { showTooltip(*itt); } return MarkupBase::onMouseMove(); }
void DefaultMapping::showTooltip() { if (!m_metaInformationCapability) { return; } hideTooltip(); m_window->makeCurrent(); int id = gloperate::ObjectIdExtractor(m_viewportCapability, m_typedRenderTargetCapability).get(m_currentMousePosition); m_window->doneCurrent(); const std::string & string = m_metaInformationCapability->get(id); if (string.empty()) { return; } QToolTip::showText(m_window->mapToGlobal(QPoint(m_currentMousePosition.x, m_currentMousePosition.y)), QString::fromStdString(string)); }
//------------------------------------------------------------------------ void CTooltipSupport::onMouseExited (CView* view, CFrame* frame) { if (currentView) { if (state == kHidden || state == kShowing) { hideTooltip (); timer->stop (); timer->setFireTime (delay); } else { state = kHiding; timer->setFireTime (200); timer->start (); } currentView = 0; #if DEBUGLOG DebugPrint ("CTooltipSupport::onMouseExited (%s)\n", view->getClassName ()); #endif } }
void Object::destroyTooltip() { hideTooltip(); delete _tooltip; _tooltip = 0; }
bool TreeViewTooltips::on_leave_event(GdkEventCrossing* ev) { hideTooltip(); return 0; }
bool System::handleMouseMove(int x, int y) { if(m_exclusiveInputWindow) return m_exclusiveInputWindow->onMouseMove(); const point pt((float)x, (float)y); m_cursor.setPosition(pt); if(m_rootWindow) { if(m_dragging && m_dragWindow != 0) { // молча снимаем capture поскольку в данной ситуации оно лишнее if(m_captureWindow) m_captureWindow = 0; if(!m_dragfired) { point t = m_cursor.getPosition() - m_dragOffset; if(sqrt(t.x*t.x + t.y*t.y) > m_dragThreshold) { point off = m_dragWindow->transformToWndCoord(m_dragOffset); off -= m_dragWindow->getPosition(); if(!startDrag(m_dragWindow, off)) { m_dragging = false; m_dragWindow = 0; } } } } WindowBase* mouseWnd = getTargetWindow(m_cursor.getPosition()); if(m_dragfired) { getDragContainer()->update(mouseWnd, m_cursor.getPosition()); } if((mouseWnd != m_containsMouse) && !m_captureWindow) { // кем является новое окно по отношению к текущему //bool isChild = mouseWnd ? mouseWnd->isChildrenOf(m_containsMouse) : false; //bool isParent = m_containsMouse ? m_containsMouse->isChildrenOf(mouseWnd) : false; m_activateTooltip = false; if(m_containsMouse) { hideTooltip(m_containsMouse); //if(!isChild) m_containsMouse->onMouseLeave(); } m_containsMouse = mouseWnd; if(m_containsMouse) { if(m_containsMouse->hasTooltip()) { m_activateTooltip = true; m_tttime = 0.f; } //if(!isParent) m_containsMouse->onMouseEnter(); } } WindowBase* target = m_containsMouse; if(m_captureWindow) { target = m_captureWindow; } if(!target) target = m_rootWindow.get(); while(target) { if(target->onMouseMove()) return true; target = const_cast<WindowBase*>(target->getParent()); } } return false; }