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

N_GUI_DROPMENU_DATA

Module: GUI: allegro5 widget system with pseudo-windows

dropdown menu specific data

#include "n_gui.h"

Public Attributes

Name
int scroll_offset
scroll offset
ALLEGRO_BITMAP * panel_bitmap
optional bitmap for the dropdown panel background (NULL = color theme)
void * on_open_user_data
user data for on_open callback
void(*)(int widget_id, void *user_data) on_open
callback to rebuild dynamic entries each time the menu is opened.
size_t nb_entries
number of entries
int max_visible
max visible items
char[128] label
menu label (shown on the button)
ALLEGRO_BITMAP * item_hover_bitmap
optional bitmap for the hovered entry background (NULL = color theme)
float item_height
item height
int is_open
is the menu currently open
int highlight_index
open-panel navigation cursor for the wheel and Up/Down keys (-1 = none).
int flags
bitmask of N_GUI_DROPMENU_* flags
size_t entries_capacity
allocated capacity
N_GUI_DROPMENU_ENTRY * entries
dynamic array of entries

Public Attributes Documentation

variable scroll_offset

int scroll_offset;

scroll offset

variable panel_bitmap

ALLEGRO_BITMAP * panel_bitmap;

optional bitmap for the dropdown panel background (NULL = color theme)

variable on_open_user_data

void * on_open_user_data;

user data for on_open callback

variable on_open

void(*)(int widget_id, void *user_data) on_open;

callback to rebuild dynamic entries each time the menu is opened.

signature: void rebuild(int widget_id, void* user_data) The callback should call n_gui_dropmenu_clear_dynamic() then add dynamic entries.

variable nb_entries

size_t nb_entries;

number of entries

variable max_visible

int max_visible;

max visible items

variable label

char[128] label;

menu label (shown on the button)

variable item_hover_bitmap

ALLEGRO_BITMAP * item_hover_bitmap;

optional bitmap for the hovered entry background (NULL = color theme)

variable item_height

float item_height;

item height

variable is_open

int is_open;

is the menu currently open

variable highlight_index

int highlight_index;

open-panel navigation cursor for the wheel and Up/Down keys (-1 = none).

While the menu is open, the wheel and arrow keys move this; hovering the panel sets it to the entry under the pointer; Enter or a click activates it. Reset to -1 when the panel closes.

variable flags

int flags;

bitmask of N_GUI_DROPMENU_* flags

variable entries_capacity

size_t entries_capacity;

allocated capacity

variable entries

N_GUI_DROPMENU_ENTRY * entries;

dynamic array of entries