.TH "KPalette" 3 "28 Jan 2004" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KPalette \- Class for handling Palettes.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kpalette.h>\fP
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBEditable\fP { \fBYes\fP, \fBNo\fP, \fBAsk\fP }"
.br
.RI "\fIUsed to specify whether a palette may be edited. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKPalette\fP (const  \fBQString\fP &name=QString::null)"
.br
.RI "\fIKPalette constructor. \fP"
.ti -1c
.RI "\fBKPalette\fP (const  \fBKPalette\fP &)"
.br
.RI "\fIKPalette copy constructor. \fP"
.ti -1c
.RI "virtual \fB~KPalette\fP ()"
.br
.RI "\fIKPalette destructor. \fP"
.ti -1c
.RI "\fBKPalette\fP & \fBoperator=\fP (const  \fBKPalette\fP &)"
.br
.RI "\fIKPalette assignment operator. \fP"
.ti -1c
.RI "bool \fBsave\fP ()"
.br
.RI "\fISave the palette. \fP"
.ti -1c
.RI "\fBQString\fP \fBdescription\fP () const "
.br
.RI "\fIGet the description of the palette. \fP"
.ti -1c
.RI "void \fBsetDescription\fP (const  \fBQString\fP &desc)"
.br
.RI "\fISet the description of the palette. \fP"
.ti -1c
.RI "\fBQString\fP \fBname\fP () const "
.br
.RI "\fIGet the name of the palette. \fP"
.ti -1c
.RI "void \fBsetName\fP (const  \fBQString\fP &name)"
.br
.RI "\fISet the name of the palette. \fP"
.ti -1c
.RI "\fBEditable\fP \fBeditable\fP () const "
.br
.RI "\fIReturns whether the palette may be edited. \fP"
.ti -1c
.RI "void \fBsetEditable\fP (\fBEditable\fP editable)"
.br
.RI "\fIChange whether the palette may be edited. \fP"
.ti -1c
.RI "int \fBnrColors\fP () const "
.br
.RI "\fIReturn the number of colors in the palette. \fP"
.ti -1c
.RI "\fBQColor\fP \fBcolor\fP (int index)"
.br
.RI "\fIFind color by index. \fP"
.ti -1c
.RI "int \fBfindColor\fP (const  \fBQColor\fP &color) const "
.br
.RI "\fIFind index by \fCcolor\fP. \fP"
.ti -1c
.RI "\fBQString\fP \fBcolorName\fP (int index)"
.br
.RI "\fIFind color name by \fCindex\fP. \fP"
.ti -1c
.RI "\fBQString\fP \fBcolorName\fP (const  \fBQColor\fP &color)"
.br
.RI "\fIFind color name by \fCcolor\fP. \fP"
.ti -1c
.RI "int \fBaddColor\fP (const  \fBQColor\fP &newColor, const  \fBQString\fP &newColorName=QString::null)"
.br
.RI "\fIAdd a color. \fP"
.ti -1c
.RI "int \fBchangeColor\fP (int index, const  \fBQColor\fP &newColor, const  \fBQString\fP &newColorName=QString::null)"
.br
.RI "\fIChange a color. \fP"
.ti -1c
.RI "int \fBchangeColor\fP (const  \fBQColor\fP &oldColor, const  \fBQColor\fP &newColor, const  \fBQString\fP &newColorName=QString::null)"
.br
.RI "\fIChange a color. \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "\fBQStringList\fP \fBgetPaletteList\fP ()"
.br
.RI "\fIQuery which \fBKDE\fP palettes are installed. \fP"
.in -1c
.SH "Detailed Description"
.PP 
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.
.PP
This class uses the 'GIMP' palette file format.
.PP
This class is totally unrelated to \fBQPalette\fP.
.PP
\fBAuthor:\fP
.RS 4
Waldo Bastian (bastian@kde.org) 
.RE
.PP
\fBVersion:\fP
.RS 4
\fBId\fP.RS 4
\fBkpalette.h\fP,v 1.8 2002/09/19 19:39:49 tjansen Exp 
.RE
.PP
.RE
.PP

.PP
Definition at line 46 of file kpalette.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBKPalette::Editable\fP"
.PP
Used to specify whether a palette may be edited. \fBSee also:\fP
.RS 4
\fBeditable()\fP 
.PP
\fBsetEditable()\fP 
.RE
.PP

.PP
\fBEnumeration values: \fP
.in +1c
.TP
\fB\fIYes \fP\fP
Palette may be edited. 
.TP
\fB\fINo \fP\fP
Palette may not be edited. 
.TP
\fB\fIAsk \fP\fP
Ask user before editing. 
.PP
Definition at line 118 of file kpalette.h.
.PP
Referenced by editable().
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KPalette::KPalette (const \fBQString\fP & name = QString::null)"
.PP
KPalette constructor. Creates a KPalette from a file the filename is derived from the name. 
.PP
\fBParameters:\fP
.RS 4
\fIname\fP The name of palette as returned by \fBgetPaletteList\fP() 
.RE
.PP
Definition at line 50 of file kpalette.cpp.
.PP
References QPtrList< kolor >::append(), QString::ascii(), QFile::exists(), QString::find(), QString::isEmpty(), QString::mid(), KStdAction::name(), QFile::open(), QFile::readLine(), QPtrList< kolor >::setAutoDelete(), and QString::stripWhiteSpace().
.SS "KPalette::KPalette (const \fBKPalette\fP &)"
.PP
KPalette copy constructor. Definition at line 112 of file kpalette.cpp.
.PP
References QPtrList< kolor >::append(), QPtrList::first(), QPtrList::next(), and QPtrList< kolor >::setAutoDelete().
.SS "KPalette::~\fBKPalette\fP ()\fC [virtual]\fP"
.PP
KPalette destructor. Definition at line 126 of file kpalette.cpp.
.SH "Member Function Documentation"
.PP 
.SS "\fBQStringList\fP KPalette::getPaletteList ()\fC [static]\fP"
.PP
Query which \fBKDE\fP palettes are installed. \fBReturns:\fP
.RS 4
A list with a palette names. 
.RE
.PP
Definition at line 34 of file kpalette.cpp.
.PP
References KGlobal::dirs(), and KStandardDirs::findAllResources().
.SS "\fBKPalette\fP & KPalette::operator= (const \fBKPalette\fP &)"
.PP
KPalette assignment operator. Definition at line 159 of file kpalette.cpp.
.PP
References QPtrList< kolor >::append(), QPtrList< kolor >::clear(), QPtrList::first(), mDesc, mEditable, mKolorList, mName, and QPtrList::next().
.SS "bool KPalette::save ()"
.PP
Save the palette. \fBReturns:\fP
.RS 4
'true' if successful 
.RE
.PP
Definition at line 132 of file kpalette.cpp.
.PP
References KSaveFile::close(), KStdAccel::description(), description(), QPtrList::first(), QPtrList::next(), QStringList::split(), KSaveFile::status(), QString::stripWhiteSpace(), and KSaveFile::textStream().
.SS "\fBQString\fP KPalette::description () const\fC [inline]\fP"
.PP
Get the description of the palette. \fBReturns:\fP
.RS 4
the description of the palette. 
.RE
.PP
Definition at line 89 of file kpalette.h.
.PP
Referenced by save().
.SS "void KPalette::setDescription (const \fBQString\fP & desc)\fC [inline]\fP"
.PP
Set the description of the palette. \fBParameters:\fP
.RS 4
\fIdesc\fP the new description 
.RE
.PP
Definition at line 96 of file kpalette.h.
.SS "\fBQString\fP KPalette::name () const\fC [inline]\fP"
.PP
Get the name of the palette. \fBReturns:\fP
.RS 4
the name of the palette 
.RE
.PP
Definition at line 103 of file kpalette.h.
.SS "void KPalette::setName (const \fBQString\fP & name)\fC [inline]\fP"
.PP
Set the name of the palette. \fBParameters:\fP
.RS 4
\fIname\fP the name of the palette 
.RE
.PP
Definition at line 110 of file kpalette.h.
.PP
References KStdAction::name().
.SS "\fBEditable\fP KPalette::editable () const\fC [inline]\fP"
.PP
Returns whether the palette may be edited. \fBReturns:\fP
.RS 4
the state of the palette 
.RE
.PP
Definition at line 127 of file kpalette.h.
.PP
References Editable.
.SS "void KPalette::setEditable (\fBEditable\fP editable)\fC [inline]\fP"
.PP
Change whether the palette may be edited. \fBParameters:\fP
.RS 4
\fIeditable\fP the state of the palette 
.RE
.PP
Definition at line 134 of file kpalette.h.
.SS "int KPalette::nrColors () const\fC [inline]\fP"
.PP
Return the number of colors in the palette. \fBReturns:\fP
.RS 4
the number of colors 
.RE
.PP
Definition at line 141 of file kpalette.h.
.PP
References QPtrList< kolor >::count().
.PP
Referenced by addColor(), changeColor(), color(), and colorName().
.SS "\fBQColor\fP KPalette::color (int index)"
.PP
Find color by index. \fBParameters:\fP
.RS 4
\fIindex\fP the index of the desired color 
.RE
.PP
\fBReturns:\fP
.RS 4
The \fCindex\fP -th color of the palette, null if not found. 
.RE
.PP
Definition at line 178 of file kpalette.cpp.
.PP
References QPtrList< kolor >::at(), and nrColors().
.SS "int KPalette::findColor (const \fBQColor\fP & color) const"
.PP
Find index by \fCcolor\fP. \fBParameters:\fP
.RS 4
\fIcolor\fP the color to find 
.RE
.PP
\fBReturns:\fP
.RS 4
The index of the color in the palette or -1 if the color is not found. 
.RE
.PP
Definition at line 191 of file kpalette.cpp.
.PP
References QPtrListIterator::current().
.PP
Referenced by changeColor(), and colorName().
.SS "\fBQString\fP KPalette::colorName (int index)"
.PP
Find color name by \fCindex\fP. \fBParameters:\fP
.RS 4
\fIthe\fP index of the color 
.RE
.PP
\fBReturns:\fP
.RS 4
The name of the \fCindex\fP -th color. Note that not all palettes have named the colors. Null is returned if the color does not exist or has no name. 
.RE
.PP
Definition at line 204 of file kpalette.cpp.
.PP
References QPtrList< kolor >::at(), and nrColors().
.PP
Referenced by colorName().
.SS "\fBQString\fP KPalette::colorName (const \fBQColor\fP & color)\fC [inline]\fP"
.PP
Find color name by \fCcolor\fP. \fBReturns:\fP
.RS 4
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. 
.RE
.PP
Definition at line 175 of file kpalette.h.
.PP
References colorName(), and findColor().
.SS "int KPalette::addColor (const \fBQColor\fP & newColor, const \fBQString\fP & newColorName = QString::null)"
.PP
Add a color. \fBParameters:\fP
.RS 4
\fInewColor\fP The color to add. 
.br
\fInewColorName\fP The name of the color, null to remove the name. 
.RE
.PP
\fBReturns:\fP
.RS 4
The index of the added color. 
.RE
.PP
Definition at line 217 of file kpalette.cpp.
.PP
References QPtrList< kolor >::append(), QColor::name(), and nrColors().
.SS "int KPalette::changeColor (int index, const \fBQColor\fP & newColor, const \fBQString\fP & newColorName = QString::null)"
.PP
Change a color. \fBParameters:\fP
.RS 4
\fIindex\fP Index of the color to change 
.br
\fInewColor\fP The new color. 
.br
\fInewColorName\fP The new color name, null to remove the name. 
.RE
.PP
\fBReturns:\fP
.RS 4
The index of the new color or -1 if the color couldn't be changed. 
.RE
.PP
Definition at line 227 of file kpalette.cpp.
.PP
References QPtrList< kolor >::at(), QColor::name(), and nrColors().
.PP
Referenced by changeColor().
.SS "int KPalette::changeColor (const \fBQColor\fP & oldColor, const \fBQColor\fP & newColor, const \fBQString\fP & newColorName = QString::null)\fC [inline]\fP"
.PP
Change a color. \fBParameters:\fP
.RS 4
\fIoldColor\fP The original color 
.br
\fInewColor\fP The new color. 
.br
\fInewColorName\fP The new color name, null to remove the name. 
.RE
.PP
\fBReturns:\fP
.RS 4
The index of the new color or -1 if the color couldn't be changed. 
.RE
.PP
Definition at line 210 of file kpalette.h.
.PP
References changeColor(), and findColor().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
