genericcontrol

Inherits

windowcontrol

Context

windowinstance

A generic control has no other functionality than displaying an optional icon centered in the control. This control type is intended to work as a generic basis for custom control setups. See windowcontrol for generic properties of window controls and widgetcontainer for information on widgets.

Definition

<genericcontrol > <icon > ... </icon> <iconcolor > ... </iconcolor> <drawmode> ... </drawmode> </genericcontrol>

Tag

Description

icon

Name of an icon resource rendered in the control

iconcolor

The color of the icon in the for #aarrggbb. If alpha is zero or not defined, FF is assumed.

drawmode

Valid values are: ““ (default), “fill”, “fit”.
”” = The default draw mode will only adjust icon/asset size if too large for control size. Otherwise, icon/asset is drawn at original dimensions in the center of the control.
”fill” = Scale asset to fill control.
”fit” = Scale asset to fit control.

Interface

hasIcon

function hasIcon()

Checks whether the control contains a valid icon.

Return values

(boolean)
Returns true if there is a valid icon, false otherwise

getAsset

function getAsset()

Get the asset assigned to this control (if any). An empty string will be returned if no asset assigned.

Return values

(string)   
The key of the asset resource currently set.

getDrawMode

Get the draw mode assigned to this control.

Return values

(string)   
The draw mode string set for this control (See Definition above.)

setAsset

Set the given asset to be drawn in the control, based on the draw mode.

Parameters

asset (string)   
The key of the asset resource to be displayed.

setColor

Set the color that the icon image is modulated with. The modulation operation scales the color components of the pixels in the bitmap from zero to the value in the original bitmap, thus adjusting the hue of the image. The image color values can't be scaled up using this functionality.

Parameters

color   (string)   
The color specified as a HTML compatible string representing an RGB color with an alpha (transparency) value. The format of the string is 'aarrggbb', and each component is presented as a hexadecimal value from 00 to FF. If alpha is zero or not defined, FF is assumed.

setDrawMode

Get the draw mode assigned to this control.

Parameters

drawmodestring (string)   
The draw mode string to be set for this control (See Definition above.)

setIcon

Set the given icon to be drawn in the control, based on the draw mode.

Parameters

bitmap   (string)   
The name of the icon resource to be displayed.