summaryrefslogtreecommitdiffstats
path: root/juk/slideraction.h
blob: 1c38c0a5868727d8c8f6a72e27981cc29967e867 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/***************************************************************************
    begin                : Wed Feb 6 2002
    copyright            : (C) 2002 - 2004 by Scott Wheeler
    email                : [email protected]
***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef SLIDERACTION_H
#define SLIDERACTION_H

#include <tdeaction.h>
#include <tqslider.h>

class TQBoxLayout;
class TQDockWindow;

class VolumeSlider : public TQSlider
{
    Q_OBJECT
  

public:
    VolumeSlider(Qt::Orientation o, TQWidget *parent, const char *name);

    int volume() const;
    void setVolume(int value);

    void setOrientation(Qt::Orientation o);

signals:
    void signalVolumeChanged(int value);

protected:
    virtual void wheelEvent(TQWheelEvent *e);
    virtual void focusInEvent(TQFocusEvent *);

private slots:
    void slotValueChanged(int value);
};

class SliderAction : public TDEAction
{
    Q_OBJECT
  

public:
    SliderAction(const TQString &text, TQObject *parent, const char *name);
    virtual ~SliderAction();

    VolumeSlider *volumeSlider() const { return m_volumeSlider; }
    TQSlider *trackPositionSlider() const { return m_trackPositionSlider; }

    bool dragging() const { return m_dragging; }
    bool volumeDragging() const { return m_volumeDragging; }

    virtual int plug(TQWidget *parent, int index = -1);
    virtual void unplug(TQWidget *widget);

    static const int minPosition;
    static const int maxPosition;

public slots:
    void slotUpdateOrientation();

signals:
    void signalPositionChanged(int position);
    void signalVolumeChanged(int volume);

private:
    TQWidget *createWidget(TQWidget *parent);

private slots:
    void slotUpdateSize();
    void slotVolumeSliderPressed();
    void slotVolumeSliderReleased();
    void slotSliderPressed();
    void slotSliderReleased();
    void slotToolbarDestroyed();

private:
    TDEToolBar *m_toolBar;
    TQBoxLayout *m_layout;
    TQSlider *m_trackPositionSlider;
    VolumeSlider *m_volumeSlider;
    bool m_dragging;
    bool m_volumeDragging;

    static const int volumeMax = 50;
};

#endif