kpalette.h
/* This file is part of the KDE libraries
Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version
2 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
//-----------------------------------------------------------------------------
// KDE color palette.
#ifndef KDELIBS_KPALETTE_H
#define KDELIBS_KPALETTE_H
#include <qcolor.h>
#include <qptrlist.h>
#include <qstring.h>
#include <qstringlist.h>
#include "kdelibs_export.h"
class KPalettePrivate;
class KDECORE_EXPORT KPalette
{
public:
static QStringList getPaletteList();
KPalette(const QString &name=QString::null);
KPalette(const KPalette &);
virtual ~KPalette();
KPalette& operator=( const KPalette &);
bool save();
QString description() const
{ return mDesc; }
void setDescription(const QString &desc)
{ mDesc = desc; }
QString name() const
{ return mName; }
void setName(const QString &name)
{ mName = name; }
enum Editable { Yes,
No,
Ask
};
Editable editable() const
{ return mEditable; }
void setEditable(Editable editable)
{ mEditable = editable; }
int nrColors() const
{ return (int) mKolorList.count(); }
QColor color(int index);
int findColor(const QColor &color) const;
QString colorName(int index);
QString colorName(const QColor &color)
{ return colorName( findColor(color)); }
int addColor(const QColor &newColor,
const QString &newColorName = QString::null);
int changeColor(int index,
const QColor &newColor,
const QString &newColorName = QString::null);
int changeColor(const QColor &oldColor,
const QColor &newColor,
const QString &newColorName = QString::null)
{ return changeColor( findColor(oldColor), newColor, newColorName); }
private:
typedef struct { QColor color; QString name; } kolor;
QPtrList<kolor> mKolorList;
QString mName;
QString mDesc;
Editable mEditable;
KPalettePrivate *d;
};
#endif // KDELIBS_KPALETTE_H
KPalette::editable
Editable editable() const
Returns whether the palette may be edited.
Definition: kpalette.h:127
KPalette::Editable
Editable
Used to specify whether a palette may be edited.
Definition: kpalette.h:118
KPalette
Class for handling Palettes.
Definition: kpalette.h:46
KPalette::changeColor
int changeColor(const QColor &oldColor, const QColor &newColor, const QString &newColorName=QString::null)
Change a color.
Definition: kpalette.h:210
KPalette::nrColors
int nrColors() const
Return the number of colors in the palette.
Definition: kpalette.h:141
KPalette::name
QString name() const
Get the name of the palette.
Definition: kpalette.h:103
KPalette::setDescription
void setDescription(const QString &desc)
Set the description of the palette.
Definition: kpalette.h:96
KPalette::description
QString description() const
Get the description of the palette.
Definition: kpalette.h:89
KPalette::No
Palette may not be edited.
Definition: kpalette.h:119
KPalette::Yes
Palette may be edited.
Definition: kpalette.h:118
KPalette::colorName
QString colorName(const QColor &color)
Find color name by color.
Definition: kpalette.h:175
KPalette::setEditable
void setEditable(Editable editable)
Change whether the palette may be edited.
Definition: kpalette.h:134
KPalette::setName
void setName(const QString &name)
Set the name of the palette.
Definition: kpalette.h:110

KDE Home | KDE Accessibility Home | Description of Access Keys