diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /khotkeys/kcontrol/gesturerecorder.cpp | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'khotkeys/kcontrol/gesturerecorder.cpp')
-rw-r--r-- | khotkeys/kcontrol/gesturerecorder.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/khotkeys/kcontrol/gesturerecorder.cpp b/khotkeys/kcontrol/gesturerecorder.cpp new file mode 100644 index 000000000..d14614c77 --- /dev/null +++ b/khotkeys/kcontrol/gesturerecorder.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** + + KHotKeys + + Copyright (C) 2003 Mike Pilone <mpilone@slac.com> + Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> + + Distributed under the terms of the GNU General Public License version 2. + +****************************************************************************/ + +#include <qcolor.h> +#include <qevent.h> + +#include "gesturerecorder.h" + +namespace KHotKeys +{ + +GestureRecorder::GestureRecorder(QWidget *parent, const char *name) + : QFrame(parent, name), _mouseButtonDown(false) + { + setBackgroundColor( colorGroup().base()); + setFrameStyle(QFrame::Sunken | QFrame::Panel); + setLineWidth(2); + setMidLineWidth(0); + } + +GestureRecorder::~GestureRecorder() + { + } + +void GestureRecorder::mousePressEvent(QMouseEvent *ev) + { + if (ev->button() == QMouseEvent::LeftButton) + { + _mouseButtonDown = true; + stroke.reset(); + QPoint pos = ev->pos(); + stroke.record(pos.x(), pos.y()); + } + } + +void GestureRecorder::mouseReleaseEvent(QMouseEvent *ev) + { + if ((ev->button() == QMouseEvent::LeftButton) && (_mouseButtonDown)) + { + QPoint pos = ev->pos(); + stroke.record(pos.x(), pos.y()); + QString data( stroke.translate()); + if( !data.isEmpty()) + emit recorded(data); + } + } + +void GestureRecorder::mouseMoveEvent(QMouseEvent *ev) + { + if (_mouseButtonDown) + { + QPoint pos = ev->pos(); + stroke.record(pos.x(), pos.y()); + } + } + +} // namespace KHotKeys + +#include "gesturerecorder.moc" |