• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

  • tdeui
kcolordialog.h
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 KDELIBS_KCOLORDIALOG_H
26 #define KDELIBS_KCOLORDIALOG_H
27 
28 #ifdef Q_WS_QWS
29 // FIXME(E): Do we need the KColorDialog extra functionality in Qt Embedded?
30 #include <tqcolordialog.h>
31 #define KColorDialog QColorDialog
32 #else //UNIX, WIN32
33 #include <kdialogbase.h>
34 #include <tqframe.h>
35 #include <tqpixmap.h>
36 #include <tqgridview.h>
37 
38 #include "tdeselect.h"
39 
40 class TQComboBox;
41 class TQLineEdit;
42 class TDEListBox;
43 class KPalette;
44 class KColorCells;
45 
46 
58 class TDEUI_EXPORT KHSSelector : public KXYSelector
59 {
60  Q_OBJECT
61 
62 public:
66  KHSSelector( TQWidget *parent=0, const char *name=0 );
67 
68 protected:
73  virtual void drawPalette( TQPixmap *pixmap );
74  virtual void resizeEvent( TQResizeEvent * );
75 
81  virtual void drawContents( TQPainter *painter );
82 
83 private:
84  void updateContents();
85  TQPixmap pixmap;
86 
87 protected:
88  virtual void virtual_hook( int id, void* data );
89 private:
90  class KHSSelectorPrivate;
91  KHSSelectorPrivate *d;
92 };
93 
94 
95 class KValueSelectorPrivate;
102 class TDEUI_EXPORT KValueSelector : public TDESelector
103 {
104  Q_OBJECT
105 
106 public:
110  KValueSelector( TQWidget *parent=0, const char *name=0 );
114  KValueSelector( Orientation o, TQWidget *parent = 0, const char *name = 0 );
115 
116  int hue() const
117  { return _hue; }
118  void setHue( int h )
119  { _hue = h; }
120  int saturation() const
121  { return _sat; }
122  void setSaturation( int s )
123  { _sat = s; }
124 
125  void updateContents();
126 protected:
131  virtual void drawPalette( TQPixmap *pixmap );
132  virtual void resizeEvent( TQResizeEvent * );
133 
139  virtual void drawContents( TQPainter *painter );
140 
141 private:
142  int _hue;
143  int _sat;
144  TQPixmap pixmap;
145 
146 protected:
147  virtual void virtual_hook( int id, void* data );
148 private:
149  class KValueSelectorPrivate;
150  KValueSelectorPrivate *d;
151 };
152 
153 
164 class TDEUI_EXPORT KColor : public TQColor
165 {
166 public:
167  KColor();
168  KColor( const KColor &col);
169  KColor( const TQColor &col);
170 
171  KColor& operator=( const KColor& col);
172 
173  bool operator==( const KColor& col) const;
174 
175  void setHsv(int _h, int _s, int _v);
176  void setRgb(int _r, int _g, int _b);
177 
178  void rgb(int *_r, int *_g, int *_b) const;
179  void hsv(int *_h, int *_s, int *_v) const;
180 protected:
181  int h;
182  int s;
183  int v;
184  int r;
185  int g;
186  int b;
187 
188 private:
189  class KColorPrivate;
190  KColorPrivate *d;
191 };
192 
198 class TDEUI_EXPORT KPaletteTable : public TQWidget
199 {
200  Q_OBJECT
201 public:
202  KPaletteTable( TQWidget *parent, int minWidth=210, int cols = 16);
203  ~KPaletteTable();
204  void addToCustomColors( const TQColor &);
205  void addToRecentColors( const TQColor &);
206  TQString palette() const;
207 public slots:
208  void setPalette(const TQString &paletteName);
209 signals:
210  void colorSelected( const TQColor &, const TQString & );
211  void colorDoubleClicked( const TQColor &, const TQString & );
212 
213 protected slots:
214  void slotColorCellSelected( int );
215  void slotColorCellDoubleClicked( int );
216  void slotColorTextSelected( const TQString &colorText );
217  void slotSetPalette( const TQString &_paletteName );
218  void slotShowNamedColorReadError( void );
219 
220 protected:
221  void readNamedColor( void );
222 
223 protected:
225  TQString i18n_customColors;
226  TQString i18n_recentColors;
228  TQString i18n_namedColors;
229  TQComboBox *combo;
230  KColorCells *cells;
231  TQScrollView *sv;
232  TDEListBox *mNamedColorList;
233  KPalette *mPalette;
234  int mMinWidth;
235  int mCols;
236 
237 private:
238 
239  virtual void setPalette(const TQPalette& p) { TQWidget::setPalette(p); }
240 protected:
241  virtual void virtual_hook( int id, void* data );
242 private:
243  class KPaletteTablePrivate;
244  KPaletteTablePrivate *d;
245 };
246 
247 
253 class TDEUI_EXPORT KColorCells : public TQGridView
254 {
255  Q_OBJECT
256 public:
257  KColorCells( TQWidget *parent, int rows, int cols );
258  ~KColorCells();
259 
260  void setColor( int colNum, const TQColor &col );
261  TQColor color( int indx ) const
262  { return colors[indx]; }
263  int numCells() const
264  { return numRows() * numCols(); }
265 
266  void setShading(bool _shade) { shade = _shade; }
267 
268  void setAcceptDrags(bool _acceptDrags) { acceptDrags = _acceptDrags; }
269 
270  int getSelected() const
271  { return selected; }
272 
273  signals:
274  void colorSelected( int col );
275  void colorDoubleClicked( int col );
276 
277 protected:
278  virtual void paintCell( TQPainter *painter, int row, int col );
279  virtual void resizeEvent( TQResizeEvent * );
280  virtual void mouseReleaseEvent( TQMouseEvent * );
281  virtual void mousePressEvent( TQMouseEvent * );
282  virtual void mouseMoveEvent( TQMouseEvent * );
283  virtual void dragEnterEvent( TQDragEnterEvent *);
284  virtual void dropEvent( TQDropEvent *);
285  virtual void mouseDoubleClickEvent( TQMouseEvent * );
286 
287  int posToCell(const TQPoint &pos, bool ignoreBorders=false);
288 
289  TQColor *colors;
290  bool inMouse;
291  TQPoint mPos;
292  int selected;
293  bool shade;
294  bool acceptDrags;
295 
296 protected:
297  virtual void virtual_hook( int id, void* data );
298 private:
299  class KColorCellsPrivate;
300  KColorCellsPrivate *d;
301 };
302 
311 class TDEUI_EXPORT KColorPatch : public TQFrame
312 {
313  Q_OBJECT
314 public:
315  KColorPatch( TQWidget *parent );
316  virtual ~KColorPatch();
317 
318  void setColor( const TQColor &col );
319 
320 signals:
321  void colorChanged( const TQColor&);
322 
323 protected:
324  virtual void drawContents( TQPainter *painter );
325  virtual void mouseMoveEvent( TQMouseEvent * );
326  virtual void dragEnterEvent( TQDragEnterEvent *);
327  virtual void dropEvent( TQDropEvent *);
328 
329 private:
330  TQColor color;
331  uint pixel;
332  int colContext;
333 
334 protected:
335  virtual void virtual_hook( int id, void* data );
336 private:
337  class KColorPatchPrivate;
338  KColorPatchPrivate *d;
339 };
340 
377 class TDEUI_EXPORT KColorDialog : public KDialogBase
378 {
379  Q_OBJECT
380 
381  public:
385  KColorDialog( TQWidget *parent = 0L, const char *name = 0L,
386  bool modal = false );
390  ~KColorDialog();
391 
395  TQColor color() const;
396 
405  static int getColor( TQColor &theColor, TQWidget *parent=0L );
406 
419  static int getColor( TQColor &theColor, const TQColor& defaultColor, TQWidget *parent=0L );
420 
424  static TQColor grabColor(const TQPoint &p);
425 
432  void setDefaultColor( const TQColor& defaultCol );
433 
437  TQColor defaultColor() const;
438 
439  public slots:
443  void setColor( const TQColor &col );
444 
445  signals:
451  void colorSelected( const TQColor &col );
452 
453  private slots:
454  void slotRGBChanged( void );
455  void slotHSVChanged( void );
456  void slotHtmlChanged( void );
457  void slotHSChanged( int, int );
458  void slotVChanged( int );
459  void slotColorSelected( const TQColor &col );
460  void slotColorSelected( const TQColor &col, const TQString &name );
461  void slotColorDoubleClicked( const TQColor &col, const TQString &name );
462  void slotColorPicker();
463  void slotAddToCustomColors();
464  void slotDefaultColorClicked();
468  void slotWriteSettings();
469 
470  private:
474  void readSettings();
475 
476  void setRgbEdit( const KColor &col );
477  void setHsvEdit( const KColor &col );
478  void setHtmlEdit( const KColor &col );
479  void _setColor( const KColor &col, const TQString &name=TQString::null );
480  void showColor( const KColor &color, const TQString &name );
481 
482  protected:
483  virtual void mouseReleaseEvent( TQMouseEvent * );
484  virtual void keyPressEvent( TQKeyEvent * );
485  virtual bool eventFilter( TQObject *obj, TQEvent *ev );
486 
487  protected:
488  virtual void virtual_hook( int id, void* data );
489  private:
490  class KColorDialogPrivate;
491  KColorDialogPrivate *d;
492 };
493 
494 #endif // !Q_WS_QWS
495 #endif // KDELIBS_KCOLORDIALOG_H
496 
KHSSelector
Widget for Hue/Saturation colour selection.
Definition: kcolordialog.h:58
KPalette
KPaletteTable
A color palette in table form.
Definition: kcolordialog.h:198
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
KColorCells
A table of editable color cells.
Definition: kcolordialog.h:253
KValueSelector
Widget for color value selection.
Definition: kcolordialog.h:102
KPaletteTable::i18n_customColors
TQString i18n_customColors
Definition: kcolordialog.h:225
KColor
A color class that preserves both RGB and HSV values.
Definition: kcolordialog.h:164
KColorPatch
A color displayer.
Definition: kcolordialog.h:311
KPaletteTable::i18n_namedColors
TQString i18n_namedColors
KDE4: remove
Definition: kcolordialog.h:228
KDialogBase::keyPressEvent
virtual void keyPressEvent(TQKeyEvent *e)
Maps some keys to the actions buttons.
Definition: kdialogbase.cpp:1553
TDESelector::drawContents
virtual void drawContents(TQPainter *)
Override this function to draw the contents of the control.
Definition: tdeselect.cpp:367
KColorDialog
A color selection dialog.
Definition: kcolordialog.h:377
KXYSelector::drawContents
virtual void drawContents(TQPainter *)
Override this function to draw the contents of the widget.
Definition: tdeselect.cpp:217
KXYSelector
KXYSelector is the base class for other widgets which provides the ability to choose from a two-dimen...
Definition: tdeselect.h:43
TDEListBox
A variant of TQListBox that honors KDE's system-wide settings.
Definition: tdelistbox.h:40
TDESelector
TDESelector is the base class for other widgets which provides the ability to choose from a one-dimen...
Definition: tdeselect.h:159

tdeui

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

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.8.8
This website is maintained by Timothy Pearson.