Button 1.0 beta 1
Description
Button is a Litestep module that lets you create skinnable push buttons and
place them anywhere on your desktop. Buttons can change their appearance
and run commands in response to user mouse actions.
Loading the Module
Add a new LoadModule line to the Litestep configuration file,
similar to the following:
LoadModule "c:\path\to\button.dll"
Of course, just loading the module doesn't do anything. You must create one
or more buttons and configure them.
Creating a Button
You can create buttons automatically when Litestep loads or you can create
them manually as Litestep is running. To create a button automatically you
specify its name in a *Button command in the Litestep
configuration file. Example:
*Button MyButton
*Button ExampleButton
*Button Button1
These three commands create three buttons named MyButton,
ExampleButton, and Button1 respectively. Note that each
button must have its own *Button command. To create a button
manually you specify its name in a call to the !ButtonCreate
bang command. Example:
!ButtonCreate AnotherButton
This creates a button named AnotherButton.
Destroying a Button
There is technically no need to explicitly destroy buttons. When Litestep
shuts down or recycles, all buttons are automatically destroyed regardless
of how they were created. However, it is possible to explicitly destroy a
button using the !ButtonDestroy bang command.
!ButtonDestroy works for all buttons whether they are created
automatically or manually.
Configuration
The following configuration commands must be placed in the Litestep
configuration file. See the Litestep documentation for information on how
to modify this file.
In the command names given below Button is a placeholder for the
button's name. So to set the text for a button named ExampleButton,
the command you would actually put in step.rc would be
ExampleButtonText.
ButtonAlign
left, center, or right
Sets the horizontal alignment of the button's contents. The default is
center.
ButtonAlpha
number
Sets the button's alpha value (opacity) which is a number between zero
(fully transparent) and 255 (fully opaque). This command only works on
Windows 2000 and XP.
ButtonAlwaysOnTop
Makes the button always on top so that it remains above application
windows. By default a button is pinned to the desktop and remains below
application windows.
ButtonBottomBorder
number
Sets the number of pixels on the bottom edge to reserve as a border. The
default is zero.
ButtonHeight
number
Sets the height of the button in pixels. The default is zero.
ButtonIcon
filename
Specifies the name of an image file to be used as an icon. Despite the name,
the file does not have to be a Windows icon file (.ico); it can be any image
file type supported by Litestep. If the file is a Windows icon file then the
ButtonIconSize command specifies which size to use. By default a
button does not have an icon.
ButtonIconPosition
left, right, top, or bottom
Sets the position of the button's icon relative to the text. The default is
left.
ButtonIconSize
number
Sets the size of a button's icon in pixels if the icon is Windows icon
file (.ico). This is necessary because an icon file can contain multiple
images of different sizes. If the icon is not an icon file then this command
is ignored. The default is 16.
ButtonIconTextGap
number
Sets the number of pixels between the button's icon and its text. The
default is 4.
ButtonLeftBorder
number
Sets the number of pixels on the left edge to reserve as a border. The
default is zero.
ButtonRightBorder
number
Sets the number of pixels on the right edge to reserve as a border. The
default is zero.
ButtonStartHidden
Makes the button initially invisible.
ButtonText
text
Sets the text that the button displays. By default a button does not display
any text.
ButtonToolTipText
text
Sets the text displayed by the button's tool tip. By default a button does not
have a tool tip.
ButtonTopBorder
number
Sets the number of pixels on the top edge to reserve as a border. The
default is zero.
ButtonVertAlign
top, center, or bottom
Sets the vertical alignment of the button's contents. The default is
center.
ButtonWidth
number
Sets the width of the button in pixels. The default is zero.
ButtonX
number
Sets the horizontal position of the button. The default is zero.
ButtonY
number
Sets the vertical position of the button. The default is zero.
Fonts and Skins
A button has three visual states: normal, hover and pressed. When the mouse
is outside the button it is in the normal state. When the mouse is inside
the button it is in the hover state. When the mouse is inside the button and
a mouse button is pressed it is in the pressed state.
Buttons can have different fonts and skins for each state. By default the
settings for the hover and pressed states inherit the values from the normal
state. So, for example, if you don't specify a font to use in the pressed
state, then when pressed the button will use the normal font. This even works
on a per-setting basis. If you want to make the font underlined when in the
hover state you need only add the ButtonHoverFontUnderline command;
the font name, color, etc. will be inherited from the normal state settings.
ButtonFont
font
Font name in the normal state. The default is Arial.
ButtonFontBold
boolean
Whether font is bold in the normal state. The default is false.
ButtonFontColor
color
Font color in the normal state. The default is black.
ButtonFontHeight
number
Font height (in pixels) in the normal state. The default is 15.
ButtonFontItalic
boolean
Whether font is italic in the normal state. The default is false.
ButtonFontUnderline
boolean
Whether font is underlined in the normal state. The default is false.
ButtonHoverFont
font
Font name in the hover state.
ButtonHoverFontBold
boolean
Whether font is bold in the hover state.
ButtonHoverFontColor
color
Font color in the hover state.
ButtonHoverFontHeight
number
Font height (in pixels) in the hover state.
ButtonHoverFontItalic
boolean
Whether font is italic in the hover state.
ButtonHoverFontUnderline
boolean
Whether font is underlined in the hover state.
ButtonPressedFont
font
Font name in the pressed state.
ButtonPressedFontBold
boolean
Whether font is bold in the pressed state.
ButtonPressedFontColor
color
Font color in the pressed state.
ButtonPressedFontHeight
number
Font height (in pixels) in the pressed state.
ButtonPressedFontItalic
boolean
Whether font is italic in the pressed state.
ButtonPressedFontUnderline
boolean
Whether font is underlined in the pressed state.
ButtonSkin
filename
Background image in the normal state.
ButtonSkinBottomEdge
number
Number of pixels on the bottom edge that shouldn't be scaled in the normal
state. The default is zero.
ButtonSkinLeftEdge
number
Number of pixels on the left edge that shouldn't be scaled in the normal
state. The default is zero.
ButtonSkinMode
stretch, tile, horizontaltile, or verticaltile
How to scale the background image in the normal state. The default is
stretch.
ButtonSkinRightEdge
number
Number of pixels on the right edge that shouldn't be scaled in the normal
state. The default is zero.
ButtonSkinTopEdge
number
Number of pixels on the top edge that shouldn't be scaled in the normal
state. The default is zero.
ButtonHoverSkin
filename
Background image in the hover state.
ButtonHoverSkinBottomEdge
number
Number of pixels on the bottom edge that shouldn't be scaled in the hover
state.
ButtonHoverSkinLeftEdge
number
Number of pixels on the left edge that shouldn't be scaled in the hover
state.
ButtonHoverSkinMode
stretch, tile, horizontaltile, or verticaltile
How to scale the background image in the hover state.
ButtonHoverSkinRightEdge
number
Number of pixels on the right edge that shouldn't be scaled in the hover
state.
ButtonHoverSkinTopEdge
number
Number of pixels on the top edge that shouldn't be scaled in the hover
state.
ButtonPressedSkin
filename
Background image in the pressed state.
ButtonPressedSkinBottomEdge
number
Number of pixels on the bottom edge that shouldn't be scaled in the pressed
state.
ButtonPressedSkinLeftEdge
number
Number of pixels on the left edge that shouldn't be scaled in the pressed
state.
ButtonPressedSkinMode
stretch, tile, horizontaltile, or verticaltile
How to scale the background image in the pressed state.
ButtonPressedSkinRightEdge
number
Number of pixels on the right edge that shouldn't be scaled in the pressed
state.
ButtonPressedSkinTopEdge
number
Number of pixels on the top edge that shouldn't be scaled in the pressed
state.
ButtonHoverOffsetX
number
Number of pixels that the button's content is shifted horizontally in the
hover state. The default is zero.
ButtonHoverOffsetY
number
Number of pixels that the button's content is shifted vertically in the
hover state. The default is zero.
ButtonPressedOffsetX
number
Number of pixels that the button's content is shifted horizontally in the
pressed state. The default is 1.
ButtonPressedOffsetY
number
Number of pixels that the button's content is shifted vertically in the
pressed state. The default is 1.
Events
Events allow you execute programs or bang commands based on user
interaction with the button. The following work the same as configuration
settings. Each one takes the name of a program or bang commands as its
value. When the event is triggered, the program or bang command is
executed. Note that in the case of mouse clicks, assigning an action to
both the click and the double click event will not work.
ButtonOnEnter
action
Executes action when the mouse enters the button.
ButtonOnLeave
action
Executes action when the mouse leaves the button.
ButtonOnLeftClick
action
Executes action when the user clicks the button with the left mouse button.
ButtonOnLeftDoubleClick
action
Executes action when the user double clicks the button with the left mouse button.
ButtonOnMiddleClick
action
Executes action when the user clicks the button with the middle mouse button.
ButtonOnMiddleDoubleClick
action
Executes action when the user double clicks the button with the middle mouse button.
ButtonOnRightClick
action
Executes action when the user clicks the button with the right mouse button.
ButtonOnRightDoubleClick
action
Executes action when the user double clicks the button with the right mouse button.
Bang Commands
Bang commands allow you to manipulate buttons while Litestep is running
through scripts or other modules. See the Litestep documentation for more
information about bang commands and how to use them.
Unlike configuration commands, the bang command names are exactly as they are
listed below. The first parameter to every bang command is the name of the
button that is the target of that command. Commands directed at buttons that
don't exist are ignored (expect for !ButtonCreate, obviously).
!ButtonAlwaysOnTop
name
Makes the button always on top so that it remains above application
windows.
!ButtonCreate
name
Creates a new button.
!ButtonDestroy
name
Destroys a button, releasing any resources that it was using.
!ButtonHide
name
Hides the button, making it invisible.
!ButtonMoveBy
name dx dy
Moves the button horizontally dx pixels and vertically
dy pixels relative to its current location.
!ButtonMoveTo
name x y
Moves the button to the absolute coordinates (x, y).
!ButtonPinToDesktop
name
Pins the button to the desktop so that it remains below application
windows. This is the opposite of always on top.
!ButtonResizeBy
name dx dy
Resizes the button horizontally dx pixels and vertically
dy pixels relative to its current size.
!ButtonResizeTo
name width height
Resizes the button so that its size is width pixels by
height pixels.
!ButtonSetAlpha
name number
Sets the button's alpha value (opacity) which is a number between zero
(fully transparent) and 255 (fully opaque). This command only works on
Windows 2000 and XP.
!ButtonShow
name
Shows a button, making it visible.
!ButtonToggle
name
Switches a button between the visible and invisible states.
!ButtonToggleAlwaysOnTop
name
Switches a button between the always on top and
pinned to desktop states.