Plasma
scrollbar.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "scrollbar.h"
00022
00023 #include <plasma/private/style_p.h>
00024
00025 namespace Plasma
00026 {
00027
00028 class ScrollBarPrivate
00029 {
00030 public:
00031 Plasma::Style::Ptr style;
00032 };
00033
00034 ScrollBar::ScrollBar(QGraphicsWidget *parent)
00035 : QGraphicsProxyWidget(parent),
00036 d(new ScrollBarPrivate)
00037 {
00038 QScrollBar *scrollbar = new QScrollBar();
00039 scrollbar->setAttribute(Qt::WA_NoSystemBackground);
00040 setWidget(scrollbar);
00041 d->style = Plasma::Style::sharedStyle();
00042 scrollbar->setStyle(d->style.data());
00043
00044 scrollbar->resize(scrollbar->sizeHint());
00045 connect(scrollbar, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));
00046 }
00047
00048 ScrollBar::~ScrollBar()
00049 {
00050 delete d;
00051 Plasma::Style::doneWithSharedStyle();
00052 }
00053
00054 void ScrollBar::setRange(int min, int max)
00055 {
00056 static_cast<QScrollBar*>(widget())->setRange(min, max);
00057 }
00058
00059 void ScrollBar::setSingleStep(int val)
00060 {
00061 static_cast<QScrollBar*>(widget())->setSingleStep(val);
00062 }
00063
00064 int ScrollBar::singleStep()
00065 {
00066 return static_cast<QScrollBar*>(widget())->singleStep();
00067 }
00068
00069 void ScrollBar::setPageStep(int val)
00070 {
00071 static_cast<QScrollBar*>(widget())->setPageStep(val);
00072 }
00073
00074 int ScrollBar::pageStep()
00075 {
00076 return static_cast<QScrollBar*>(widget())->pageStep();
00077 }
00078
00079 void ScrollBar::setValue(int val)
00080 {
00081 static_cast<QScrollBar*>(widget())->setValue(val);
00082 }
00083
00084 int ScrollBar::value() const
00085 {
00086 return static_cast<QScrollBar*>(widget())->value();
00087 }
00088
00089 int ScrollBar::minimum() const
00090 {
00091 return static_cast<QScrollBar*>(widget())->minimum();
00092 }
00093
00094 int ScrollBar::maximum() const
00095 {
00096 return static_cast<QScrollBar*>(widget())->maximum();
00097 }
00098
00099 void ScrollBar::setStyleSheet(const QString &stylesheet)
00100 {
00101 widget()->setStyleSheet(stylesheet);
00102 }
00103
00104 QString ScrollBar::styleSheet()
00105 {
00106 return widget()->styleSheet();
00107 }
00108
00109 QScrollBar *ScrollBar::nativeWidget() const
00110 {
00111 return static_cast<QScrollBar *>(widget());
00112 }
00113
00114 void ScrollBar::setOrientation(Qt::Orientation orientation)
00115 {
00116 QScrollBar *native = static_cast<QScrollBar *>(widget());
00117 native->setOrientation(orientation);
00118 resize(native->sizeHint());
00119 }
00120
00121 }
00122
00123 #include <scrollbar.moc>