You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kvkbd/src/DragWidget.cpp

37 lines
574 B

#include "DragWidget.h"
DragWidget::DragWidget(TQWidget *parent, const char *name, WFlags f) : TQWidget(parent,name,f)
{
dragP=TQPoint(0,0);
drag=false;
}
DragWidget::~DragWidget()
{
}
void DragWidget::mousePressEvent(TQMouseEvent *e)
{
dragP=e->pos();
gpress=e->globalPos();
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);
}
#include "DragWidget.moc"