summaryrefslogtreecommitdiffstats
path: root/kicker-applets/mediacontrol/mcslider.cpp
blob: 49e29b0df87b46689194990cbe0e020e09165b4d (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
/***************************************************************************
                          mcslider.cpp  -  description
                             -------------------
    begin                : 20040410
    copyright            : (C) 2004 by Teemu Rytilahti
    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.                                   *
 *                                                                         *
 ***************************************************************************/

#include <tqpixmap.h>

#include "mcslider.h"

MCSlider::MCSlider( TQt::Orientation orientation, TQWidget *parent, const char *name )
	 : TQSlider( orientation, parent, name )
{
    setBackgroundOrigin(WidgetOrigin);
    setBackground();
}

MCSlider::~MCSlider()
{
}

// This is needed because TDEStyle draws slider background incorrectly.

void MCSlider::setBackground()
{
    unsetPalette();
    
    if (parentWidget()->paletteBackgroundPixmap())
    {
        TQPixmap pm(width(), height());
        pm.fill(parentWidget(), pos());
        setPaletteBackgroundPixmap(pm);
    }
}

void MCSlider::wheelEvent(TQWheelEvent *e)
{
	if (e->orientation() ==TQt::Horizontal)
		return;

	if (e->state() == ShiftButton)
	{
		if (e->delta() > 0)
			emit volumeUp();
		else
			emit volumeDown();
		e->accept();
	}
	else
	{
		TQSlider::wheelEvent(e);
	}
}

#include "mcslider.moc"