• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Plasma

scrollbar.cpp

Go to the documentation of this file.
00001 /*
00002  *   Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
00003  *   Copyright © 2008 Marco Martin <notmart@gmail.com>
00004  *
00005  *   This program is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU Library General Public License as
00007  *   published by the Free Software Foundation; either version 2, or
00008  *   (at your option) any later version.
00009  *
00010  *   This program is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details
00014  *
00015  *   You should have received a copy of the GNU Library General Public
00016  *   License along with this program; if not, write to the
00017  *   Free Software Foundation, Inc.,
00018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
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>

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal