2
standard Button for winamp Skin
3
Copyright (C) 1999 Martin Vogt
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation.
9
For more information look at the file COPYRIGHT in this package
14
#include <waTitleBar.h>
20
WaTitleBar::WaTitleBar(WaSkinModell* waSkinModell,QWidget* parent,char* name):
23
this->waSkinModell=waSkinModell;
25
titlePixmap=new QPixmap();
26
QSize size=sizeHint();
27
titlePixmap->resize(size.width(),size.height());
28
connect(waSkinModell,SIGNAL(event_WA_SKIN_TITLE()),
29
this,SLOT(pixmapChange()));
30
WaSkinDesc* waSkinDesc=
31
waSkinModell->getWaSkinMapDesc(_WA_MAPPING_TITLE);
32
setGeometry((*waSkinDesc->getGeometry()));
36
WaTitleBar::~WaTitleBar() {
42
QSize WaTitleBar::sizeHint() const {
43
WaSkinDesc* waSkinDesc=
44
waSkinModell->getWaSkinMapDesc(_WA_MAPPING_TITLE);
45
return QSize(waSkinDesc->getWidgetWidth(),waSkinDesc->getWidgetHeight());
49
void WaTitleBar::paintEvent ( QPaintEvent * paintEvent ) {
52
paint.drawPixmap(0,0,*titlePixmap);
56
void WaTitleBar::pixmapChange() {
58
titlePixmap=waSkinModell->get(_WA_SKIN_TITLE);
62
void WaTitleBar::mousePressEvent(QMouseEvent *e)
64
if (e->x() >= 255 && e->x() < 263 && e->y() >= 3 && e->y() < 12)
66
/* cout << "\nShade Clicked\n";
68
QStringList rd = KGlobal::dirs()->findDirs("data", "noatun/winskin/winamp");
69
QStringList::Iterator it = rd.begin();
70
QString filename = (*it).latin1();
71
filename.append("TITLEBAR.BMP");
72
QPixmap titlebarPixmap(filename, QPixmap::imageFormat(filename));
74
p.drawPixmap(255,3, titlebarPixmap, 9, 9, 8, 8);
78
if (e->button()!=RightButton)
82
mDragStart = e->pos();
83
mLastPos = e->globalPos();
90
void WaTitleBar::mouseReleaseEvent(QMouseEvent *e)
92
if (e->button()!=RightButton)
99
void WaTitleBar::mouseMoveEvent(QMouseEvent *e)
101
QPoint diff = e->globalPos() - mLastPos;
102
if ( abs(diff.x()) > 10 || abs(diff.y()) > 10) {
103
// Moving starts only, when passing a drag border
107
if ( moving == true ) {
108
waParent->move( e->globalPos() - mDragStart );