Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Expand
titleClick here to show Table of Contents
Table of Contents

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.

...

Code Block
languagexml
<genericcontrol >
  <icon > ... </icon>
  <iconcolor > ... </iconcolor>
  <drawmode> ... </drawmode>
</genericcontrol>

<genericcontrol >

<icon > ... </icon>

Tag

Description

icon

Name of an icon resource rendered in the control

<iconcolor > ... </iconcolor>

iconcolor

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

</genericcontrol>

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

Code Block
languagelua
function hasIcon()

...

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

getAsset

Code Block
languagelua
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

Code Block
languagelua
function getDrawMode()

Get the draw mode assigned to this control.

Return values

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

setAsset

Code Block
languagelua
function setAsset(asset)

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

Code Block
languagelua
function setColor(color)

...

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

Code Block
languagelua
function setIcon(bitmap, forcesetDrawMode(drawmodestring)

Set the bitmap rendered in the control. The bitmap will be drawn centered on the control. If the control's size is smaller than the size of the bitmap in any dimension, the bitmap will be scaled so that it fits in the controlGet the draw mode assigned to this control.

Parameters

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

setIcon

Code Block
languagelua
function setIcon(bitmap)

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

Parameters

bitmap   (string)   
The name of the bitmap resource used as the iconforce   (boolean)   
Force the icon value to change even if the icon is not currently definedicon resource to be displayed.