• 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 TQ_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
40class TQComboBox;
41class TQLineEdit;
42class TDEListBox;
43class KPalette;
44class KColorCells;
45
46
58class TDEUI_EXPORT KHSSelector : public KXYSelector
59{
60 TQ_OBJECT
61
62public:
66 KHSSelector( TQWidget *parent=0, const char *name=0 );
67
68protected:
73 virtual void drawPalette( TQPixmap *pixmap );
74 virtual void resizeEvent( TQResizeEvent * );
75
81 virtual void drawContents( TQPainter *painter );
82
83private:
84 void updateContents();
85 TQPixmap pixmap;
86
87protected:
88 virtual void virtual_hook( int id, void* data );
89private:
90 class KHSSelectorPrivate;
91 KHSSelectorPrivate *d;
92};
93
94
95class KValueSelectorPrivate;
102class TDEUI_EXPORT KValueSelector : public TDESelector
103{
104 TQ_OBJECT
105
106public:
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();
126protected:
131 virtual void drawPalette( TQPixmap *pixmap );
132 virtual void resizeEvent( TQResizeEvent * );
133
139 virtual void drawContents( TQPainter *painter );
140
141private:
142 int _hue;
143 int _sat;
144 TQPixmap pixmap;
145
146protected:
147 virtual void virtual_hook( int id, void* data );
148private:
149 class KValueSelectorPrivate;
150 KValueSelectorPrivate *d;
151};
152
153
164class TDEUI_EXPORT KColor : public TQColor
165{
166public:
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;
180protected:
181 int h;
182 int s;
183 int v;
184 int r;
185 int g;
186 int b;
187
188private:
189 class KColorPrivate;
190 KColorPrivate *d;
191};
192
198class TDEUI_EXPORT KPaletteTable : public TQWidget
199{
200 TQ_OBJECT
201public:
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;
207public slots:
208 void setPalette(const TQString &paletteName);
209signals:
210 void colorSelected( const TQColor &, const TQString & );
211 void colorDoubleClicked( const TQColor &, const TQString & );
212
213protected 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
220protected:
221 void readNamedColor( void );
222
223protected:
225 TQString i18n_customColors;
227 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
237private:
238
239 virtual void setPalette(const TQPalette& p) { TQWidget::setPalette(p); }
240protected:
241 virtual void virtual_hook( int id, void* data );
242private:
243 class KPaletteTablePrivate;
244 KPaletteTablePrivate *d;
245};
246
247
253class TDEUI_EXPORT KColorCells : public TQGridView
254{
255 TQ_OBJECT
256public:
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
277protected:
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
296protected:
297 virtual void virtual_hook( int id, void* data );
298private:
299 class KColorCellsPrivate;
300 KColorCellsPrivate *d;
301};
302
311class TDEUI_EXPORT KColorPatch : public TQFrame
312{
313 TQ_OBJECT
314public:
315 KColorPatch( TQWidget *parent );
316 virtual ~KColorPatch();
317
318 void setColor( const TQColor &col );
319
320signals:
321 void colorChanged( const TQColor&);
322
323protected:
324 virtual void drawContents( TQPainter *painter );
325 virtual void mouseMoveEvent( TQMouseEvent * );
326 virtual void dragEnterEvent( TQDragEnterEvent *);
327 virtual void dropEvent( TQDropEvent *);
328
329private:
330 TQColor color;
331 uint pixel;
332 int colContext;
333
334protected:
335 virtual void virtual_hook( int id, void* data );
336private:
337 class KColorPatchPrivate;
338 KColorPatchPrivate *d;
339};
340
377class TDEUI_EXPORT KColorDialog : public KDialogBase
378{
379 TQ_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 // !TQ_WS_QWS
495#endif // KDELIBS_KCOLORDIALOG_H
496
KColorCells
A table of editable color cells.
Definition: kcolordialog.h:254
KColorDialog
A color selection dialog.
Definition: kcolordialog.h:378
KColorDialog::colorSelected
void colorSelected(const TQColor &col)
Emitted when a color is selected.
KColorPatch
A color displayer.
Definition: kcolordialog.h:312
KColor
A color class that preserves both RGB and HSV values.
Definition: kcolordialog.h:165
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:192
KHSSelector
Widget for Hue/Saturation colour selection.
Definition: kcolordialog.h:59
KPaletteTable
A color palette in table form.
Definition: kcolordialog.h:199
KPaletteTable::i18n_recentColors
TQString i18n_recentColors
Definition: kcolordialog.h:227
KPaletteTable::i18n_customColors
TQString i18n_customColors
Definition: kcolordialog.h:225
KPaletteTable::i18n_namedColors
TQString i18n_namedColors
Definition: kcolordialog.h:228
KPalette
KValueSelector
Widget for color value selection.
Definition: kcolordialog.h:103
KXYSelector
KXYSelector is the base class for other widgets which provides the ability to choose from a two-dimen...
Definition: tdeselect.h:44
KXYSelector::drawContents
virtual void drawContents(TQPainter *)
Override this function to draw the contents of the widget.
Definition: tdeselect.cpp:217
TDEListBox
A variant of TQListBox that honors KDE's system-wide settings.
Definition: tdelistbox.h:41
TDESelector
TDESelector is the base class for other widgets which provides the ability to choose from a one-dimen...
Definition: tdeselect.h:160

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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.