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 | e2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch) | |
tree | 9047cf9e6b5c43878d5bf82660adae77ceee097a /noatun/modules/winskin/waTitleBar.cpp | |
download | tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.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/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun/modules/winskin/waTitleBar.cpp')
-rw-r--r-- | noatun/modules/winskin/waTitleBar.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/noatun/modules/winskin/waTitleBar.cpp b/noatun/modules/winskin/waTitleBar.cpp new file mode 100644 index 00000000..82b603f5 --- /dev/null +++ b/noatun/modules/winskin/waTitleBar.cpp @@ -0,0 +1,79 @@ +/* + Titlebar for winamp Skin + Copyright (C) 1999 Martin Vogt + Copyright (C) 2001 Ryan Cumming + + 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. + + For more information look at the file COPYRIGHT in this package + + */ + + +#include <qwidget.h> +#include <qpixmap.h> + +#include "waTitleBar.h" +#include "waSkinModel.h" + +#include <stdlib.h> + +#include <iostream> + +WaTitleBar::WaTitleBar() : WaIndicator(_WA_MAPPING_TITLE, _WA_SKIN_TITLE_ACTIVE, _WA_SKIN_TITLE_INACTIVE) +{ + moving = false; + setState(parentWidget()->isActiveWindow()); +} + +WaTitleBar::~WaTitleBar() +{ +} + +void WaTitleBar::mousePressEvent(QMouseEvent * e) +{ + if (e->button() != RightButton) { + if (!moving) { + moving = true; + mDragStart = e->pos(); + mLastPos = e->globalPos(); + } + + setState(true); + update(); + return; + } + else + WaWidget::mousePressEvent(e); +} + +void WaTitleBar::mouseDoubleClickEvent(QMouseEvent *) { + emit(shaded()); +} + +void WaTitleBar::mouseReleaseEvent(QMouseEvent * e) +{ + if (e->button() != RightButton) { + moving = false; + update(); + return; + } + else + WaWidget::mouseReleaseEvent(e); +} + +void WaTitleBar::mouseMoveEvent(QMouseEvent * e) +{ + QPoint diff = e->globalPos() - mLastPos; + if (abs(diff.x()) > 10 || abs(diff.y()) > 10) { + // Moving starts only, when passing a drag border + moving = true; + } + + if (moving) + parentWidget()->move(e->globalPos() - mDragStart); +} + +#include <waTitleBar.moc> |