#include "DragWidget.h" DragWidget::DragWidget(TQWidget *parent, const char *name, WFlags f) : TQWidget(parent,name,f) { dragP=TQPoint(0,0); drag=false; locked=false; } DragWidget::~DragWidget() { } void DragWidget::mousePressEvent(TQMouseEvent *e) { dragP=e->pos(); gpress=e->globalPos(); if (locked) { return; } drag=true; } void DragWidget::mouseReleaseEvent(TQMouseEvent *) { drag=false; } void DragWidget::mouseMoveEvent(TQMouseEvent *e) { if (!drag) { return; } TQPoint curr(e->globalPos().x()-dragP.x(),e->globalPos().y()-dragP.y()); TQWidget::move(curr); } void DragWidget::setLocked(bool mode) { locked=mode; } const bool DragWidget::isLocked() const { return locked; } #include "DragWidget.moc"