summaryrefslogtreecommitdiffstats
path: root/noatun/modules/winskin/waJumpSlider.cpp
blob: 5163330005a51414844bb7762c4a2fc0884614de (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
  jumpslider for winamp skins
  Copyright (C) 1998  Martin Vogt

  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 "waJumpSlider.h"

WaJumpSlider::WaJumpSlider() : WaWidget(_WA_MAPPING_POS_BAR)
{
}

WaJumpSlider::~WaJumpSlider()
{
}

void WaJumpSlider::buildGui()
{
    ws = new WaSlider(_WA_MAPPING_POS_BAR, _WA_MAPPING_POS_BAR_SLIDER);
    ws->setPixmapSliderButtonUp(_WA_SKIN_POS_BAR_SLIDER_NORM);
    ws->setPixmapSliderButtonDown(_WA_SKIN_POS_BAR_SLIDER_PRES);
    ws->setPixmapSliderBar(_WA_SKIN_POS_BAR);
    ws->setRange(0, 100);
    ws->setValue(0);

    connect(ws, SIGNAL(sliderPressed()), this, SIGNAL(sliderPressed()));
    connect(ws, SIGNAL(sliderReleased()), this, SLOT(releasedSlider()));
    connect(ws, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));
}

void WaJumpSlider::setJumpRange(int val)
{
    if (val == -1)
        ws->hideButton();
    else {
        ws->showButton();
        ws->setRange(0, val);
    }
}

int WaJumpSlider::jumpValue() {
    return ws->value();
}

void WaJumpSlider::setJumpValue(int val)
{
    int currVal = ws->value();

    if (currVal != val) {
	ws->setValue(val);
    }
}

void WaJumpSlider::releasedSlider() {
    emit(jump(ws->value()));
    emit(sliderReleased());
}

void WaJumpSlider::showEvent (QShowEvent *) {
    ws->show();
}

void WaJumpSlider::hideEvent (QHideEvent *) {
    ws->hide();
}

void WaJumpSlider::cancelDrag() {
    ws->cancelDrag();
}

#include "waJumpSlider.moc"