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

KDEUI

  • kdeui
  • colors
kcolordialog.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 //----------------------------------------------------------------------
20 // KDE color selection dialog.
21 
22 // layout management added Oct 1997 by Mario Weilguni
23 // <mweilguni@sime.com>
24 
25 #ifndef KCOLORDIALOG_H
26 #define KCOLORDIALOG_H
27 
28 #include <kdialog.h>
29 #include <QtGui/QPixmap>
30 #include <QtGui/QScrollArea>
31 #include <QtGui/QTableWidget>
32 #include <kcolorchoosermode.h>
33 
34 
40 class KDEUI_EXPORT KColorCells : public QTableWidget
41 {
42  Q_OBJECT
43 public:
52  KColorCells( QWidget *parent, int rows, int columns );
53  ~KColorCells();
54 
56  void setColor( int index, const QColor &col );
58  QColor color( int index ) const;
60  int count() const;
61 
62  void setShading(bool shade);
63  void setAcceptDrags(bool acceptDrags);
64 
66  void setSelected(int index);
68  int selectedIndex() const;
69 
70 Q_SIGNALS:
72  void colorSelected( int index , const QColor& color );
74  void colorDoubleClicked( int index , const QColor& color );
75 
76 protected:
77  // the three methods below are used to ensure equal column widths and row heights
78  // for all cells and to update the widths/heights when the widget is resized
79  virtual int sizeHintForColumn(int column) const;
80  virtual int sizeHintForRow(int column) const;
81  virtual void resizeEvent( QResizeEvent* event );
82 
83  virtual void mouseReleaseEvent( QMouseEvent * );
84  virtual void mousePressEvent( QMouseEvent * );
85  virtual void mouseMoveEvent( QMouseEvent * );
86  virtual void dragEnterEvent( QDragEnterEvent * );
87  virtual void dragMoveEvent( QDragMoveEvent * );
88  virtual void dropEvent( QDropEvent *);
89  virtual void mouseDoubleClickEvent( QMouseEvent * );
90 
91  int positionToCell(const QPoint &pos, bool ignoreBorders=false) const;
92 
93 private:
94  class KColorCellsPrivate;
95  friend class KColorCellsPrivate;
96  KColorCellsPrivate *const d;
97 
98  Q_DISABLE_COPY(KColorCells)
99 };
100 
110 class KDEUI_EXPORT KColorPatch : public QFrame
111 {
112  Q_OBJECT
113  Q_PROPERTY(QColor color READ color WRITE setColor)
114 
115 public:
116  KColorPatch( QWidget *parent );
117  virtual ~KColorPatch();
118 
122  QColor color() const;
123 
129  void setColor( const QColor &col );
130 
131 Q_SIGNALS:
136  void colorChanged(const QColor&);
137 
138 protected:
139  virtual void paintEvent ( QPaintEvent * pe );
140  virtual void mouseMoveEvent( QMouseEvent * );
141  virtual void dragEnterEvent( QDragEnterEvent *);
142  virtual void dropEvent( QDropEvent *);
143 
144 private:
145  class KColorPatchPrivate;
146  KColorPatchPrivate *const d;
147 
148  Q_DISABLE_COPY(KColorPatch)
149 };
150 
204 class KDEUI_EXPORT KColorDialog : public KDialog
205 {
206  Q_OBJECT
207 
208  public:
212  explicit KColorDialog( QWidget *parent = 0L, bool modal = false );
216  ~KColorDialog();
217 
221  QColor color() const;
222 
233  static int getColor( QColor &theColor, QWidget *parent=0L );
234 
250  static int getColor( QColor &theColor, const QColor& defaultColor, QWidget *parent=0L );
251 
255  static QColor grabColor(const QPoint &p);
256 
263  void setDefaultColor( const QColor& defaultCol );
264 
268  QColor defaultColor() const;
269 
275  void setAlphaChannelEnabled(bool alpha);
276 
281  bool isAlphaChannelEnabled() const;
282 
283  public Q_SLOTS:
287  void setColor( const QColor &col );
288 
289  Q_SIGNALS:
295  void colorSelected( const QColor &col );
296 
297  private:
298  Q_PRIVATE_SLOT(d, void slotRGBChanged( void ))
299  Q_PRIVATE_SLOT(d, void slotAlphaChanged( void ))
300  Q_PRIVATE_SLOT(d, void slotHSVChanged( void ))
301  Q_PRIVATE_SLOT(d, void slotHtmlChanged( void ))
302  Q_PRIVATE_SLOT(d, void slotHSChanged( int, int ))
303  Q_PRIVATE_SLOT(d, void slotVChanged( int ))
304  Q_PRIVATE_SLOT(d, void slotAChanged( int ))
305  Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col ))
306  Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col, const QString &name ))
307  Q_PRIVATE_SLOT(d, void slotColorDoubleClicked( const QColor &col, const QString &name ))
308  Q_PRIVATE_SLOT(d, void slotColorPicker())
309  Q_PRIVATE_SLOT(d, void slotAddToCustomColors())
310  Q_PRIVATE_SLOT(d, void slotDefaultColorClicked())
311  Q_PRIVATE_SLOT(d, void slotModeChanged( int id ))
312 
313 
316  Q_PRIVATE_SLOT(d, void slotWriteSettings())
317 
318  private:
322  void readSettings();
323 
324  protected:
325  virtual void mouseMoveEvent( QMouseEvent * );
326  virtual void mouseReleaseEvent( QMouseEvent * );
327  virtual void keyPressEvent( QKeyEvent * );
328  virtual bool eventFilter( QObject *obj, QEvent *ev );
329 
330  private:
331  class KColorDialogPrivate;
332  KColorDialogPrivate *const d;
333 
334  Q_DISABLE_COPY(KColorDialog)
335 };
336 
337 #endif // KCOLORDIALOG_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Fri Nov 16 2012 15:01:53 by doxygen 1.8.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs-4.8.5 API Reference

Skip menu "kdelibs-4.8.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal