//############################################################################################################## //# Description: Method to handle mouse clicks //# Comment: Delegate of QWidget::mousePressEvent and QWidget::mouseReleaseEvent (see below) //# Authors: Martin Schaller (04/2008) //############################################################################################################## void RenderArea::mouseEvent(int pressed, QMouseEvent *event) { struct point p; p.x=event->x(); p.y=event->y(); switch (event->button()) { case Qt::LeftButton: callback_list_call_attr_3(this->cbl, attr_button, (void *)pressed, (void *)1, (void *)&p); break; case Qt::MidButton: callback_list_call_attr_3(this->cbl, attr_button, (void *)pressed, (void *)2, (void *)&p); break; case Qt::RightButton: callback_list_call_attr_3(this->cbl, attr_button, (void *)pressed, (void *)3, (void *)&p); break; default: break; } }
//############################################################################################################## //# Description: Qt Event :: Zoom in/out with the mouse's scrollwheel //# Comment: //# Authors: Stefan Klumpp (04/2008) //############################################################################################################## void RenderArea::wheelEvent(QWheelEvent *event) { struct point p; int button; p.x=event->x(); // xy-coordinates of the mouse pointer p.y=event->y(); if (event->delta() > 0) // wheel movement away from the person button=4; else if (event->delta() < 0) // wheel movement towards the person button=5; else button=-1; if (button != -1) { callback_list_call_attr_3(this->cbl, attr_button, (void *)1, (void *)button, (void *)&p); callback_list_call_attr_3(this->cbl, attr_button, (void *)0, (void *)button, (void *)&p); } event->accept(); }
static void HandleButtonClick( struct graphics_priv *gra_priv, int updown, int button, long lParam ) { struct point pt = { LOWORD(lParam), HIWORD(lParam) }; callback_list_call_attr_3(gra_priv->cbl, attr_button, (void *)updown, (void *)button, (void *)&pt); }