25#ifndef KDELIBS_KCOLORDIALOG_H
26#define KDELIBS_KCOLORDIALOG_H
30#include <tqcolordialog.h>
31#define KColorDialog QColorDialog
33#include <kdialogbase.h>
36#include <tqgridview.h>
66 KHSSelector( TQWidget *parent=0,
const char *name=0 );
74 virtual void resizeEvent( TQResizeEvent * );
84 void updateContents();
88 virtual void virtual_hook(
int id,
void* data );
90 class KHSSelectorPrivate;
91 KHSSelectorPrivate *d;
95class KValueSelectorPrivate;
114 KValueSelector( Orientation o, TQWidget *parent = 0,
const char *name = 0 );
120 int saturation()
const
122 void setSaturation(
int s )
125 void updateContents();
132 virtual void resizeEvent( TQResizeEvent * );
147 virtual void virtual_hook(
int id,
void* data );
149 class KValueSelectorPrivate;
150 KValueSelectorPrivate *d;
164class TDEUI_EXPORT KColor :
public TQColor
168 KColor(
const KColor &col);
169 KColor(
const TQColor &col);
171 KColor& operator=(
const KColor& col);
173 bool operator==(
const KColor& col)
const;
175 void setHsv(
int _h,
int _s,
int _v);
176 void setRgb(
int _r,
int _g,
int _b);
178 void rgb(
int *_r,
int *_g,
int *_b)
const;
179 void hsv(
int *_h,
int *_s,
int *_v)
const;
198class TDEUI_EXPORT KPaletteTable :
public TQWidget
202 KPaletteTable( TQWidget *parent,
int minWidth=210,
int cols = 16);
204 void addToCustomColors(
const TQColor &);
205 void addToRecentColors(
const TQColor &);
206 TQString palette()
const;
208 void setPalette(
const TQString &paletteName);
210 void colorSelected(
const TQColor &,
const TQString & );
211 void colorDoubleClicked(
const TQColor &,
const TQString & );
214 void slotColorCellSelected(
int );
215 void slotColorCellDoubleClicked(
int );
216 void slotColorTextSelected(
const TQString &colorText );
217 void slotSetPalette(
const TQString &_paletteName );
218 void slotShowNamedColorReadError(
void );
221 void readNamedColor(
void );
239 virtual void setPalette(
const TQPalette& p) { TQWidget::setPalette(p); }
241 virtual void virtual_hook(
int id,
void* data );
243 class KPaletteTablePrivate;
244 KPaletteTablePrivate *d;
253class TDEUI_EXPORT KColorCells :
public TQGridView
257 KColorCells( TQWidget *parent,
int rows,
int cols );
260 void setColor(
int colNum,
const TQColor &col );
261 TQColor color(
int indx )
const
262 {
return colors[indx]; }
264 {
return numRows() * numCols(); }
266 void setShading(
bool _shade) { shade = _shade; }
268 void setAcceptDrags(
bool _acceptDrags) { acceptDrags = _acceptDrags; }
270 int getSelected()
const
274 void colorSelected(
int col );
275 void colorDoubleClicked(
int col );
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 * );
287 int posToCell(
const TQPoint &pos,
bool ignoreBorders=
false);
297 virtual void virtual_hook(
int id,
void* data );
299 class KColorCellsPrivate;
300 KColorCellsPrivate *d;
311class TDEUI_EXPORT KColorPatch :
public TQFrame
315 KColorPatch( TQWidget *parent );
316 virtual ~KColorPatch();
318 void setColor(
const TQColor &col );
321 void colorChanged(
const TQColor&);
325 virtual void mouseMoveEvent( TQMouseEvent * );
326 virtual void dragEnterEvent( TQDragEnterEvent *);
327 virtual void dropEvent( TQDropEvent *);
335 virtual void virtual_hook(
int id,
void* data );
337 class KColorPatchPrivate;
338 KColorPatchPrivate *d;
385 KColorDialog( TQWidget *parent = 0L,
const char *name = 0L,
386 bool modal =
false );
395 TQColor
color()
const;
405 static int getColor( TQColor &theColor, TQWidget *parent=0L );
424 static TQColor
grabColor(
const TQPoint &p);
443 void setColor(
const TQColor &col );
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();
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 );
483 virtual void mouseReleaseEvent( TQMouseEvent * );
485 virtual bool eventFilter( TQObject *obj, TQEvent *ev );
488 virtual void virtual_hook(
int id,
void* data );
490 class KColorDialogPrivate;
491 KColorDialogPrivate *d;
A table of editable color cells.
virtual void keyPressEvent(TQKeyEvent *)
Maps some keys to the actions buttons.
void setDefaultColor(const TQColor &defaultCol)
Call this to make the dialog show a "Default Color" checkbox.
KColorDialog(TQWidget *parent=0L, const char *name=0L, bool modal=false)
Constructs a color selection dialog.
static TQColor grabColor(const TQPoint &p)
Gets the color from the pixel at point p on the screen.
void setColor(const TQColor &col)
Preselects a color.
void colorSelected(const TQColor &col)
Emitted when a color is selected.
TQColor defaultColor() const
static int getColor(TQColor &theColor, TQWidget *parent=0L)
Creates a modal color dialog, let the user choose a color, and returns when the dialog is closed.
TQColor color() const
Returns the currently selected color.
A color class that preserves both RGB and HSV values.
KDialogBase(TQWidget *parent=0, const char *name=0, bool modal=true, const TQString &caption=TQString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
Constructor for the standard mode where you must specify the main widget with setMainWidget() .
KHSSelector(TQWidget *parent=0, const char *name=0)
Constructs a hue/saturation selection widget.
virtual void drawPalette(TQPixmap *pixmap)
Draws the contents of the widget on a pixmap, which is used for buffering.
TQString i18n_recentColors
TQString i18n_customColors
TQString i18n_namedColors
virtual void drawPalette(TQPixmap *pixmap)
Draws the contents of the widget on a pixmap, which is used for buffering.
KValueSelector(TQWidget *parent=0, const char *name=0)
Constructs a widget for color selection.
virtual void drawContents(TQPainter *)
Override this function to draw the contents of the widget.
KXYSelector(TQWidget *parent=0, const char *name=0)
Constructs a two-dimensional selector widget which has a value range of [0..100] in both directions.
A variant of TQListBox that honors KDE's system-wide settings.
TDESelector(TQWidget *parent=0, const char *name=0)
Constructs a horizontal one-dimensional selection widget.