org.kde.koala

Class KPalette

public class KPalette extends Object implements QtSupport

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)

UNKNOWN: Class for handling Palettes.

Field Summary
static intAsk
static intNo
static intYes
Used to specify whether a palette may be edited.
Constructor Summary
protected KPalette(Class dummy)
KPalette(String name)
KPalette constructor.
KPalette()
KPalette(KPalette arg1)
KPalette copy constructor.
Method Summary
intaddColor(QColor newColor, String newColorName)
Add a color.
intaddColor(QColor newColor)
intchangeColor(int index, QColor newColor, String newColorName)
Change a color.
intchangeColor(int index, QColor newColor)
intchangeColor(QColor oldColor, QColor newColor, String newColorName)
Change a color.
intchangeColor(QColor oldColor, QColor newColor)
QColorcolor(int index)
Find color by index.
StringcolorName(int index)
Find color name by index.
StringcolorName(QColor color)
Find color name by color.
Stringdescription()
Get the description of the palette.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
inteditable()
Returns whether the palette may be edited.
protected voidfinalize()
Deletes the wrapped C++ instance
intfindColor(QColor color)
Find index by color.
static ArrayListgetPaletteList()
Query which KDE palettes are installed.
booleanisDisposed()
Has the wrapped C++ instance been deleted?
Stringname()
Get the name of the palette.
intnrColors()
Return the number of colors in the palette.
booleansave()
Save the palette
voidsetDescription(String desc)
Set the description of the palette.
voidsetEditable(int editable)
Change whether the palette may be edited.
voidsetName(String name)
Set the name of the palette.

Field Detail

Ask

public static final int Ask

No

public static final int No

Yes

public static final int Yes
Used to specify whether a palette may be edited.

See Also: KPalette KPalette

UNKNOWN: Used to specify whether a palette may be edited.

Constructor Detail

KPalette

protected KPalette(Class dummy)

KPalette

public KPalette(String name)
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()

UNKNOWN: KPalette constructor.

KPalette

public KPalette()

KPalette

public KPalette(KPalette arg1)
KPalette copy constructor.

UNKNOWN: KPalette copy constructor.

Method Detail

addColor

public int addColor(QColor newColor, String newColorName)
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.

UNKNOWN: Add a color.

addColor

public int addColor(QColor newColor)

changeColor

public int changeColor(int index, QColor newColor, String newColorName)
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.

UNKNOWN: Change a color.

changeColor

public int changeColor(int index, QColor newColor)

changeColor

public int changeColor(QColor oldColor, QColor newColor, String newColorName)
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.

UNKNOWN: Change a color.

changeColor

public int changeColor(QColor oldColor, QColor newColor)

color

public QColor 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.

UNKNOWN: Find color by index.

colorName

public String colorName(int index)
Find color name by index.

Parameters: index 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.

UNKNOWN: Find color name by index.

colorName

public String colorName(QColor color)
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.

UNKNOWN: Find color name by color.

description

public String description()
Get the description of the palette.

Returns: the description of the palette.

UNKNOWN: Get the description of the palette.

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

editable

public int editable()
Returns whether the palette may be edited.

Returns: the state of the palette

UNKNOWN: Returns whether the palette may be edited.

finalize

protected void finalize()
Deletes the wrapped C++ instance

findColor

public int findColor(QColor color)
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.

UNKNOWN: Find index by color.

getPaletteList

public static ArrayList getPaletteList()
Query which KDE palettes are installed.

Returns: A list with a palette names.

UNKNOWN: Query which KDE palettes are installed.

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

name

public String name()
Get the name of the palette.

Returns: the name of the palette

UNKNOWN: Get the name of the palette.

nrColors

public int nrColors()
Return the number of colors in the palette.

Returns: the number of colors

UNKNOWN: Return the number of colors in the palette.

save

public boolean save()
Save the palette

Returns: 'true' if successful

UNKNOWN: Save the palette

setDescription

public void setDescription(String desc)
Set the description of the palette.

Parameters: desc the new description

UNKNOWN: Set the description of the palette.

setEditable

public void setEditable(int editable)
Change whether the palette may be edited.

Parameters: editable the state of the palette

UNKNOWN: Change whether the palette may be edited.

setName

public void setName(String name)
Set the name of the palette.

Parameters: name the name of the palette

UNKNOWN: Set the name of the palette.