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

KDEUI

kselector.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1997 Martin Jones (mjones@kde.org)
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 //-----------------------------------------------------------------------------
00020 // Selector widgets for KDE Color Selector, but probably useful for other
00021 // stuff also.
00022 
00023 #ifndef KSELECTOR_H
00024 #define KSELECTOR_H
00025 
00026 #include <kdeui_export.h>
00027 
00028 #include <QtGui/QAbstractSlider>
00029 #include <QtGui/QWidget>
00030 
00040 class KDEUI_EXPORT KSelector : public QAbstractSlider
00041 {
00042   Q_OBJECT
00043   Q_PROPERTY( int value READ value WRITE setValue )
00044   Q_PROPERTY( int minValue READ minimum WRITE setMinimum )
00045   Q_PROPERTY( int maxValue READ maximum WRITE setMaximum )
00046 public:
00047 
00051   explicit KSelector( QWidget *parent=0 );
00056   explicit KSelector( Qt::Orientation o, QWidget *parent = 0 );
00057   /*
00058    * Destructs the widget.
00059    */
00060   ~KSelector();
00061 
00065   QRect contentsRect() const;
00066 
00071   void setIndent( bool i );
00072 
00076   bool indent() const;
00077 
00081   void setArrowDirection( Qt::ArrowType direction );
00082 
00086   Qt::ArrowType arrowDirection() const;
00087 
00088 protected:
00095   virtual void drawContents( QPainter * );
00100   virtual void drawArrow( QPainter *painter, const QPoint &pos );
00101 
00102   virtual void paintEvent( QPaintEvent * );
00103   virtual void mousePressEvent( QMouseEvent *e );
00104   virtual void mouseMoveEvent( QMouseEvent *e );
00105   virtual void mouseReleaseEvent( QMouseEvent *e );
00106   virtual void wheelEvent( QWheelEvent * );
00107 
00108 private:
00109   QPoint calcArrowPos( int val );
00110   void moveArrow( const QPoint &pos );
00111 
00112 private:
00113   class Private;
00114   friend class Private;
00115   Private * const d;
00116   
00117   Q_DISABLE_COPY(KSelector)
00118 };
00119 
00120 
00129 class KDEUI_EXPORT KGradientSelector : public KSelector
00130 {
00131   Q_OBJECT
00132 
00133   Q_PROPERTY( QColor firstColor READ firstColor WRITE setFirstColor )
00134   Q_PROPERTY( QColor secondColor READ secondColor WRITE setSecondColor )
00135   Q_PROPERTY( QString firstText READ firstText WRITE setFirstText )
00136   Q_PROPERTY( QString secondText READ secondText WRITE setSecondText )
00137 
00138 public:
00143   explicit KGradientSelector( QWidget *parent=0 );
00148   explicit KGradientSelector( Qt::Orientation o, QWidget *parent=0 );
00152   ~KGradientSelector();
00156   void setColors( const QColor &col1, const QColor &col2 );
00157   void setText( const QString &t1, const QString &t2 );
00158 
00162   void setFirstColor( const QColor &col );
00163   void setSecondColor( const QColor &col );
00164 
00168   void setFirstText( const QString &t );
00169   void setSecondText( const QString &t );
00170 
00171   QColor firstColor() const;
00172   QColor secondColor() const;
00173 
00174   QString firstText() const;
00175   QString secondText() const;
00176 
00177 protected:
00178 
00179   virtual void drawContents( QPainter * );
00180   virtual QSize minimumSize() const;
00181 
00182 private:
00183   class KGradientSelectorPrivate;
00184   friend class KGradientSelectorPrivate;
00185   KGradientSelectorPrivate * const d;
00186   
00187   Q_DISABLE_COPY(KGradientSelector)
00188 };
00189 
00190 #endif      // KSELECTOR_H

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • 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
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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