• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Types | Public Member Functions | Static Public Member Functions | List of all members
KPalette Class Reference

#include <kpalette.h>

Public Types

enum  Editable { Yes , No , Ask }
 

Public Member Functions

 KPalette (const TQString &name=TQString::null)
 
 KPalette (const KPalette &)
 
virtual ~KPalette ()
 
KPalette & operator= (const KPalette &)
 
bool save ()
 
TQString description () const
 
void setDescription (const TQString &desc)
 
TQString name () const
 
void setName (const TQString &name)
 
Editable editable () const
 
void setEditable (Editable editable)
 
int nrColors () const
 
TQColor color (int index)
 
int findColor (const TQColor &color) const
 
TQString colorName (int index)
 
TQString colorName (const TQColor &color)
 
int addColor (const TQColor &newColor, const TQString &newColorName=TQString::null)
 
int changeColor (int index, const TQColor &newColor, const TQString &newColorName=TQString::null)
 
int changeColor (const TQColor &oldColor, const TQColor &newColor, const TQString &newColorName=TQString::null)
 

Static Public Member Functions

static TQStringList 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 TQPalette.

Author
Waldo Bastian (basti.nosp@m.an@k.nosp@m.de.or.nosp@m.g)

Definition at line 46 of file kpalette.h.

Member Enumeration Documentation

◆ Editable

enum KPalette::Editable

Used to specify whether a palette may be edited.

See also
editable()
setEditable()
Enumerator
Yes 

Palette may be edited.

No 

Palette may not be edited.

Ask 

Ask user before editing.

Definition at line 118 of file kpalette.h.

Constructor & Destructor Documentation

◆ KPalette() [1/2]

KPalette::KPalette ( const TQString &  name = TQString::null)

KPalette constructor.

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

Parameters
nameThe name of palette as returned by getPaletteList()

Definition at line 50 of file kpalette.cpp.

◆ KPalette() [2/2]

KPalette::KPalette ( const KPalette &  p)

KPalette copy constructor.

Definition at line 108 of file kpalette.cpp.

◆ ~KPalette()

KPalette::~KPalette ( )
virtual

KPalette destructor.

Definition at line 122 of file kpalette.cpp.

Member Function Documentation

◆ addColor()

int KPalette::addColor ( const TQColor &  newColor,
const TQString &  newColorName = TQString::null 
)

Add a color.

Parameters
newColorThe color to add.
newColorNameThe name of the color, null to remove the name.
Returns
The index of the added color.

Definition at line 213 of file kpalette.cpp.

◆ changeColor() [1/2]

int KPalette::changeColor ( const TQColor &  oldColor,
const TQColor &  newColor,
const TQString &  newColorName = TQString::null 
)
inline

Change a color.

Parameters
oldColorThe original color
newColorThe new color.
newColorNameThe 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.

◆ changeColor() [2/2]

int KPalette::changeColor ( int  index,
const TQColor &  newColor,
const TQString &  newColorName = TQString::null 
)

Change a color.

Parameters
indexIndex of the color to change
newColorThe new color.
newColorNameThe 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 223 of file kpalette.cpp.

◆ color()

TQColor KPalette::color ( int  index)

Find color by index.

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

Definition at line 174 of file kpalette.cpp.

◆ colorName() [1/2]

TQString KPalette::colorName ( const TQColor &  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.

◆ colorName() [2/2]

TQString KPalette::colorName ( int  index)

Find color name by index.

Parameters
indexthe 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.

Definition at line 200 of file kpalette.cpp.

◆ description()

TQString 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()

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.

◆ findColor()

int KPalette::findColor ( const TQColor &  color) const

Find index by color.

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

Definition at line 187 of file kpalette.cpp.

◆ getPaletteList()

TQStringList KPalette::getPaletteList ( )
static

Query which KDE palettes are installed.

Returns
A list with a palette names.

Definition at line 34 of file kpalette.cpp.

◆ name()

TQString KPalette::name ( ) const
inline

Get the name of the palette.

Returns
the name of the palette

Definition at line 103 of file kpalette.h.

◆ nrColors()

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.

◆ operator=()

KPalette & KPalette::operator= ( const KPalette &  p)

KPalette assignment operator.

Definition at line 155 of file kpalette.cpp.

◆ save()

bool KPalette::save ( )

Save the palette.

Returns
'true' if successful

Definition at line 128 of file kpalette.cpp.

◆ setDescription()

void KPalette::setDescription ( const TQString &  desc)
inline

Set the description of the palette.

Parameters
descthe new description

Definition at line 96 of file kpalette.h.

◆ setEditable()

void KPalette::setEditable ( Editable  editable)
inline

Change whether the palette may be edited.

Parameters
editablethe state of the palette

Definition at line 134 of file kpalette.h.

◆ setName()

void KPalette::setName ( const TQString &  name)
inline

Set the name of the palette.

Parameters
namethe name of the palette

Definition at line 110 of file kpalette.h.


The documentation for this class was generated from the following files:
  • kpalette.h
  • kpalette.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.