/** * Verarbeitung eines Mausereignisses. * Durch Bewegung der Maus bei gedrueckter Maustaste kann die aktuelle * Zeichenfarbe beeinflusst werden. * Falls Debugging aktiviert ist, wird jedes Mausereignis auf stdout * ausgegeben. * @param x x-Position des Mauszeigers zum Zeitpunkt der Ereignisausloesung. * @param y y-Position des Mauszeigers zum Zeitpunkt der Ereignisausloesung. * @param eventType Typ des Ereignisses. * @param button ausloesende Maustaste (nur bei Ereignissen vom Typ mouseButton). * @param buttonState Status der Maustaste (nur bei Ereignissen vom Typ mouseButton). */ static void handleMouseEvent (int x, int y, CGMouseEventType eventType, int button, int buttonState) { switch (eventType) { case mouseButton: switch (button) { case GLUT_LEFT_BUTTON: setMouseEvent(MOVE,x,y); break; case GLUT_RIGHT_BUTTON: setMouseEvent(ZOOM,x,y); break; } break; } if (buttonState) setMouseEvent(NONE,x,y); }
/** * Handler for mouse double click events. * The current association or widget is set (if any), and events are * delivered to the specific methods, depending on where the cursor was pressed. * After delivering the events, the current association or widget is cleaned. * * @param ome The received event. */ void ToolBarState::mouseDoubleClick(UMLSceneMouseEvent* ome) { setMouseEvent(ome, QEvent::MouseButtonDblClick); UMLWidget* currentWidget = m_pUMLScene->widgetAt(m_pMouseEvent->pos()); AssociationWidget* currentAssociation = getAssociationAt(m_pMouseEvent->pos()); if (currentWidget) { setCurrentWidget(currentWidget); mouseDoubleClickWidget(); setCurrentWidget(0); } else if (currentAssociation) { setCurrentAssociation(currentAssociation); mouseDoubleClickAssociation(); setCurrentAssociation(0); } else { mouseDoubleClickEmpty(); } }
/** * Handler for mouse release events. * Mouse tracking is disabled and the position of the cursor set. * The events are delivered to the specific methods, depending on where the * cursor was released, and the current association or widget cleaned. * Finally, the current tool is changed if needed. * * @param ome The received event. */ void ToolBarState::mouseRelease(UMLSceneMouseEvent* ome) { setMouseEvent(ome, QEvent::MouseButtonRelease); // Set the position of the mouse // TODO, should only be available in this state? m_pUMLScene->setPos(m_pMouseEvent->pos()); m_pUMLScene->viewport()->setMouseTracking(false); if (getCurrentWidget()) { mouseReleaseWidget(); setCurrentWidget(0); } else if (getCurrentAssociation()) { mouseReleaseAssociation(); setCurrentAssociation(0); } else { mouseReleaseEmpty(); } // Default, rightbutton changes the tool. // The arrow tool overrides the changeTool() function. changeTool(); }