Skip to content

Latest commit

 

History

History
90 lines (50 loc) · 4.23 KB

GuiBitmapButtonCtrl.rst

File metadata and controls

90 lines (50 loc) · 4.23 KB

GuiBitmapButtonCtrl

A button that renders its various states (mouse over, pushed, etc.) from separate bitmaps.

Inherit:

GuiButtonCtrl

Description

A bitmapped button is a push button that uses one or more texture images for rendering its individual states.

To find the individual textures associated with the button, a naming scheme is used. For each state a suffix is appended to the texture file name given in the GuiBitmapButtonCtrl::bitmap field:

If a bitmap for a particular state cannot be found, the default bitmap will be used. To disable all state-based bitmap functionality, set useStates to false which will make the control solely render from the bitmap specified in the bitmap field.

Per-Modifier Button Actions

If GuiBitmapButtonCtrl::useModifiers is set to true, per-modifier button actions and textures are enabled. This functionality allows to associate different images and different actions with a button depending on which modifiers are pressed on the keyboard by the user.

When enabled, this functionality alters the texture lookup above by prepending the following strings to the suffixes listed above:

When this functionality is enabled, a new set of callbacks is used:

GuiControl::command or GuiControl::onAction() still work as before when per-modifier functionality is enabled.

Note that modifiers cannot be mixed. If two or more modifiers are pressed, a single one will take precedence over the remaining modifiers. The order of precedence corresponds to the order listed above.

Example:

// Create an OK button that will trigger an onOk() call on its parent when clicked:
%okButton = newGuiBitmapButtonCtrl()
{
   bitmap = "art/gui/okButton";
   autoFitExtents = true;
   command = "$ThisControl.getParent().onOk();";
};

Methods

Fields