Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

KPalette Class Reference

#include <kpalette.h>

List of all members.

Public Types

enum  Editable { Yes, No, Ask }

Public Methods

 KPalette (const QString &name=QString::null)
 KPalette (const KPalette &)
virtual ~KPalette ()
KPalette & operator= (const KPalette &)
bool save ()
QString description () const
void setDescription (const QString &desc)
QString name () const
void setName (const QString &name)
Editable editable () const
void setEditable (Editable editable)
int nrColors () const
QColor color (int index)
int findColor (const QColor &color) const
QString colorName (int index)
QString colorName (const QColor &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)

Static Public Methods

QStringList getPaletteList ()


Detailed Description

Class for handling Palettes.

This class makes it easy to handle palettes. A palette is a set of colors. This class can read and write palettes from and to a file.

This class uses the "GIMP" palette file format.

This class is totally unrelated to QPalette.

Author:
Waldo Bastian (bastian@kde.org)
Version:
Id:
kpalette.h,v 1.8 2002/09/19 19:39:49 tjansen Exp

Definition at line 46 of file kpalette.h.


Member Enumeration Documentation

enum KPalette::Editable
 

Used to specify whether a palette may be edited.

See also:
editable() , setEditable()
Enumeration values:
Yes  Palette may be edited.
No  Palette may not be edited.
Ask  Ask user before editing.

Definition at line 118 of file kpalette.h.

Referenced by editable(), and setEditable().


Constructor & Destructor Documentation

KPalette::KPalette const QString &    name = QString::null
 

KPalette constructor. Creates a KPalette from a file the filename is derived from the name.

Parameters:
name  The name of palette as returned by getPaletteList()

KPalette::KPalette const KPalette &   
 

KPalette copy constructor.

virtual KPalette::~KPalette   [virtual]
 

KPalette destructor.


Member Function Documentation

int KPalette::addColor const QColor &    newColor,
const QString &    newColorName = QString::null
 

Add a color.

Parameters:
newColor  The color to add.
newColorName  The name of the color, null to remove the name.
Returns:
The index of the added color.

int KPalette::changeColor const QColor &    oldColor,
const QColor &    newColor,
const QString &    newColorName = QString::null
[inline]
 

Change a color.

Parameters:
oldColor  The original color
newColor  The new color.
newColorName  The new color name, null to remove the name.
Returns:
The index of the new color or -1 if the color couldn't be changed.

Definition at line 210 of file kpalette.h.

References changeColor(), and findColor().

int KPalette::changeColor int    index,
const QColor &    newColor,
const QString &    newColorName = QString::null
 

Change a color.

Parameters:
index  Index of the color to change
newColor  The new color.
newColorName  The new color name, null to remove the name.
Returns:
The index of the new color or -1 if the color couldn't be changed.

Referenced by changeColor().

QColor KPalette::color int    index
 

Find color by index.

Parameters:
index  the index of the desired color
Returns:
The index -th color of the palette, null if not found.

Referenced by colorName().

QString KPalette::colorName const QColor &    color [inline]
 

Find color name by color.

Returns:
The name of color according to this palette. Note that not all palettes have named the colors. Note also that each palette can give the same color a different name.

Definition at line 175 of file kpalette.h.

References color(), colorName(), and findColor().

QString KPalette::colorName int    index
 

Find color name by index.

Parameters:
the  index of the color
Returns:
The name of the index -th color. Note that not all palettes have named the colors. Null is returned if the color does not exist or has no name.

Referenced by colorName().

QString KPalette::description   const [inline]
 

Get the description of the palette.

Returns:
the description of the palette.

Definition at line 89 of file kpalette.h.

Editable KPalette::editable   const [inline]
 

Returns whether the palette may be edited.

Returns:
the state of the palette

Definition at line 127 of file kpalette.h.

References Editable.

Referenced by setEditable().

int KPalette::findColor const QColor &    color const
 

Find index by color.

Parameters:
color  the color to find
Returns:
The index of the color in the palette or -1 if the color is not found.

Referenced by changeColor(), and colorName().

QStringList KPalette::getPaletteList   [static]
 

Query which KDE palettes are installed.

Returns:
A list with a palette names.

QString KPalette::name   const [inline]
 

Get the name of the palette.

Returns:
the name of the palette

Definition at line 103 of file kpalette.h.

Referenced by setName().

int KPalette::nrColors   const [inline]
 

Return the number of colors in the palette.

Returns:
the number of colors

Definition at line 141 of file kpalette.h.

KPalette& KPalette::operator= const KPalette &   
 

KPalette assignment operator

bool KPalette::save  
 

Save the palette

Returns:
'true' if successful

void KPalette::setDescription const QString &    desc [inline]
 

Set the description of the palette.

Parameters:
desc  the new description

Definition at line 96 of file kpalette.h.

void KPalette::setEditable Editable    editable [inline]
 

Change whether the palette may be edited.

Parameters:
editable  the state of the palette

Definition at line 134 of file kpalette.h.

References editable(), and Editable.

void KPalette::setName const QString &    name [inline]
 

Set the name of the palette.

Parameters:
name  the name of the palette

Definition at line 110 of file kpalette.h.

References name().


The documentation for this class was generated from the following file:
Generated on Wed Aug 13 23:30:19 2003 for kdelibs by doxygen1.2.18