Reference for the Mosaic class WidgetSet::ToggleButtonConfig

WidgetSet::ToggleButtonConfig
FaceLayout
FaceOffActive
FaceOffDefault
FaceOffDisabled
FaceOffFocused
FaceOffFrameActive
FaceOffFrameDefault
FaceOffFrameDisabled
FaceOffFrameFocused
FaceOffTintActive
FaceOffTintDefault
FaceOffTintDisabled
FaceOffTintFocused
FaceOnActive
FaceOnDefault
FaceOnDisabled
FaceOnFocused
FaceOnFrameActive
FaceOnFrameDefault
FaceOnFrameDisabled
FaceOnFrameFocused
FaceOnTintActive
FaceOnTintDefault
FaceOnTintDisabled
FaceOnTintFocused
IconAlignment
IconMarginBottom
IconMarginLeft
IconMarginRight
IconMarginTop
IconOffTintActive
IconOffTintDefault
IconOffTintDisabled
IconOffTintFocused
IconOnTintActive
IconOnTintDefault
IconOnTintDisabled
IconOnTintFocused
KeyCode
LabelAlignment
LabelMarginBottom
LabelMarginLeft
LabelMarginRight
LabelMarginTop
LabelOffColorActive
LabelOffColorDefault
LabelOffColorDisabled
LabelOffColorFocused
LabelOffFont
LabelOnColorActive
LabelOnColorDefault
LabelOnColorDisabled
LabelOnColorFocused
LabelOnFont
PressedFeedbackDuration
WidgetMaxSize
WidgetMinSize
WidgetSet::WidgetConfig

SEE ALSO

Using and customizing the Toggle Button (check box) widget.

This class implements the functionality permitting you to simply customize the look and feel of a bistable 'toggle button' widget (WidgetSet::ToggleButton). In the practice, you will create an instance of this class, configure its properties with bitmaps, colors and other relevant attributes according to your design expectations and assign such prepared configuration object to the property 'Appearance' of every affected toggle button widget. Thereupon the widgets will use the configuration information provided in the object.

During its lifetime the button remains always in one of the four states: 'disabled', 'default', 'focused' and 'active'. The state 'disabled' is true for every not available button (the property 'Enabled' of the button is 'false'). Such buttons will ignore all user inputs. The state 'default' determines a button, which is ready to be touched by the user or ready to become focused. As soon as the button becomes focused, it switches in the state 'focused'. In this state the user can activate the button by pressing a key on the keyboard. Finally, the state 'active' is true, if the user actually interacts with the button (the button is pressed). At the same time, the toggle button distinguishes between two further states: 'on' (checked) and 'off' (unchecked). With the configuration object you can specify the appearance of the button for every state combination individually. For this purpose you should know from which views the button is composed of:

If the button is actually focused, it can also be activated by pressing the keyboard key specified in the property KeyCode. To prevent the button from being able to be focused, initialize this property with the value Core::KeyCode.NoKey. The property PressedFeedbackDuration configures the duration how long the button should appear active (pressed) even if it has been taped for a very short time.

With the properties WidgetMinSize and WidgetMaxSize you can configure size constraints for the widget itself. You can, for example, limit the button to not shrink below a specified width or height.

property Core::Layout FaceLayout = Core::Layout[AlignToBottom, AlignToLeft, AlignToRight, AlignToTop, ResizeHorz, ResizeVert];

The property 'FaceLayout' determines the constraints how the actually displayed face bitmap (FaceOffActive, FaceOffDefault, FaceOffDisabled, FaceOffFocused, FaceOnActive, FaceOnDefault, FaceOnDisabled or FaceOnFocused) should be aligned within the button area. Per default the bitmap fills the button widget entirely.

The constraints 'ResizeVert' and 'ResizeHorz' determine whether the bitmap should be resized to fill the button vertically and/or horizontally. Deactivating the constraint causes the button to display the bitmap with its original height and/or width. In such case you can configure with the constraints 'AlignToTop', 'AlignToBottom', 'AlignToLeft' and 'AlignToRight' how the bitmap should be aligned within the button area.

property Resources::Bitmap FaceOffActive = null;

The property 'FaceOffActive' determines the bitmap to fill the background of the toggle button when the button is switched-off and it is in the 'active' state (the user is actually touching the button or pressing a key on the keyboard the toggle button should react on).

If the specified bitmap contains more than one frame (multi-frame bitmap), the desired frame number can be selected in the property FaceOffFrameActive. If the selected bitmap is intended to be animated, ensure that the property FaceOffFrameActive is -1.

If the specified bitmap contains opacity information only (Alpha8 bitmap), you can tint the bitmap by specifying the desired color in the property FaceOffTintActive. With the property FaceOffTintActive you can also modulate the opacity of a regular bitmap.

Per default, the actually visible face bitmap fills the entire background area of the button. With the property FaceLayout you can modify this behavior and configure the bitmap to retain its original width and/or height. You can also determine how the bitmap should be aligned vertically and horizontally within the button area.

property Resources::Bitmap FaceOffDefault = null;

The property 'FaceOffDefault' determines the bitmap to fill the background of the toggle button when the button is switched-off and it is in the 'default' state.

If the specified bitmap contains more than one frame (multi-frame bitmap), the desired frame number can be selected in the property FaceOffFrameDefault. If the selected bitmap is intended to be animated, ensure that the property FaceOffFrameDefault is -1.

If the specified bitmap contains opacity information only (Alpha8 bitmap), you can tint the bitmap by specifying the desired color in the property FaceOffTintDefault. With the property FaceOffTintDefault you can also modulate the opacity of a regular bitmap.

Per default, the actually visible face bitmap fills the entire background area of the button. With the property FaceLayout you can modify this behavior and configure the bitmap to retain its original width and/or height. You can also determine how the bitmap should be aligned vertically and horizontally within the button area.

property Resources::Bitmap FaceOffDisabled = null;

The property 'FaceOffDisabled' determines the bitmap to fill the background of the toggle button when the button is switched-off and it is in the 'disabled' state (property 'Enabled' of the button is 'false').

If the specified bitmap contains more than one frame (multi-frame bitmap), the desired frame number can be selected in the property FaceOffFrameDisabled. If the selected bitmap is intended to be animated, ensure that the property FaceOffFrameDisabled is -1.

If the specified bitmap contains opacity information only (Alpha8 bitmap), you can tint the bitmap by specifying the desired color in the property FaceOffTintDisabled. With the property FaceOffTintDisabled you can also modulate the opacity of a regular bitmap.

Per default, the actually visible face bitmap fills the entire background area of the button. With the property FaceLayout you can modify this behavior and configure the bitmap to retain its original width and/or height. You can also determine how the bitmap should be aligned vertically and horizontally within the button area.

property Resources::Bitmap FaceOffFocused = null;

The property 'FaceOffFocused' determines the bitmap to fill the background of the toggle button when the button is switched-off and it is in the 'focused' state (the button can react to keyboard events).

If the specified bitmap contains more than one frame (multi-frame bitmap), the desired frame number can be selected in the property FaceOffFrameFocused. If the selected bitmap is intended to be animated, ensure that the property FaceOffFrameFocused is -1.

If the specified bitmap contains opacity information only (Alpha8 bitmap), you can tint the bitmap by specifying the desired color in the property FaceOffTintFocused. With the property FaceOffTintFocused you can also modulate the opacity of a regular bitmap.

Per default, the actually visible face bitmap fills the entire background area of the button. With the property FaceLayout you can modify this behavior and configure the bitmap to retain its original width and/or height. You can also determine how the bitmap should be aligned vertically and horizontally within the button area.

property int32 FaceOffFrameActive = -1;

The property 'FaceOffFrameActive' determines the frame number within the bitmap FaceOffActive. This property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no bitmap is shown.

If the property is initialized with the value -1 and the FaceOffActive bitmap is animated, the animation is automatically started as soon as the button enters the 'active' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 FaceOffFrameDefault = -1;

The property 'FaceOffFrameDefault' determines the frame number within the bitmap FaceOffDefault. This property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no bitmap is shown.

If the property is initialized with the value -1 and the FaceOffDefault bitmap is animated, the animation is automatically started as soon as the button enters the 'default' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 FaceOffFrameDisabled = -1;

The property 'FaceOffFrameDisabled' determines the frame number within the bitmap FaceOffDisabled. This property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no bitmap is shown.

If the property is initialized with the value -1 and the FaceOffDisabled bitmap is animated, the animation is automatically started as soon as the button enters the 'disabled' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 FaceOffFrameFocused = -1;

The property 'FaceOffFrameFocused' determines the frame number within the bitmap FaceOffFocused. This property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no bitmap is shown.

If the property is initialized with the value -1 and the FaceOffFocused bitmap is animated, the animation is automatically started as soon as the button enters the 'focused' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property color FaceOffTintActive = #FFFFFFFF;

The property 'FaceOffTintActive' determines the color value to tint or modulate the bitmap specified in the property FaceOffActive. The effect of this color value depends on the type of the bitmap:

property color FaceOffTintDefault = #FFFFFFFF;

The property 'FaceOffTintDefault' determines the color value to tint or modulate the bitmap specified in the property FaceOffDefault. The effect of this color value depends on the type of the bitmap:

property color FaceOffTintDisabled = #FFFFFFFF;

The property 'FaceOffTintDisabled' determines the color value to tint or modulate the bitmap specified in the property FaceOffDisabled. The effect of this color value depends on the type of the bitmap:

property color FaceOffTintFocused = #FFFFFFFF;

The property 'FaceOffTintFocused' determines the color value to tint or modulate the bitmap specified in the property FaceOffFocused. The effect of this color value depends on the type of the bitmap:

property Resources::Bitmap FaceOnActive = null;

The property 'FaceOnActive' determines the bitmap to fill the background of the toggle button when the button is switched-on and it is in the 'active' state (the user is actually touching the button or pressing a key on the keyboard the toggle button should react on).

If the specified bitmap contains more than one frame (multi-frame bitmap), the desired frame number can be selected in the property FaceOnFrameActive. If the selected bitmap is intended to be animated, ensure that the property FaceOnFrameActive is -1.

If the specified bitmap contains opacity information only (Alpha8 bitmap), you can tint the bitmap by specifying the desired color in the property FaceOnTintActive. With the property FaceOnTintActive you can also modulate the opacity of a regular bitmap.

Per default, the actually visible face bitmap fills the entire background area of the button. With the property FaceLayout you can modify this behavior and configure the bitmap to retain its original width and/or height. You can also determine how the bitmap should be aligned vertically and horizontally within the button area.

property Resources::Bitmap FaceOnDefault = null;

The property 'FaceOnDefault' determines the bitmap to fill the background of the toggle button when the button is switched-on and it is in the 'default' state.

If the specified bitmap contains more than one frame (multi-frame bitmap), the desired frame number can be selected in the property FaceOnFrameDefault. If the selected bitmap is intended to be animated, ensure that the property FaceOnFrameDefault is -1.

If the specified bitmap contains opacity information only (Alpha8 bitmap), you can tint the bitmap by specifying the desired color in the property FaceOnTintDefault. With the property FaceOnTintDefault you can also modulate the opacity of a regular bitmap.

Per default, the actually visible face bitmap fills the entire background area of the button. With the property FaceLayout you can modify this behavior and configure the bitmap to retain its original width and/or height. You can also determine how the bitmap should be aligned vertically and horizontally within the button area.

property Resources::Bitmap FaceOnDisabled = null;

The property 'FaceOnDisabled' determines the bitmap to fill the background of the toggle button when the button is switched-on and it is in the 'disabled' state (property 'Enabled' of the button is 'false').

If the specified bitmap contains more than one frame (multi-frame bitmap), the desired frame number can be selected in the property FaceOnFrameDisabled. If the selected bitmap is intended to be animated, ensure that the property FaceOnFrameDisabled is -1.

If the specified bitmap contains opacity information only (Alpha8 bitmap), you can tint the bitmap by specifying the desired color in the property FaceOnTintDisabled. With the property FaceOnTintDisabled you can also modulate the opacity of a regular bitmap.

Per default, the actually visible face bitmap fills the entire background area of the button. With the property FaceLayout you can modify this behavior and configure the bitmap to retain its original width and/or height. You can also determine how the bitmap should be aligned vertically and horizontally within the button area.

property Resources::Bitmap FaceOnFocused = null;

The property 'FaceOnFocused' determines the bitmap to fill the background of the toggle button when the button is switched-on and it is in the 'focused' state (the button can react to keyboard events).

If the specified bitmap contains more than one frame (multi-frame bitmap), the desired frame number can be selected in the property FaceOnFrameFocused. If the selected bitmap is intended to be animated, ensure that the property FaceOnFrameFocused is -1.

If the specified bitmap contains opacity information only (Alpha8 bitmap), you can tint the bitmap by specifying the desired color in the property FaceOnTintFocused. With the property FaceOnTintFocused you can also modulate the opacity of a regular bitmap.

Per default, the actually visible face bitmap fills the entire background area of the button. With the property FaceLayout you can modify this behavior and configure the bitmap to retain its original width and/or height. You can also determine how the bitmap should be aligned vertically and horizontally within the button area.

property int32 FaceOnFrameActive = -1;

The property 'FaceOnFrameActive' determines the frame number within the bitmap FaceOnActive. This property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no bitmap is shown.

If the property is initialized with the value -1 and the FaceOnActive bitmap is animated, the animation is automatically started as soon as the button enters the 'active' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 FaceOnFrameDefault = -1;

The property 'FaceOnFrameDefault' determines the frame number within the bitmap FaceOnDefault. This property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no bitmap is shown.

If the property is initialized with the value -1 and the FaceOnDefault bitmap is animated, the animation is automatically started as soon as the button enters the 'default' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 FaceOnFrameDisabled = -1;

The property 'FaceOnFrameDisabled' determines the frame number within the bitmap FaceOnDisabled. This property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no bitmap is shown.

If the property is initialized with the value -1 and the FaceOnDisabled bitmap is animated, the animation is automatically started as soon as the button enters the 'disabled' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property int32 FaceOnFrameFocused = -1;

The property 'FaceOnFrameFocused' determines the frame number within the bitmap FaceOnFocused. This property is applicable for multi-frame bitmaps only (see also Resources::Bitmap). If the desired frame is not available in the bitmap, no bitmap is shown.

If the property is initialized with the value -1 and the FaceOnFocused bitmap is animated, the animation is automatically started as soon as the button enters the 'focused' state. If the bitmap is not animated and the property is -1, the frame with number 0 is displayed.

property color FaceOnTintActive = #FFFFFFFF;

The property 'FaceOnTintActive' determines the color value to tint or modulate the bitmap specified in the property FaceOnActive. The effect of this color value depends on the type of the bitmap:

property color FaceOnTintDefault = #FFFFFFFF;

The property 'FaceOnTintDefault' determines the color value to tint or modulate the bitmap specified in the property FaceOnDefault. The effect of this color value depends on the type of the bitmap:

property color FaceOnTintDisabled = #FFFFFFFF;

The property 'FaceOnTintDisabled' determines the color value to tint or modulate the bitmap specified in the property FaceOnDisabled. The effect of this color value depends on the type of the bitmap:

property color FaceOnTintFocused = #FFFFFFFF;

The property 'FaceOnTintFocused' determines the color value to tint or modulate the bitmap specified in the property FaceOnFocused. The effect of this color value depends on the type of the bitmap:

property Views::ImageAlignment IconAlignment = Views::ImageAlignment[AlignHorzCenter, AlignVertCenter];

The property 'IconAlignment' determines how the bitmap specified in the property 'Icon' of the button widget should be aligned.

Per default, the icon is aligned within the entire button area. By using the properties IconMarginLeft, IconMarginRight, IconMarginTop and IconMarginBottom you can limit the area as desired.

property int32 IconMarginBottom = 0;

The property 'IconMarginBottom' determines the gap below the area destined to display the icon bitmap relative to the bottom edge of the button itself.

property int32 IconMarginLeft = 0;

The property 'IconMarginLeft' determines the gap on the left of the area destined to display the icon bitmap relative to the left edge of the button itself.

property int32 IconMarginRight = 0;

The property 'IconMarginRight' determines the gap on the right of the area destined to display the icon bitmap relative to the right edge of the button itself.

property int32 IconMarginTop = 0;

The property 'IconMarginTop' determines the gap above the area destined to display the icon bitmap relative to the top edge of the button itself.

property color IconOffTintActive = #FFFFFFFF;

The property 'IconOffTintActive' determines the color value to tint or modulate the bitmap specified in the property 'Icon' of the button widget if the button is switched-off and it is in the 'active' state (the user is actually touching the button or pressing a key on the keyboard the toggle button should react on). The effect of this color value depends on the type of the bitmap:

property color IconOffTintDefault = #FFFFFFFF;

The property 'IconOffTintDefault' determines the color value to tint or modulate the bitmap specified in the property 'Icon' of the button widget if the button is switched-off and it is in the 'default' state. The effect of this color value depends on the type of the bitmap:

property color IconOffTintDisabled = #FFFFFFFF;

The property 'IconOffTintDisabled' determines the color value to tint or modulate the bitmap specified in the property 'Icon' of the button widget if the button is switched-off and it is in the 'disabled' state (property 'Enabled' of the button is 'false'). The effect of this color value depends on the type of the bitmap:

property color IconOffTintFocused = #FFFFFFFF;

The property 'IconOffTintFocused' determines the color value to tint or modulate the bitmap specified in the property 'Icon' of the button widget if the button is switched-off and it is in the 'focused' state (the button can react to keyboard events). The effect of this color value depends on the type of the bitmap:

property color IconOnTintActive = #FFFFFFFF;

The property 'IconOnTintActive' determines the color value to tint or modulate the bitmap specified in the property 'Icon' of the button widget if the button is switched-on and it is in the 'active' state (the user is actually touching the button or pressing a key on the keyboard the toggle button should react on). The effect of this color value depends on the type of the bitmap:

property color IconOnTintDefault = #FFFFFFFF;

The property 'IconOnTintDefault' determines the color value to tint or modulate the bitmap specified in the property 'Icon' of the button widget if the button is switched-on and it is in the 'default' state. The effect of this color value depends on the type of the bitmap:

property color IconOnTintDisabled = #FFFFFFFF;

The property 'IconOnTintDisabled' determines the color value to tint or modulate the bitmap specified in the property 'Icon' of the button widget if the button is switched-on and it is in the 'disabled' state (property 'Enabled' of the button is 'false'). The effect of this color value depends on the type of the bitmap:

property color IconOnTintFocused = #FFFFFFFF;

The property 'IconOnTintFocused' determines the color value to tint or modulate the bitmap specified in the property 'Icon' of the button widget if the button is switched-on and it is in the 'focused' state (the button can react to keyboard events). The effect of this color value depends on the type of the bitmap:

property Core::KeyCode KeyCode = Core::KeyCode.Enter;

The property 'KeyCode' determines the key, the button should react on when it is focused. In this manner the user can control the widget by using keyboard or hardware buttons.

If this property is initialized with the value Core::KeyCode.NoKey, the button will not be able to become focused and it will not receive any keyboard events.

property Views::TextAlignment LabelAlignment = Views::TextAlignment[AlignHorzCenter, AlignVertCenter];

The property 'LabelAlignment' determines how the text specified in the properties 'LabelOff' and 'LabelOn' of the button widget should be aligned.

Per default, the label is aligned within the entire button area. By using the properties LabelMarginLeft, LabelMarginRight, LabelMarginTop and LabelMarginBottom you can limit the area as desired.

property int32 LabelMarginBottom = 0;

The property 'LabelMarginBottom' determines the gap below the area destined to display the label text relative to the bottom edge of the button itself.

property int32 LabelMarginLeft = 0;

The property 'LabelMarginLeft' determines the gap on the left of the area destined to display the label text relative to the left edge of the button itself.

property int32 LabelMarginRight = 0;

The property 'LabelMarginRight' determines the gap on the right of the area destined to display the label text relative to the right edge of the button itself.

property int32 LabelMarginTop = 0;

The property 'LabelMarginTop' determines the gap above the area destined to display the label text relative to the top edge of the button itself.

property color LabelOffColorActive = #000000FF;

The property 'LabelOffColorActive' determines the color value to use when the text specified in the property 'LabelOff' of the button widget is displayed and the button is switched-off and it is in the 'active' state (the user is actually touching the button or pressing a key on the keyboard the toggle button should react on).

property color LabelOffColorDefault = #000000FF;

The property 'LabelOffColorDefault' determines the color value to use when the text specified in the property 'LabelOff' of the button widget is displayed and the button is switched-off and it is in the 'default' state.

property color LabelOffColorDisabled = #000000FF;

The property 'LabelOffColorDisabled' determines the color value to use when the text specified in the property 'LabelOff' of the button widget is displayed and the button is switched-off and it is in the 'disabled' state (property 'Enabled' of the button is 'false').

property color LabelOffColorFocused = #000000FF;

The property 'LabelOffColorFocused' determines the color value to use when the text specified in the property 'LabelOff' of the button widget is displayed and the button is switched-off and it is in the 'focused' state (the button can react to keyboard events).

property Resources::Font LabelOffFont = null;

The property 'LabelOffFont' determines the font object used to print the text specified in the property 'LabelOff' of the button widget. This text appears only when the button is in the switched-off state. If no font is specified (the property is 'null'), no text is displayed.

property color LabelOnColorActive = #000000FF;

The property 'LabelOnColorActive' determines the color value to use when the text specified in the property 'LabelOn' of the button widget is displayed and the button is switched-on and it is in the 'active' state (the user is actually touching the button or pressing a key on the keyboard the toggle button should react on).

property color LabelOnColorDefault = #000000FF;

The property 'LabelOnColorDefault' determines the color value to use when the text specified in the property 'LabelOn' of the button widget is displayed and the button is switched-on and it is in the 'default' state.

property color LabelOnColorDisabled = #000000FF;

The property 'LabelOnColorDisabled' determines the color value to use when the text specified in the property 'LabelOn' of the button widget is displayed and the button is switched-on and it is in the 'disabled' state (property 'Enabled' of the button is 'false').

property color LabelOnColorFocused = #000000FF;

The property 'LabelOnColorFocused' determines the color value to use when the text specified in the property 'LabelOn' of the button widget is displayed and the button is switched-on and it is in the 'focused' state (the button can react to keyboard events).

property Resources::Font LabelOnFont = null;

The property 'LabelOnFont' determines the font object used to print the text specified in the property 'LabelOn' of the button widget. This text appears only when the button is in the switched-on state. If no font is specified (the property is 'null'), no text is displayed.

property int32 PressedFeedbackDuration = 50;

The property 'PressedFeedbackDuration' determines the minimum time in milliseconds how long the toggle button should appear pressed after the user has tapped it. This ensures, that the user can notice, that the button has been activated even if the user has touched it for a very short period.

property point WidgetMaxSize = <0,0>;

The property 'WidgetMaxSize' determines the maximum allowed size of the widget. Accordingly, the button can't become bigger than the value specified in this property. By using this property you can configure the size constraints for the button.

property point WidgetMinSize = <0,0>;

The property 'WidgetMinSize' determines the minimal allowed size of the widget. Accordingly, the button can't become smaller than the value specified in this property. By using this property you can configure the size constraints for the button.