\section{KPalette Class Reference}
\label{classKPalette}\index{KPalette@{KPalette}}
Class for handling Palettes.  


{\tt \#include $<$kpalette.h$>$}

Collaboration diagram for KPalette:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=97pt]{classKPalette__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Editable} \{ {\bf Yes}, 
{\bf No}, 
{\bf Ask}
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KPalette} (const {\bf QString} \&name=QString::null)
\item 
{\bf KPalette} (const {\bf KPalette} \&)
\item 
virtual {\bf $\sim$KPalette} ()
\item 
{\bf KPalette} \& {\bf operator=} (const {\bf KPalette} \&)
\item 
bool {\bf save} ()
\item 
{\bf QString} {\bf description} () const 
\item 
void {\bf set\-Description} (const {\bf QString} \&desc)
\item 
{\bf QString} {\bf name} () const 
\item 
void {\bf set\-Name} (const {\bf QString} \&name)
\item 
{\bf Editable} {\bf editable} () const 
\item 
void {\bf set\-Editable} ({\bf Editable} editable)
\item 
int {\bf nr\-Colors} () const 
\item 
{\bf QColor} {\bf color} (int index)
\item 
int {\bf find\-Color} (const {\bf QColor} \&color) const 
\item 
{\bf QString} {\bf color\-Name} (int index)
\item 
{\bf QString} {\bf color\-Name} (const {\bf QColor} \&color)
\item 
int {\bf add\-Color} (const {\bf QColor} \&new\-Color, const {\bf QString} \&new\-Color\-Name=QString::null)
\item 
int {\bf change\-Color} (int index, const {\bf QColor} \&new\-Color, const {\bf QString} \&new\-Color\-Name=QString::null)
\item 
int {\bf change\-Color} (const {\bf QColor} \&old\-Color, const {\bf QColor} \&new\-Color, const {\bf QString} \&new\-Color\-Name=QString::null)
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QString\-List} {\bf get\-Palette\-List} ()
\end{CompactItemize}


\subsection{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 \char`\"{}GIMP\char`\"{} palette file format.

This class is totally unrelated to {\bf QPalette}.

\begin{Desc}
\item[Author:]Waldo Bastian ({\tt bastian@kde.org}) \end{Desc}




Definition at line 46 of file kpalette.h.

\subsection{Member Enumeration Documentation}
\index{KPalette@{KPalette}!Editable@{Editable}}
\index{Editable@{Editable}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KPalette::Editable}}\label{classKPalette_w3}


Used to specify whether a palette may be edited. 

\begin{Desc}
\item[See also:]{\bf editable()}{\rm (p.\,\pageref{classKPalette_a9})} 

{\bf set\-Editable()}{\rm (p.\,\pageref{classKPalette_a10})} \end{Desc}
\begin{Desc}
\item[Enumeration values: ]\par
\begin{description}
\index{Yes@{Yes}!KPalette@{KPalette}}\index{KPalette@{KPalette}!Yes@{Yes}}\item[{\em 
Yes\label{classKPalette_w3w0}
}]Palette may be edited. \index{No@{No}!KPalette@{KPalette}}\index{KPalette@{KPalette}!No@{No}}\item[{\em 
No\label{classKPalette_w3w1}
}]Palette may not be edited. \index{Ask@{Ask}!KPalette@{KPalette}}\index{KPalette@{KPalette}!Ask@{Ask}}\item[{\em 
Ask\label{classKPalette_w3w2}
}]Ask user before editing. \end{description}
\end{Desc}



Definition at line 118 of file kpalette.h.

\subsection{Constructor \& Destructor Documentation}
\index{KPalette@{KPalette}!KPalette@{KPalette}}
\index{KPalette@{KPalette}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPalette::KPalette (const {\bf QString} \& {\em name} = {\tt QString::null})}\label{classKPalette_a0}


KPalette constructor. 

Creates a KPalette from a file the filename is derived from the name. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]The name of palette as returned by {\bf get\-Palette\-List()}{\rm (p.\,\pageref{classKPalette_e0})} \end{description}
\end{Desc}


Definition at line 50 of file kpalette.cpp.

References QPtr\-List::append(), QString::ascii(), QFile::exists(), QString::find(), QString::is\-Empty(), QString::mid(), QFile::open(), QFile::read\-Line(), QPtr\-List::set\-Auto\-Delete(), and QString::strip\-White\-Space().\index{KPalette@{KPalette}!KPalette@{KPalette}}
\index{KPalette@{KPalette}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPalette::KPalette (const {\bf KPalette} \&)}\label{classKPalette_a1}


KPalette copy constructor. 



Definition at line 112 of file kpalette.cpp.

References QPtr\-List::append(), QPtr\-List::first(), QPtr\-List::next(), and QPtr\-List::set\-Auto\-Delete().\index{KPalette@{KPalette}!~KPalette@{$\sim$KPalette}}
\index{~KPalette@{$\sim$KPalette}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPalette::$\sim${\bf KPalette} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKPalette_a2}


KPalette destructor. 



Definition at line 126 of file kpalette.cpp.

\subsection{Member Function Documentation}
\index{KPalette@{KPalette}!getPaletteList@{getPaletteList}}
\index{getPaletteList@{getPaletteList}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KPalette::get\-Palette\-List ()\hspace{0.3cm}{\tt  [static]}}\label{classKPalette_e0}


Query which {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} palettes are installed. 

\begin{Desc}
\item[Returns:]A list with a palette names. \end{Desc}


Definition at line 34 of file kpalette.cpp.

References KGlobal::dirs(), and KStandard\-Dirs::find\-All\-Resources().\index{KPalette@{KPalette}!operator=@{operator=}}
\index{operator=@{operator=}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KPalette} \& KPalette::operator= (const {\bf KPalette} \&)}\label{classKPalette_a3}


KPalette assignment operator. 



Definition at line 159 of file kpalette.cpp.

References QPtr\-List::append(), QPtr\-List::clear(), QPtr\-List::first(), and QPtr\-List::next().\index{KPalette@{KPalette}!save@{save}}
\index{save@{save}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPalette::save ()}\label{classKPalette_a4}


Save the palette. 

\begin{Desc}
\item[Returns:]'true' if successful \end{Desc}


Definition at line 132 of file kpalette.cpp.

References KSave\-File::close(), description(), QPtr\-List::first(), QPtr\-List::next(), QString\-List::split(), KSave\-File::status(), QString::strip\-White\-Space(), and KSave\-File::text\-Stream().\index{KPalette@{KPalette}!description@{description}}
\index{description@{description}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KPalette::description () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a5}


Get the description of the palette. 

\begin{Desc}
\item[Returns:]the description of the palette. \end{Desc}


Definition at line 89 of file kpalette.h.

Referenced by save().\index{KPalette@{KPalette}!setDescription@{setDescription}}
\index{setDescription@{setDescription}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPalette::set\-Description (const {\bf QString} \& {\em desc})\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a6}


Set the description of the palette. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em desc}]the new description \end{description}
\end{Desc}


Definition at line 96 of file kpalette.h.\index{KPalette@{KPalette}!name@{name}}
\index{name@{name}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KPalette::name () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a7}


Get the name of the palette. 

\begin{Desc}
\item[Returns:]the name of the palette \end{Desc}


Definition at line 103 of file kpalette.h.\index{KPalette@{KPalette}!setName@{setName}}
\index{setName@{setName}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPalette::set\-Name (const {\bf QString} \& {\em name})\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a8}


Set the name of the palette. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the palette \end{description}
\end{Desc}


Definition at line 110 of file kpalette.h.\index{KPalette@{KPalette}!editable@{editable}}
\index{editable@{editable}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Editable} KPalette::editable () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a9}


Returns whether the palette may be edited. 

\begin{Desc}
\item[Returns:]the state of the palette \end{Desc}


Definition at line 127 of file kpalette.h.\index{KPalette@{KPalette}!setEditable@{setEditable}}
\index{setEditable@{setEditable}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPalette::set\-Editable ({\bf Editable} {\em editable})\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a10}


Change whether the palette may be edited. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em editable}]the state of the palette \end{description}
\end{Desc}


Definition at line 134 of file kpalette.h.\index{KPalette@{KPalette}!nrColors@{nrColors}}
\index{nrColors@{nrColors}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPalette::nr\-Colors () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a11}


Return the number of colors in the palette. 

\begin{Desc}
\item[Returns:]the number of colors \end{Desc}


Definition at line 141 of file kpalette.h.

Referenced by add\-Color(), change\-Color(), color(), and color\-Name().\index{KPalette@{KPalette}!color@{color}}
\index{color@{color}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KPalette::color (int {\em index})}\label{classKPalette_a12}


Find color by index. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em index}]the index of the desired color \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The {\tt index} -th color of the palette, null if not found. \end{Desc}


Definition at line 178 of file kpalette.cpp.

References QPtr\-List::at(), and nr\-Colors().

Referenced by find\-Color().\index{KPalette@{KPalette}!findColor@{findColor}}
\index{findColor@{findColor}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPalette::find\-Color (const {\bf QColor} \& {\em color}) const}\label{classKPalette_a13}


Find index by {\tt color}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em color}]the color to find \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The index of the color in the palette or -1 if the color is not found. \end{Desc}


Definition at line 191 of file kpalette.cpp.

References color(), and QPtr\-List\-Iterator::current().\index{KPalette@{KPalette}!colorName@{colorName}}
\index{colorName@{colorName}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KPalette::color\-Name (int {\em index})}\label{classKPalette_a14}


Find color name by {\tt index}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em index}]the index of the color \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The name of the {\tt 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. \end{Desc}


Definition at line 204 of file kpalette.cpp.

References QPtr\-List::at(), and nr\-Colors().\index{KPalette@{KPalette}!colorName@{colorName}}
\index{colorName@{colorName}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KPalette::color\-Name (const {\bf QColor} \& {\em color})\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a15}


Find color name by {\tt color}. 

\begin{Desc}
\item[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. \end{Desc}


Definition at line 175 of file kpalette.h.\index{KPalette@{KPalette}!addColor@{addColor}}
\index{addColor@{addColor}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPalette::add\-Color (const {\bf QColor} \& {\em new\-Color}, const {\bf QString} \& {\em new\-Color\-Name} = {\tt QString::null})}\label{classKPalette_a16}


Add a color. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em new\-Color}]The color to add. \item[{\em new\-Color\-Name}]The name of the color, null to remove the name. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The index of the added color. \end{Desc}


Definition at line 217 of file kpalette.cpp.

References QPtr\-List::append(), and nr\-Colors().\index{KPalette@{KPalette}!changeColor@{changeColor}}
\index{changeColor@{changeColor}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPalette::change\-Color (int {\em index}, const {\bf QColor} \& {\em new\-Color}, const {\bf QString} \& {\em new\-Color\-Name} = {\tt QString::null})}\label{classKPalette_a17}


Change a color. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em index}]Index of the color to change \item[{\em new\-Color}]The new color. \item[{\em new\-Color\-Name}]The new color name, null to remove the name. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The index of the new color or -1 if the color couldn't be changed. \end{Desc}


Definition at line 227 of file kpalette.cpp.

References QPtr\-List::at(), and nr\-Colors().\index{KPalette@{KPalette}!changeColor@{changeColor}}
\index{changeColor@{changeColor}!KPalette@{KPalette}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPalette::change\-Color (const {\bf QColor} \& {\em old\-Color}, const {\bf QColor} \& {\em new\-Color}, const {\bf QString} \& {\em new\-Color\-Name} = {\tt QString::null})\hspace{0.3cm}{\tt  [inline]}}\label{classKPalette_a18}


Change a color. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em old\-Color}]The original color \item[{\em new\-Color}]The new color. \item[{\em new\-Color\-Name}]The new color name, null to remove the name. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The index of the new color or -1 if the color couldn't be changed. \end{Desc}


Definition at line 210 of file kpalette.h.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kpalette.h\item 
kpalette.cpp\end{CompactItemize}
