• Skip to content
  • Skip to link menu
KDE 4.2 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   KColorPatchPrivate *const d;
00130   
00131   Q_DISABLE_COPY(KColorPatch)
00132 };
00133 
00170 class KDEUI_EXPORT KColorDialog : public KDialog
00171 {
00172   Q_OBJECT
00173 
00174   public:
00178     explicit KColorDialog( QWidget *parent = 0L, bool modal = false );
00182     ~KColorDialog();
00183 
00187     QColor color() const;
00188 
00199     static int getColor( QColor &theColor, QWidget *parent=0L );
00200 
00216     static int getColor( QColor &theColor, const QColor& defaultColor, QWidget *parent=0L );
00217 
00221     static QColor grabColor(const QPoint &p);
00222 
00229     void setDefaultColor( const QColor& defaultCol );
00230 
00234     QColor defaultColor() const;
00235 
00236   public Q_SLOTS:
00240     void setColor( const QColor &col );
00241 
00242   Q_SIGNALS:
00248     void colorSelected( const QColor &col );
00249 
00250   private:
00251     Q_PRIVATE_SLOT(d, void slotRGBChanged( void ))
00252     Q_PRIVATE_SLOT(d, void slotHSVChanged( void ))
00253     Q_PRIVATE_SLOT(d, void slotHtmlChanged( void ))
00254     Q_PRIVATE_SLOT(d, void slotHSChanged( int, int ))
00255     Q_PRIVATE_SLOT(d, void slotVChanged( int ))
00256     Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col ))
00257     Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col, const QString &name ))
00258     Q_PRIVATE_SLOT(d, void slotColorDoubleClicked( const QColor &col, const QString &name ))
00259     Q_PRIVATE_SLOT(d, void slotColorPicker())
00260     Q_PRIVATE_SLOT(d, void slotAddToCustomColors())
00261     Q_PRIVATE_SLOT(d, void slotDefaultColorClicked())
00262     Q_PRIVATE_SLOT(d, void setHMode ( void ))
00263     Q_PRIVATE_SLOT(d, void setSMode ( void ))
00264     Q_PRIVATE_SLOT(d, void setVMode ( void ))
00265     Q_PRIVATE_SLOT(d, void setRMode ( void ))
00266     Q_PRIVATE_SLOT(d, void setGMode ( void ))
00267     Q_PRIVATE_SLOT(d, void setBMode ( void ))
00268 
00269     
00272     Q_PRIVATE_SLOT(d, void slotWriteSettings())
00273 
00274   private:
00278     void readSettings();
00279 
00280   protected:
00281     virtual void mouseMoveEvent( QMouseEvent * );
00282     virtual void mouseReleaseEvent( QMouseEvent * );
00283     virtual void keyPressEvent( QKeyEvent * );
00284     virtual bool eventFilter( QObject *obj, QEvent *ev );
00285 
00286   private:
00287     class KColorDialogPrivate;
00288     KColorDialogPrivate *const d;
00289     
00290     Q_DISABLE_COPY(KColorDialog)
00291 };
00292 
00293 #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
  • 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