5 Struct N_GUI_SLIDER_DATA
gullradriel edited this page 2026-10-09 00:55:18 +02:00

N_GUI_SLIDER_DATA

Module: GUI: allegro5 widget system with pseudo-windows

slider specific data

#include "n_gui.h"

Public Attributes

Name
int value_visible
draw the built-in value label next to/below the handle.
char[32] value_format
printf-style format string applied to the numeric value when the built-in readout draws.
double value
current value (always snapped to step)
void * user_data
user data for callback
ALLEGRO_BITMAP * track_bitmap
optional bitmap for the track/rail background (NULL = color theme)
double step
step increment (0 is treated as 1).
int orientation
orientation: N_GUI_SLIDER_H or N_GUI_SLIDER_V
void(*)(int widget_id, double value, void *user_data) on_change
callback on value change
int mode
mode: N_GUI_SLIDER_VALUE or N_GUI_SLIDER_PERCENT
double min_val
minimum value
double max_val
maximum value
double key_step
increment applied by the arrow keys and the mouse wheel, when it should differ from step.
int has_default
non-zero once n_gui_slider_set_default() gave the slider a default, which a double click on it puts back
ALLEGRO_BITMAP * handle_hover_bitmap
optional bitmap for the handle on hover (NULL = fallback to handle_bitmap)
ALLEGRO_BITMAP * handle_bitmap
optional bitmap for the draggable handle, normal state (NULL = color theme)
ALLEGRO_BITMAP * handle_active_bitmap
optional bitmap for the handle while dragging (NULL = fallback to handle_bitmap)
ALLEGRO_BITMAP * fill_bitmap
optional bitmap for the filled portion of the track (NULL = color theme)
double default_value
the value a double click puts back, when has_default is set

Public Attributes Documentation

variable value_visible

int value_visible;

draw the built-in value label next to/below the handle.

Default 1 (on) for backward compatibility. Set to 0 when the consumer is already painting the value elsewhere (e.g. a status bar) to avoid the double-render gotcha.

variable value_format

char[32] value_format;

printf-style format string applied to the numeric value when the built-in readout draws.

Empty (first byte '\0') selects the legacy defaults: "%.1f" for VALUE mode, "%.0f%%" for PERCENT. Set via n_gui_slider_set_value_format().

variable value

double value;

current value (always snapped to step)

variable user_data

void * user_data;

user data for callback

variable track_bitmap

ALLEGRO_BITMAP * track_bitmap;

optional bitmap for the track/rail background (NULL = color theme)

variable step

double step;

step increment (0 is treated as 1).

All values snap to nearest multiple of step from min_val.

variable orientation

int orientation;

orientation: N_GUI_SLIDER_H or N_GUI_SLIDER_V

variable on_change

void(*)(int widget_id, double value, void *user_data) on_change;

callback on value change

variable mode

int mode;

mode: N_GUI_SLIDER_VALUE or N_GUI_SLIDER_PERCENT

variable min_val

double min_val;

minimum value

variable max_val

double max_val;

maximum value

variable key_step

double key_step;

increment applied by the arrow keys and the mouse wheel, when it should differ from step.

0 falls back to step, and then to a twentieth of the range, which is what every slider did before this existed. Set via n_gui_slider_set_key_step().

variable has_default

int has_default;

non-zero once n_gui_slider_set_default() gave the slider a default, which a double click on it puts back

variable handle_hover_bitmap

ALLEGRO_BITMAP * handle_hover_bitmap;

optional bitmap for the handle on hover (NULL = fallback to handle_bitmap)

variable handle_bitmap

ALLEGRO_BITMAP * handle_bitmap;

optional bitmap for the draggable handle, normal state (NULL = color theme)

variable handle_active_bitmap

ALLEGRO_BITMAP * handle_active_bitmap;

optional bitmap for the handle while dragging (NULL = fallback to handle_bitmap)

variable fill_bitmap

ALLEGRO_BITMAP * fill_bitmap;

optional bitmap for the filled portion of the track (NULL = color theme)

variable default_value

double default_value;

the value a double click puts back, when has_default is set