2008-08-13 16:47:27 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
|
2008-10-12 03:31:54 +02:00
|
|
|
* Copyright © 2008 Marco Martin <notmart@gmail.com>
|
2008-08-13 16:47:27 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2008-08-24 13:55:39 +02:00
|
|
|
#ifndef PLASMA_SCROLLBAR_H
|
|
|
|
#define PLASMA_SCROLLBAR_H
|
|
|
|
|
2008-08-15 14:16:18 +02:00
|
|
|
#include <QtGui/QScrollBar>
|
|
|
|
#include <QtGui/QGraphicsProxyWidget>
|
2008-08-13 16:47:27 +02:00
|
|
|
|
|
|
|
#include <plasma/plasma_export.h>
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2008-08-24 14:24:36 +02:00
|
|
|
/**
|
2008-08-25 19:47:48 +02:00
|
|
|
* @class ScrollBar plasma/widgets/scrollbar.h <Plasma/Widgets/ScrollBar>
|
|
|
|
*
|
|
|
|
* @short Provides a plasma-themed QScrollBar.
|
2008-08-24 14:24:36 +02:00
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
class PLASMA_EXPORT ScrollBar : public QGraphicsProxyWidget
|
|
|
|
{
|
2008-08-24 14:24:36 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
|
|
|
|
Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep)
|
|
|
|
Q_PROPERTY(int value READ value WRITE setValue)
|
|
|
|
Q_PROPERTY(int minimum READ minimum)
|
|
|
|
Q_PROPERTY(int maximum READ maximum)
|
|
|
|
Q_PROPERTY(QString stylesheet READ styleSheet WRITE setStyleSheet)
|
2008-10-12 03:31:54 +02:00
|
|
|
Q_PROPERTY(QScrollBar *nativeWidget READ nativeWidget)
|
2008-08-24 14:24:36 +02:00
|
|
|
|
2008-08-13 16:47:27 +02:00
|
|
|
public:
|
|
|
|
explicit ScrollBar(Qt::Orientation orientation, QGraphicsWidget *parent);
|
|
|
|
~ScrollBar();
|
|
|
|
|
2008-08-24 14:24:36 +02:00
|
|
|
/**
|
|
|
|
* Sets the scrollbar minimum and maximum values
|
|
|
|
* @arg min minimum value
|
|
|
|
* @arg max maximum value
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
void setRange(int min, int max);
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the amount of the single step
|
|
|
|
* i.e how much the slider will move when the user press an arrow button
|
|
|
|
* @arg val
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
void setSingleStep(int val);
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the amount of the single step
|
|
|
|
*/
|
|
|
|
int singleStep();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the amount the slider will scroll when the user press page up or page down
|
|
|
|
* @arg val
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
void setPageStep(int val);
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the amount of the page step
|
|
|
|
*/
|
|
|
|
int pageStep();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the current value for the ScrollBar
|
|
|
|
* @arg value must be minimum() <= value <= maximum()
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
void setValue(int val);
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the current scrollbar value
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
int value() const;
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the minimum value bound of this ScrollBar
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
int minimum() const;
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the maximum value bound of this ScrollBar
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
int maximum() const;
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the stylesheet used to control the visual display of this ScrollBar
|
|
|
|
*
|
|
|
|
* @arg stylesheet a CSS string
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
void setStyleSheet(const QString &stylesheet);
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the stylesheet currently used with this widget
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
QString styleSheet();
|
2008-08-24 14:24:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the native widget wrapped by this ScrollBar
|
|
|
|
*/
|
2008-08-13 16:47:27 +02:00
|
|
|
QScrollBar *nativeWidget() const;
|
|
|
|
};
|
|
|
|
|
2008-08-13 22:24:37 +02:00
|
|
|
}
|
2008-08-24 13:55:39 +02:00
|
|
|
|
|
|
|
#endif
|