• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • 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 
00109 class KDEUI_EXPORT KColorPatch : public QFrame
00110 {
00111   Q_OBJECT
00112 public:
00113   KColorPatch( QWidget *parent );
00114   virtual ~KColorPatch();
00115 
00116   void setColor( const QColor &col );
00117 
00118 Q_SIGNALS:
00119   void colorChanged( const QColor&);
00120 
00121 protected:
00122   virtual void paintEvent    ( QPaintEvent * pe );
00123   virtual void mouseMoveEvent( QMouseEvent * );
00124   virtual void dragEnterEvent( QDragEnterEvent *);
00125   virtual void dropEvent( QDropEvent *);
00126 
00127 private:
00128   class KColorPatchPrivate;
00129   friend class KColorCellsPrivate;
00130   KColorPatchPrivate *const d;
00131   
00132   Q_DISABLE_COPY(KColorPatch)
00133 };
00134 
00171 class KDEUI_EXPORT KColorDialog : public KDialog
00172 {
00173   Q_OBJECT
00174 
00175   public:
00179     explicit KColorDialog( QWidget *parent = 0L, bool modal = false );
00183     ~KColorDialog();
00184 
00188     QColor color() const;
00189 
00200     static int getColor( QColor &theColor, QWidget *parent=0L );
00201 
00217     static int getColor( QColor &theColor, const QColor& defaultColor, QWidget *parent=0L );
00218 
00222     static QColor grabColor(const QPoint &p);
00223 
00230     void setDefaultColor( const QColor& defaultCol );
00231 
00235     QColor defaultColor() const;
00236 
00237   public Q_SLOTS:
00241     void setColor( const QColor &col );
00242 
00243   Q_SIGNALS:
00249     void colorSelected( const QColor &col );
00250 
00251   private:
00252     Q_PRIVATE_SLOT(d, void slotRGBChanged( void ))
00253     Q_PRIVATE_SLOT(d, void slotHSVChanged( void ))
00254     Q_PRIVATE_SLOT(d, void slotHtmlChanged( void ))
00255     Q_PRIVATE_SLOT(d, void slotHSChanged( int, int ))
00256     Q_PRIVATE_SLOT(d, void slotVChanged( int ))
00257     Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col ))
00258     Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col, const QString &name ))
00259     Q_PRIVATE_SLOT(d, void slotColorDoubleClicked( const QColor &col, const QString &name ))
00260     Q_PRIVATE_SLOT(d, void slotColorPicker())
00261     Q_PRIVATE_SLOT(d, void slotAddToCustomColors())
00262     Q_PRIVATE_SLOT(d, void slotDefaultColorClicked())
00263     Q_PRIVATE_SLOT(d, void setHMode ( void ))
00264     Q_PRIVATE_SLOT(d, void setSMode ( void ))
00265     Q_PRIVATE_SLOT(d, void setVMode ( void ))
00266     Q_PRIVATE_SLOT(d, void setRMode ( void ))
00267     Q_PRIVATE_SLOT(d, void setGMode ( void ))
00268     Q_PRIVATE_SLOT(d, void setBMode ( void ))
00269 
00270     
00273     Q_PRIVATE_SLOT(d, void slotWriteSettings())
00274 
00275   private:
00279     void readSettings();
00280 
00281   protected:
00282     virtual void mouseMoveEvent( QMouseEvent * );
00283     virtual void mouseReleaseEvent( QMouseEvent * );
00284     virtual void keyPressEvent( QKeyEvent * );
00285     virtual bool eventFilter( QObject *obj, QEvent *ev );
00286 
00287   private:
00288     class KColorDialogPrivate;
00289     friend class KColorPatchPrivate;
00290     KColorDialogPrivate *const d;
00291     
00292     Q_DISABLE_COPY(KColorDialog)
00293 };
00294 
00295 #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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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