summaryrefslogtreecommitdiffstats
path: root/noatun/modules/winskin/waWidget.cpp
blob: ffe2d3b47426acf8e7d2b7b62586d26643b87403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "waWidget.h"
#include "waSkinModel.h"
#include "noatun/stdaction.h"
#include "waSkin.h"

WaWidget::WaWidget(int _mapping) : QWidget(WaSkin::instance()) {
    mapping = _mapping;
    setBackgroundMode(NoBackground);
    connect (WaSkinModel::instance(), SIGNAL(skinChanged()), this, SLOT(skinChanged()));
}

WaWidget::~WaWidget() {
}

void WaWidget::paintPixmap(int pixmap_mapping) {
    if (pixmap_mapping != -1) 
        WaSkinModel::instance()->bltTo(pixmap_mapping, this, 0, 0);
     else
        WaSkinModel::instance()->paintBackgroundTo(mapping, this, 0, 0);
}

void WaWidget::paintPixmap(int pixmap_mapping, int x, int y) {
    if (pixmap_mapping != -1) 
        WaSkinModel::instance()->bltTo(pixmap_mapping, this, x, y);
     else
        WaSkinModel::instance()->paintBackgroundTo(mapping, this, x, y);
}

void WaWidget::paintPixmap(int pixmap_mapping, int argument) {
    if (pixmap_mapping != -1) 
        WaSkinModel::instance()->bltTo(pixmap_mapping, this, 0, 0, argument);
     else
        WaSkinModel::instance()->paintBackgroundTo(mapping, this, 0, 0);

}

void WaWidget::paintPixmap(int pixmap_mapping, int argument, int x, int y) {
    if (pixmap_mapping != -1) 
        WaSkinModel::instance()->bltTo(pixmap_mapping, this, x, y, argument);
    else
        WaSkinModel::instance()->paintBackgroundTo(mapping, this, x, y);
}

QSize WaWidget::sizeHint() {
    return WaSkinModel::instance()->getMapGeometry(mapping).size();
}

void WaWidget::mousePressEvent(QMouseEvent *e) {
    if (e->button() == RightButton)
        NoatunStdAction::ContextMenu::showContextMenu();
}

void WaWidget::skinChanged() {
    setGeometry(WaSkinModel::instance()->getMapGeometry(mapping));
    update();
}

#include <waWidget.moc>