diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 47d455dd55be855e4cc691c32f687f723d9247ee (patch) | |
tree | 52e236aaa2576bdb3840ebede26619692fed6d7d /kcoloredit/kzcolorselector.h | |
download | tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcoloredit/kzcolorselector.h')
-rw-r--r-- | kcoloredit/kzcolorselector.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/kcoloredit/kzcolorselector.h b/kcoloredit/kzcolorselector.h new file mode 100644 index 00000000..cafdb254 --- /dev/null +++ b/kcoloredit/kzcolorselector.h @@ -0,0 +1,89 @@ +/*************************************************************************** + kzcolorselector.h - description + ------------------- + begin : Fri Jul 14 2000 + copyright : (C) 2000 by Artur Rataj + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KZCOLORSELECTOR_H +#define KZCOLORSELECTOR_H + +#include "qcolor.h" +#include "qpixmap.h" +#include "kselect.h" + +#include "color.h" + +/** A widget for selecting a color component + * @author Artur Rataj + */ +class KZColorSelector : public KSelector { + Q_OBJECT + +public: + /** Selector type constants */ + enum { TYPE_H = 0, + TYPE_S = 1, + TYPE_V = 2 }; + + /** Constructs the widget */ + KZColorSelector(Orientation o, QWidget *parent=0, const char *name=0); + ~KZColorSelector(); + /** Sets the selector type */ + void setType(const int type); + /** Update the pixmap */ + void updateContents(); + /** Set the global components */ + void setBaseColor(const QColor& color); + /** Set the global components using HSV components */ + void setBaseColorHsv(const int colorH, const int colorS, const int colorV); + /** Updates a pointer position due to the base color */ + void updatePointerPos(); + +protected: + /** The number of colors that are used to dither the pixmap + * if number of color planes <= 8. The palette returned by + * getStandardColorsPalette() is of the size. + */ + enum { STANDARD_PALETTE_SIZE = 17 }; + + /** A type of the selector */ + int type; + /** A base color H component */ + int baseColorH; + /** A base color S component */ + int baseColorS; + /** A base color V component */ + int baseColorV; + + /** Draws the contents of the widget on a pixmap, + * which is used for buffering. + */ + virtual void drawPalette( QPixmap *pixmap ); + /** @reimplemented */ + virtual void resizeEvent( QResizeEvent * ); + /** Draws a color gradient in the selector */ + virtual void drawContents( QPainter *painter ); + /** Sets a color at a given coordinate */ + virtual void setColor(QColor* const color, const int y); + /** @return STANDARD_PALETTE_SIZE colors used to dither the + * pixmap if number of color planes <= 8 + */ + QColor* getStandardColorsPalette(); + +private: + /* The buffering pixmap */ + QPixmap pixmap; +}; + +#endif |