summaryrefslogtreecommitdiffstats
path: root/noatun/modules/winskin/waJumpSlider.cpp
blob: f38fc3c3c3cdb7c02eb008725e82cf5c96d5d15c (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, TQ_SIGNAL(sliderPressed()), this, TQ_SIGNAL(sliderPressed()));
    connect(ws, TQ_SIGNAL(sliderReleased()), this, TQ_SLOT(releasedSlider()));
    connect(ws, TQ_SIGNAL(valueChanged(int)), this, TQ_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 (TQShowEvent *) {
    ws->show();
}

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

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

#include "waJumpSlider.moc"