Buttons
Info
Dependencies:
- PermMem
- View
Implementation:
Buffs.d on GitHub
This package extends the handling of the mouse and allows creating rectangular buttons, which react to mouse (hover) entry and exit as well as a mouse click.
Initialization
Initialize with LeGo_Buttons
flag.
Functions
Button_Create
Button_Create
Creates a button. It is initially hidden (not visible and does not react to the mouse). The three callback functions have the following signature void f(int handle)
.
var int posx
The horizontal position of the button in virtual coordinatesvar int posy
The vertical position of the button in virtual coordinatesvar int width
Width of the button in virtual coordinatesvar int height
Height of the button in virtual coordinatesvar string tex
Name of the button texturevar func on_enter
This function is called when the mouse enters the buttonvar func on_leave
This function is called when the mouse leaves the buttonvar func on_click
This function is called when the user performs a mouse click on the button (left mouse button)
Return value
The function returns a handle to created button.
Button_CreatePxl
Button_CreatePxl
Button_Create
with pixels instead of virtual coordinates.
var int posx
The horizontal position of the button in pixelsvar int posy
The vertical position of the button in pixelsvar int width
Width of the button in pixelsvar int height
Height of the button in pixelsvar string tex
Name of the button texturevar func on_enter
This function is called when the mouse enters the buttonvar func on_leave
This function is called when the mouse leaves the buttonvar func on_click
This function is called when the user performs a mouse click on the button (left mouse button)
Return value
The function returns a handle to created button.
Button_Delete
Button_Delete
Completely deletes a button.
var int hndl
Handle returned fromButton_Create
Button_Show
Button_Show
Shows the button and makes it respond to the mouse.
var int hndl
Handle returned fromButton_Create
Button_Hide
Button_Hide
Hides the button and disables it, so it is no longer responding to the mouse.
var int hndl
Handle returned fromButton_Create
Button_SetTexture
Button_SetTexture
Sets the texture of the button.
var int hndl
Handle returned fromButton_Create
var string tex
Name of the new texture
Button_SetCaption
Button_SetCaption
Displays a centered text on the button.
var int hndl
Handle returned fromButton_Create
var string caption
The text to be displayedvar string font
The font in which the text should be displayed
Button_CreateMouseover
Button_CreateMouseover
Attaches a mouseover box to the cursor.
var string text
The text in the mouseover boxvar string font
The font of the text
Button_DeleteMouseover
Button_Activate
Button_Activate
Activates the button, so it reacts to the mouse. Does not change the visibility.
var int hndl
Handle returned fromButton_Create
Button_Deactivate
Button_Deactivate
Disables the button, so it no longer reacts to the mouse.
var int hndl
Handle returned fromButton_Create
Button_SetUserData
Button_SetUserData
Sets the user data of the button, an integer, to give the button individual information.
var int hndl
Handle returned fromButton_Create
var int data
Individual integer of the button (part of the internal_Button
class)
Button_GetUserData
Button_GetUserData
Gets the user data of the button.
var int hndl
Handle returned fromButton_Create
Return value
The function returns the user data of the button.
Button_GetState
Button_GetState
Gets the status of the button as a bit field. See User Constants.
var int hndl
Handle returned fromButton_Create
Return value
The function returns the status of the button.
Button_Move
Button_Move
Moves the button by the given value in pixels. posx = posx + nposx
var int hndl
Handle returned fromButton_Create
var int nposx
X-axis shift in pixelsvar int nposy
Y-axis shift in pixels
Button_MoveVrt
Button_MoveVrt
Moves the button by the given value in virtual coordinates. posx = posx + nposx
var int hndl
Handle returned fromButton_Create
var int nposx
X-axis shift in virtual coordinatesvar int nposy
Y-axis shift in virtual coordinates
Button_MoveTo
Button_MoveTo
Moves a button to the given position in pixels. posx = nposx
var int hndl
Handle returned fromButton_Create
var int nposx
New horizontal position in pixelsvar int nposy
New vertical position in pixels
Button_MoveToVrt
Button_MoveToVrt
Moves a button to the given position in virtual coordinates. posx = nvposx
var int hndl
Handle returned fromButton_Create
var int nvposx
New horizontal position in virtual coordinatesvar int nvposy
New vertical position in virtual coordinates
Button_GetViewHandle
Button_GetViewHandle
Returns the button's zCView
as a handle.
var int hndl
Handle returned fromButton_Create
Return value
The function returns the button's zCView
as a handle.
Button_GetViewPtr
Button_GetViewPtr
Returns the button's zCView
as a pointer.
var int hndl
Handle returned fromButton_Create
Return value
The function returns the button's zCView
as a pointer.
Button_GetView
Button_GetView
Returns the button's zCView
as an object.
var int hndl
Handle returned fromButton_Create
Return value
The function returns the button's zCView
as an object.
Button_GetCaptionPtr
Button_GetCaptionPtr
Returns the pointer to the text of the button.
var int hndl
Handle returned fromButton_Create
Return value
The function returns the pointer to the text of the button.