/*************************************************************************** * Copyright (C) 2005 by David Saxton * * david@bluehaze.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "eventinfo.h" #include "itemdocument.h" #include "itemview.h" EventInfo::EventInfo() { reset(); } EventInfo::EventInfo( ItemView *itemView, TQEvent *e ) { Q_UNUSED(itemView); Q_UNUSED(e); reset(); } EventInfo::EventInfo( ItemView *itemView, TQMouseEvent *e ) { pos = e->pos()/itemView->zoomLevel(); globalPos = e->globalPos(); isRightClick = e->button() == Qt::RightButton; ctrlPressed = e->state() & TQt::ControlButton; shiftPressed = e->state() & TQt::ShiftButton; altPressed = e->state() & TQt::AltButton; if ( ItemDocument * id = dynamic_cast(itemView->document()) ) qcanvasItemClickedOn = id->itemAtTop(pos); itemRtti = qcanvasItemClickedOn ? qcanvasItemClickedOn->rtti() : ItemDocument::RTTI::None; scrollDelta = 0; scrollOrientation = Qt::Vertical; } EventInfo::EventInfo( ItemView *itemView, TQWheelEvent *e ) { pos = e->pos()/itemView->zoomLevel(); globalPos = e->globalPos(); isRightClick = false; ctrlPressed = e->state() & TQt::ControlButton; shiftPressed = e->state() & TQt::ShiftButton; altPressed = e->state() & TQt::AltButton; if ( ItemDocument * id = dynamic_cast(itemView->document()) ) qcanvasItemClickedOn = id->itemAtTop(pos); itemRtti = qcanvasItemClickedOn ? qcanvasItemClickedOn->rtti() : ItemDocument::RTTI::None; scrollDelta = e->delta(); scrollOrientation = e->orientation(); // kdDebug() << "scrollOrientation="<