00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KDELIBS_KPALETTE_H
00023 #define KDELIBS_KPALETTE_H
00024
00025 #include <tqcolor.h>
00026 #include <tqptrlist.h>
00027 #include <tqstring.h>
00028 #include <tqstringlist.h>
00029 #include "tdelibs_export.h"
00030
00031 class KPalettePrivate;
00032
00046 class TDECORE_EXPORT KPalette
00047 {
00048 public:
00054 static TQStringList getPaletteList();
00055
00061 KPalette(const TQString &name=TQString::null);
00062
00066 KPalette(const KPalette &);
00067
00071 virtual ~KPalette();
00072
00076 KPalette& operator=( const KPalette &);
00077
00083 bool save();
00084
00089 TQString description() const
00090 { return mDesc; }
00091
00096 void setDescription(const TQString &desc)
00097 { mDesc = desc; }
00098
00103 TQString name() const
00104 { return mName; }
00105
00110 void setName(const TQString &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 TQColor color(int index);
00150
00157 int findColor(const TQColor &color) const;
00158
00166 TQString colorName(int index);
00167
00175 TQString colorName(const TQColor &color)
00176 { return colorName( findColor(color)); }
00177
00185 int addColor(const TQColor &newColor,
00186 const TQString &newColorName = TQString::null);
00187
00197 int changeColor(int index,
00198 const TQColor &newColor,
00199 const TQString &newColorName = TQString::null);
00200
00210 int changeColor(const TQColor &oldColor,
00211 const TQColor &newColor,
00212 const TQString &newColorName = TQString::null)
00213 { return changeColor( findColor(oldColor), newColor, newColorName); }
00214
00215 private:
00216 typedef struct { TQColor color; TQString name; } kolor;
00217 TQPtrList<kolor> mKolorList;
00218
00219 TQString mName;
00220 TQString mDesc;
00221 Editable mEditable;
00222
00223 KPalettePrivate *d;
00224 };
00225
00226
00227 #endif // KDELIBS_KPALETTE_H
00228