|
Gama C Library
Gama C API Documentation
|
Defines the theme and functionality for a toggle switch widget. More...
Go to the source code of this file.
Data Structures | |
| struct | gmwSwitchTheme |
| Structure defining the visual theme for a switch widget. More... | |
Functions | |
| int | gmw_switch_anim (double x, double y, double width, double height, int *value, double *anim) |
| Creates and renders an animated switch widget that toggles on click. | |
| int | gmw_switch (double x, double y, double width, double height, int *value) |
| Creates and renders a switch widget that toggles on click (non-animated version). | |
Variables | |
| gmwSwitchTheme | gmwSwitch |
| Global switch theme instance with default values. | |
Defines the theme and functionality for a toggle switch widget.
This file provides structures for customizing the appearance of an on-screen toggle switch and a function to render an interactive switch that allows users to toggle a boolean state.
| int gmw_switch | ( | double | x, |
| double | y, | ||
| double | width, | ||
| double | height, | ||
| int * | value ) |
Creates and renders a switch widget that toggles on click (non-animated version).
This is a simplified wrapper around gmw_switch_anim that does not use a separate animated visual position, causing the knob to snap to the current value.
| x | The x-coordinate of the switch's center. |
| y | The y-coordinate of the switch's center. |
| width | The width of the switch. |
| height | The height of the switch. |
| value | Pointer to an integer to store the switch state (0=off, 1=on). |
| int gmw_switch_anim | ( | double | x, |
| double | y, | ||
| double | width, | ||
| double | height, | ||
| int * | value, | ||
| double * | anim ) |
Creates and renders an animated switch widget that toggles on click.
This function draws a toggle switch, tracks mouse interaction to update its state, and animates the knob's position smoothly between 'off' (0) and 'on' (1).
| x | The x-coordinate of the switch's center. |
| y | The y-coordinate of the switch's center. |
| width | The width of the switch. |
| height | The height of the switch. |
| value | Pointer to an integer to store the switch state (0 for off, 1 for on). This value is toggled by user clicks. |
| anim | Pointer to a double for the animated visual position of the knob. If NULL, value is used for the knob's position (non-animated). |
| gmwSwitchTheme gmwSwitch |
Global switch theme instance with default values.