• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

kcolordialog.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 // KDE color selection dialog.
00021 
00022 // layout management added Oct 1997 by Mario Weilguni
00023 // <mweilguni@sime.com>
00024 
00025 #ifndef KCOLORDIALOG_H
00026 #define KCOLORDIALOG_H
00027 
00028 #include <kdialog.h>
00029 #include <QtGui/QPixmap>
00030 #include <QtGui/QScrollArea>
00031 #include <QtGui/QTableWidget>
00032 #include <kcolorchoosermode.h>
00033 
00034 
00040 class KDEUI_EXPORT KColorCells : public QTableWidget
00041 {
00042   Q_OBJECT
00043 public:
00052   KColorCells( QWidget *parent, int rows, int columns );
00053   ~KColorCells();
00054 
00056   void setColor( int index, const QColor &col );
00058   QColor color( int index ) const;
00060   int count() const;
00061 
00062   void setShading(bool shade);
00063   void setAcceptDrags(bool acceptDrags);
00064 
00066   void setSelected(int index);
00068   int  selectedIndex() const;
00069   
00070 Q_SIGNALS:
00072   void colorSelected( int index , const QColor& color );
00074   void colorDoubleClicked( int index , const QColor& color );
00075 
00076 protected:
00077   // the three methods below are used to ensure equal column widths and row heights
00078   // for all cells and to update the widths/heights when the widget is resized
00079   virtual int sizeHintForColumn(int column) const;
00080   virtual int sizeHintForRow(int column) const;
00081   virtual void resizeEvent( QResizeEvent* event );
00082 
00083   virtual void mouseReleaseEvent( QMouseEvent * );
00084   virtual void mousePressEvent( QMouseEvent * );
00085   virtual void mouseMoveEvent( QMouseEvent * );
00086   virtual void dragEnterEvent( QDragEnterEvent * );
00087   virtual void dragMoveEvent( QDragMoveEvent * );
00088   virtual void dropEvent( QDropEvent *);
00089   virtual void mouseDoubleClickEvent( QMouseEvent * );
00090 
00091   int positionToCell(const QPoint &pos, bool ignoreBorders=false) const;
00092 
00093 private:
00094   class KColorCellsPrivate;
00095   friend class KColorCellsPrivate;
00096   KColorCellsPrivate *const d;
00097   
00098   Q_DISABLE_COPY(KColorCells)
00099 };
00100 
00110 class KDEUI_EXPORT KColorPatch : public QFrame
00111 {
00112     Q_OBJECT
00113     Q_PROPERTY(QColor color READ color WRITE setColor)
00114   
00115 public:
00116   KColorPatch( QWidget *parent );
00117   virtual ~KColorPatch();
00118 
00122     QColor color() const;
00123 
00129     void setColor( const QColor &col );
00130 
00131 Q_SIGNALS:
00136     void colorChanged(const QColor&);
00137 
00138 protected:
00139   virtual void paintEvent    ( QPaintEvent * pe );
00140   virtual void mouseMoveEvent( QMouseEvent * );
00141   virtual void dragEnterEvent( QDragEnterEvent *);
00142   virtual void dropEvent( QDropEvent *);
00143 
00144 private:
00145   class KColorPatchPrivate;
00146   KColorPatchPrivate *const d;
00147   
00148   Q_DISABLE_COPY(KColorPatch)
00149 };
00150 
00204 class KDEUI_EXPORT KColorDialog : public KDialog
00205 {
00206   Q_OBJECT
00207 
00208   public:
00212     explicit KColorDialog( QWidget *parent = 0L, bool modal = false );
00216     ~KColorDialog();
00217 
00221     QColor color() const;
00222 
00233     static int getColor( QColor &theColor, QWidget *parent=0L );
00234 
00250     static int getColor( QColor &theColor, const QColor& defaultColor, QWidget *parent=0L );
00251 
00255     static QColor grabColor(const QPoint &p);
00256 
00263     void setDefaultColor( const QColor& defaultCol );
00264 
00268     QColor defaultColor() const;
00269 
00275     void setAlphaChannelEnabled(bool alpha);
00276 
00281     bool isAlphaChannelEnabled() const;
00282 
00283   public Q_SLOTS:
00287     void setColor( const QColor &col );
00288 
00289   Q_SIGNALS:
00295     void colorSelected( const QColor &col );
00296 
00297   private:
00298     Q_PRIVATE_SLOT(d, void slotRGBChanged( void ))
00299     Q_PRIVATE_SLOT(d, void slotAlphaChanged( void ))
00300     Q_PRIVATE_SLOT(d, void slotHSVChanged( void ))
00301     Q_PRIVATE_SLOT(d, void slotHtmlChanged( void ))
00302     Q_PRIVATE_SLOT(d, void slotHSChanged( int, int ))
00303     Q_PRIVATE_SLOT(d, void slotVChanged( int ))
00304     Q_PRIVATE_SLOT(d, void slotAChanged( int ))
00305     Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col ))
00306     Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col, const QString &name ))
00307     Q_PRIVATE_SLOT(d, void slotColorDoubleClicked( const QColor &col, const QString &name ))
00308     Q_PRIVATE_SLOT(d, void slotColorPicker())
00309     Q_PRIVATE_SLOT(d, void slotAddToCustomColors())
00310     Q_PRIVATE_SLOT(d, void slotDefaultColorClicked())
00311     Q_PRIVATE_SLOT(d, void slotModeChanged( int id ))
00312 
00313     
00316     Q_PRIVATE_SLOT(d, void slotWriteSettings())
00317 
00318   private:
00322     void readSettings();
00323 
00324   protected:
00325     virtual void mouseMoveEvent( QMouseEvent * );
00326     virtual void mouseReleaseEvent( QMouseEvent * );
00327     virtual void keyPressEvent( QKeyEvent * );
00328     virtual bool eventFilter( QObject *obj, QEvent *ev );
00329 
00330   private:
00331     class KColorDialogPrivate;
00332     KColorDialogPrivate *const d;
00333     
00334     Q_DISABLE_COPY(KColorDialog)
00335 };
00336 
00337 #endif      // KCOLORDIALOG_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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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