kdecore Library: kpalette.h Source File (kdecore Library)

| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kpalette.h

    00001 /* This file is part of the KDE libraries
    00002     Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; version
    00007     2 of the License.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public License
    00015     along with this library; see the file COPYING.LIB.  If not, write to
    00016     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017     Boston, MA 02111-1307, USA.
    00018 */
    00019 //-----------------------------------------------------------------------------
    00020 // KDE color palette.
    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

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:09 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003