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

N_GUI_SB_TRACK

Module: GUI: allegro5 widget system with pseudo-windows

Where a scrollbar a widget draws inside itself was last painted, and whether the pointer is on it. More...

#include "n_gui.h"

Public Attributes

Name
float y
top edge
float x
left edge, in the coordinates the paint drew in
float w
width; zero when no bar was painted
int hovered
non-zero while the pointer is inside the rectangle above, and while a drag that began inside it is still going
float h
height; zero when no bar was painted

Detailed Description

struct N_GUI_SB_TRACK;

Where a scrollbar a widget draws inside itself was last painted, and whether the pointer is on it.

Such a bar is highlighted while the pointer is over the bar, and not otherwise: widget-level hover would be no answer, because the pointer is over a row or a cell far more often than over the bar, and keyboard focus is no answer either, because a widget with two bars has one focus and two bars to light with it.

Somebody therefore has to answer "is the pointer on this bar". The geometry is worked out by the paint, once per widget type, and the paint has no pointer position to test against; the event pass has the pointer and no geometry. So the paint records the rectangle here and the event pass hit-tests it. The answer is one frame old at worst, and that is a frame in which the pointer did not move.

Zero initialised with the widget, and a zero width or height means the bar was not painted, so it can never be hit.

Public Attributes Documentation

variable y

float y;

top edge

variable x

float x;

left edge, in the coordinates the paint drew in

variable w

float w;

width; zero when no bar was painted

variable hovered

int hovered;

non-zero while the pointer is inside the rectangle above, and while a drag that began inside it is still going

variable h

float h;

height; zero when no bar was painted