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

N_GUI_TEXTAREA_DATA

Module: GUI: allegro5 widget system with pseudo-windows

text area specific data

#include "n_gui.h"

Public Attributes

Name
void * user_data
user data for callback
size_t text_len
current text length
size_t text_alloc
allocated buffer size (char_limit + 1)
char * text
text content (dynamically allocated, text_alloc bytes)
void * suggest_user_data
user data handed back to the provider
char[8] suggest_separators
characters that end a word, so a field holding a list completes the one the cursor is in rather than the whole line.
int suggest_scroll
first item the panel shows
char[128] suggest_prefix
the word the answers are for, so the provider is asked once per word rather than once per key
int suggest_open
the panel is up
N_GUI_LISTITEM * suggest_items
what the provider last answered, allocated on the first ask
int suggest_highlight
which one the keys and the pointer are on (-1 = none)
int suggest_count
how many of them
N_GUI_SUGGEST_FN suggest
completion provider, NULL when the field offers none
size_t sel_start
selection anchor position (where shift-click/shift-arrow started).
size_t sel_end
selection end position (tracks cursor during selection)
int scroll_y
scroll offset for long text
float scroll_x
horizontal scroll offset for single-line text (pixels)
int scroll_from_wheel
set to 1 when scroll was changed by mouse wheel, cleared on key input
char * placeholder
optional placeholder/hint text drawn dimmed while the field is empty (NULL = none); cleared from view as soon as any text is entered
void(*)(int widget_id, const char *text, void *user_data) on_change
callback on text change
int multiline
0 = single line, 1 = multiline
char mask_char
mask character for password fields (0 = no masking, e.g.
double cursor_time
timestamp of last cursor activity (for blink reset)
size_t cursor_pos
cursor position in text
size_t char_limit
maximum character limit (0 = N_GUI_TEXT_MAX)
ALLEGRO_BITMAP * bg_bitmap
optional bitmap for the text area background (NULL = color theme)

Public Attributes Documentation

variable user_data

void * user_data;

user data for callback

variable text_len

size_t text_len;

current text length

variable text_alloc

size_t text_alloc;

allocated buffer size (char_limit + 1)

variable text

char * text;

text content (dynamically allocated, text_alloc bytes)

variable suggest_user_data

void * suggest_user_data;

user data handed back to the provider

variable suggest_separators

char[8] suggest_separators;

characters that end a word, so a field holding a list completes the one the cursor is in rather than the whole line.

Empty means the whole content is one word.

variable suggest_scroll

int suggest_scroll;

first item the panel shows

variable suggest_prefix

char[128] suggest_prefix;

the word the answers are for, so the provider is asked once per word rather than once per key

variable suggest_open

int suggest_open;

the panel is up

variable suggest_items

N_GUI_LISTITEM * suggest_items;

what the provider last answered, allocated on the first ask

variable suggest_highlight

int suggest_highlight;

which one the keys and the pointer are on (-1 = none)

variable suggest_count

int suggest_count;

how many of them

variable suggest

N_GUI_SUGGEST_FN suggest;

completion provider, NULL when the field offers none

variable sel_start

size_t sel_start;

selection anchor position (where shift-click/shift-arrow started).

When sel_start == sel_end, no selection is active.

variable sel_end

size_t sel_end;

selection end position (tracks cursor during selection)

variable scroll_y

int scroll_y;

scroll offset for long text

variable scroll_x

float scroll_x;

horizontal scroll offset for single-line text (pixels)

variable scroll_from_wheel

int scroll_from_wheel;

set to 1 when scroll was changed by mouse wheel, cleared on key input

variable placeholder

char * placeholder;

optional placeholder/hint text drawn dimmed while the field is empty (NULL = none); cleared from view as soon as any text is entered

variable on_change

void(*)(int widget_id, const char *text, void *user_data) on_change;

callback on text change

variable multiline

int multiline;

0 = single line, 1 = multiline

variable mask_char

char mask_char;

mask character for password fields (0 = no masking, e.g.

'*')

variable cursor_time

double cursor_time;

timestamp of last cursor activity (for blink reset)

variable cursor_pos

size_t cursor_pos;

cursor position in text

variable char_limit

size_t char_limit;

maximum character limit (0 = N_GUI_TEXT_MAX)

variable bg_bitmap

ALLEGRO_BITMAP * bg_bitmap;

optional bitmap for the text area background (NULL = color theme)