PaletteList Class Reference

The JavaScript class providing information about a palette list. Obtain from PaletteObjectManager methods like getPaletteListByElementId, getScenePaletteList or getPaletteListById. More...

Public Slots

String getPath ()
 Returns the folder in which this palette list is located. More...
 
bool isValid ()
 Returns true if the palette list object is valid. More...
 
PalettegetPaletteByIndex (int index)
 Returns a Palette object for the palette at position 'index'. More...
 
PalettegetPaletteById (String id)
 Returns a Palette object for the palette with ID 'id'. More...
 
PalettegetPaletteById (String id, bool lookInLinkedPalettes)
 Returns a Palette object for the palette with ID 'id'. More...
 
bool getLock ()
 Try getting the database lock, returning true on success or false on failure. Without the lock, methods that change the state of the palette list can fail. More...
 
bool releaseLock ()
 Release the lock. More...
 
PalettecreatePalette (String &path)
 Create a new palette from a path String. More...
 
PalettecreatePalette (String &path, int index)
 Create a palette from a path String, inserted at position Index. More...
 
PalettecreatePaletteAtLocation (int location, int elementId, String diskName)
 Create a Palette at a physical location relative to the project. More...
 
PalettecreatePaletteAtLocation (int location, int elementId, String diskName, int index)
 Create a Palette at a physical location relative to the project, inserted at index in the paletteList. More...
 
PaletteaddPalette (String &path)
 Adds a palette to the end of this palette list, returning a Palette object. More...
 
PaletteinsertPalette (String &path, int index)
 Adds a palette to this palette list at the position specified by 'index', returning a Palette object. More...
 
PaletteaddPaletteAtLocation (int location, int elementId, String &name)
 Adds a palette to the end of this palette list, returning a Palette object. More...
 
PaletteinsertPaletteAtLocation (int location, int elementId, String &name, int index)
 Adds a palette to this palette list at the position specified by 'index', returning a Palette object. More...
 
bool removePaletteByIndex (int index)
 Remove the palette at the position specified by 'index'. More...
 
bool removePaletteById (String id)
 Remove the palette with the specified palette ID. More...
 
bool removePalette (String &path)
 Remove the palette by path. More...
 
PalettefindPaletteOfColor (String &colorId)
 Search the given color ID and return the first match, also looking in the scene palette list if applicable. More...
 
bool movePaletteUp (String &id)
 Move the specified palette up one place in this palette list. More...
 
bool movePaletteDown (String &id)
 Move the specified palette down one place in this palette list. More...
 
bool isLoaded ()
 Returns true if the palette was successfully loaded from the disk. More...
 

Properties

int numPalettes
 Number of palettes in this palette list. More...
 
String id
 The palette list ID of this palette list. More...
 
int type
 The type of palette list. One of the PaletteListType constants. More...
 
int elementId
 Will return the elementId of this palette list if the type is PaletteListType.Element. Will return -1 if the type is PaletteListType.Scene. More...
 

Detailed Description

The JavaScript class providing information about a palette list. Obtain from PaletteObjectManager methods like getPaletteListByElementId, getScenePaletteList or getPaletteListById.

Defines a collection of palettes.

Provides access to some of the standard functionality of palette lists. Some methods change the state of the palette list. If the database access lock cannot be obtained, they will throw a javascript exception.

Member Function Documentation

◆ addPalette

Palette* PaletteList::addPalette ( String &  path)
slot

Adds a palette to the end of this palette list, returning a Palette object.

Parameters
path: Path to existing palette file.
Note
Adding a palette in a palette list of type PaletteListType.Hidden is not allowed and will return an invalid palette.
Returns
Returns the palette.

◆ addPaletteAtLocation

Palette* PaletteList::addPaletteAtLocation ( int  location,
int  elementId,
String &  name 
)
slot

Adds a palette to the end of this palette list, returning a Palette object.

Parameters
location: One of the valid PaletteLocation constants in that context. Any value except PaletteLocation.EXTERNAL.
elementId: The element ID if location is PaletteLocation.ELEMENT. Ignored in other cases.
name: The disk name of the palette.
Note
Adding a palette in a palette list of type PaletteListType.Hidden is not allowed and will return an invalid palette.
Returns
Returns the palette.

◆ createPalette [1/2]

Palette* PaletteList::createPalette ( String &  path)
slot

Create a new palette from a path String.

If the file indicated by path already exists, it will append a number to the path to create a unique name.

Parameters
path: The path to create the palette from.
Returns
Returns the created palette.

◆ createPalette [2/2]

Palette* PaletteList::createPalette ( String &  path,
int  index 
)
slot

Create a palette from a path String, inserted at position Index.

If the file indicated by path already exists, it will append a number to the path to create a unique name.

Parameters
path: The path to create the palette from.
index: The index for the created palette to be inserted at.
Returns
Returns the created palette.

◆ createPaletteAtLocation [1/2]

Palette* PaletteList::createPaletteAtLocation ( int  location,
int  elementId,
String  diskName 
)
slot

Create a Palette at a physical location relative to the project.

If the location is not in an element, the parameter element ID is ignored.

Parameters
location: The location for the palette to be created at.
elementId: The Id of the element found at the location.
diskName: The name of the disk.
Returns
Returns the created palette.

◆ createPaletteAtLocation [2/2]

Palette* PaletteList::createPaletteAtLocation ( int  location,
int  elementId,
String  diskName,
int  index 
)
slot

Create a Palette at a physical location relative to the project, inserted at index in the paletteList.

If the location is not in an element, the parameter element ID is ignored.

Parameters
location: The location for the palette to be created at.
elementId: The Id of the element found at the location.
diskName: The name of the disk.
index: The index that the new plaette will be inserted at.
Returns
Returns the created palette.

◆ findPaletteOfColor

Palette* PaletteList::findPaletteOfColor ( String &  colorId)
slot

Search the given color ID and return the first match, also looking in the scene palette list if applicable.

Parameters
colorId: The color ID to search.
Returns
Returns the palette where the color will be found.

◆ getLock

bool PaletteList::getLock ( )
slot

Try getting the database lock, returning true on success or false on failure. Without the lock, methods that change the state of the palette list can fail.

Returns
Returns the lock state, true if set.

◆ getPaletteById [1/2]

Palette* PaletteList::getPaletteById ( String  id)
slot

Returns a Palette object for the palette with ID 'id'.

Parameters
id: palette ID of palette in this palette list.
Returns
Returns a Palette object for the palette with ID 'id'.

◆ getPaletteById [2/2]

Palette* PaletteList::getPaletteById ( String  id,
bool  lookInLinkedPalettes 
)
slot

Returns a Palette object for the palette with ID 'id'.

Parameters
id: Palette ID of palette in this palette list.
lookInLinkedPalettes: whether to look in other accessible palettes, typically the scene palette List when searching from an element palette list.
Returns
Returns a Palette object for the palette with ID 'id'.

◆ getPaletteByIndex

Palette* PaletteList::getPaletteByIndex ( int  index)
slot

Returns a Palette object for the palette at position 'index'.

Parameters
index: Index of palette in this palette list.
Returns
Returns a Palette object for the palette at position 'index'.

◆ getPath

String PaletteList::getPath ( )
slot

Returns the folder in which this palette list is located.

Returns
Returns the folder in which this palette list is located.

◆ insertPalette

Palette* PaletteList::insertPalette ( String &  path,
int  index 
)
slot

Adds a palette to this palette list at the position specified by 'index', returning a Palette object.

Parameters
path: Path to existing palette file.
index: The index of the position where the palette is inserted.
Note
Inserting a palette in a palette list of type PaletteListType.Hidden is not allowed and will return an invalid palette.
Returns
Returns the palette.

◆ insertPaletteAtLocation

Palette* PaletteList::insertPaletteAtLocation ( int  location,
int  elementId,
String &  name,
int  index 
)
slot

Adds a palette to this palette list at the position specified by 'index', returning a Palette object.

Parameters
location: One of the valid PaletteLocation constants in that context. Any value except PaletteLocation.EXTERNAL.
elementId: The element ID if location is PaletteLocation.ELEMENT. Ignored in other cases.
name: Path to existing palette file.
index: The index of the position where the palette is inserted.
Note
Inserting a palette in a palette list of type PaletteListType.Hidden is not allowed and will return an invalid palette.
Returns
Returns the palette.

◆ isLoaded

bool PaletteList::isLoaded ( )
slot

Returns true if the palette was successfully loaded from the disk.

Returns
Returns true if the palette was successfully loaded from the disk.

◆ isValid

bool PaletteList::isValid ( )
slot

Returns true if the palette list object is valid.

Returns
Returns true if the pallete list object is valid. A palette list object is valid if it can be obtained from the palette list.

◆ movePaletteDown

bool PaletteList::movePaletteDown ( String &  id)
slot

Move the specified palette down one place in this palette list.

Parameters
id: ID of the palette to move.
Returns
Returns true if the palette is successfully moved.

◆ movePaletteUp

bool PaletteList::movePaletteUp ( String &  id)
slot

Move the specified palette up one place in this palette list.

Parameters
id: ID of the palette to move.
Returns
Returns true if the palette is successfully moved.

◆ releaseLock

bool PaletteList::releaseLock ( )
slot

Release the lock.

Returns
Returns true if the lock is successfully released.

◆ removePalette

bool PaletteList::removePalette ( String &  path)
slot

Remove the palette by path.

Parameters
path: The path of the palette to remove.
Returns
Returns true if the palette is successfully removed.

◆ removePaletteById

bool PaletteList::removePaletteById ( String  id)
slot

Remove the palette with the specified palette ID.

Parameters
id: ID of the palette to remove.
Returns
Returns true if the palette is successfully removed.

◆ removePaletteByIndex

bool PaletteList::removePaletteByIndex ( int  index)
slot

Remove the palette at the position specified by 'index'.

Parameters
index: Index of palette to remove.
Returns
Returns true if the palatte is successfully removed.

Property Documentation

◆ elementId

int PaletteList::elementId
read

Will return the elementId of this palette list if the type is PaletteListType.Element. Will return -1 if the type is PaletteListType.Scene.

◆ id

String PaletteList::id
read

The palette list ID of this palette list.

◆ numPalettes

int PaletteList::numPalettes
read

Number of palettes in this palette list.

◆ type

int PaletteList::type
read

The type of palette list. One of the PaletteListType constants.