00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef __KPALETTE_H__
00023
#define __KPALETTE_H__
00024
00025
#include <qcolor.h>
00026
#include <qptrlist.h>
00027
#include <qstring.h>
00028
#include <qstringlist.h>
00029
#include "kdelibs_export.h"
00030
00031
class KPalettePrivate;
00032
00046 class KDECORE_EXPORT KPalette
00047 {
00048
public:
00054
static QStringList getPaletteList();
00055
00061 KPalette(
const QString &name=QString::null);
00062
00066 KPalette(
const KPalette &);
00067
00071
virtual ~KPalette();
00072
00076 KPalette& operator=(
const KPalette &);
00077
00083
bool save();
00084
00089 QString description()
const
00090
{
return mDesc; }
00091
00096 void setDescription(
const QString &desc)
00097 { mDesc = desc; }
00098
00103 QString name()
const
00104
{
return mName; }
00105
00110 void setName(
const QString &name)
00111 { mName = name; }
00112
00118 enum Editable { Yes,
00119 No,
00120 Ask
00121 };
00122
00127 Editable editable()
const
00128
{
return mEditable; }
00129
00134 void setEditable(Editable editable)
00135 { mEditable = editable; }
00136
00141 int nrColors()
const
00142
{
return (
int) mKolorList.count(); }
00143
00149
QColor color(
int index);
00150
00157
int findColor(
const QColor &color)
const;
00158
00166
QString colorName(
int index);
00167
00175 QString colorName(
const QColor &color)
00176 {
return colorName( findColor(color)); }
00177
00185
int addColor(
const QColor &newColor,
00186
const QString &newColorName = QString::null);
00187
00197
int changeColor(
int index,
00198
const QColor &newColor,
00199
const QString &newColorName = QString::null);
00200
00210 int changeColor(
const QColor &oldColor,
00211
const QColor &newColor,
00212
const QString &newColorName = QString::null)
00213 {
return changeColor( findColor(oldColor), newColor, newColorName); }
00214
00215
private:
00216
typedef struct {
QColor color;
QString name; } kolor;
00217
QPtrList<kolor> mKolorList;
00218
00219
QString mName;
00220
QString mDesc;
00221 Editable mEditable;
00222
00223 KPalettePrivate *d;
00224 };
00225
00226
00227
#endif // __KPALETTE_H__
00228