Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
GUI: macros, headers, defines, timers, allocators,...

Data Structures

struct  N_GUI_DIALOG
 structure of a N_GUI_DIALOG More...
 
struct  N_GUI_LAYOUT
 structure of a N_GUI_DIALOG or N_GUI_WIDGET layout More...
 
struct  N_GUI_TOKEN
 structure of a N_GUI_TOKENIZER token More...
 
struct  N_GUI_TOKENIZER
 structure of a N_GUI_DIALOG tokenizer More...
 
struct  N_GUI_WIDGET
 structure of a N_GUI_DIALOG widget More...
 

Macros

#define N_ENUM_N_GUI_TOKEN(_)
 N_GUI_CTX codes definition.
 
#define N_GUI_MAX_TOKEN_SIZE   1024
 maximum size of a single token content
 

Functions

 N_ENUM_DECLARE (N_ENUM_N_GUI_TOKEN, __N_GUI_TOKEN)
 Network codes declaration.
 
void n_gui_init_tokenizer (N_GUI_TOKENIZER *tokenizer, const char *input)
 Initialize tokenizer.
 
int n_gui_is_eof (N_GUI_TOKENIZER *tokenizer)
  
 
N_GUI_DIALOGn_gui_load_dialog (char *html, char *css)
 Load a html + css file into a N_GUI_DIALOG.
 
char n_gui_next_char (N_GUI_TOKENIZER *tokenizer)
 Get next character from input.
 
N_GUI_TOKEN n_gui_next_token (N_GUI_TOKENIZER *tokenizer, bool *inside_open_tag)
 Read next N_GUI_TOKEN from input.
 
char n_gui_peek_char (N_GUI_TOKENIZER *tokenizer)
 Peek at next character without advancing the position.
 
void n_gui_print_token (N_GUI_TOKEN token)
 Function to print a token (for debugging purposes)
 

Detailed Description


Data Structure Documentation

◆ N_GUI_DIALOG

struct N_GUI_DIALOG

structure of a N_GUI_DIALOG

Definition at line 110 of file n_gui.h.

+ Collaboration diagram for N_GUI_DIALOG:
Data Fields
HASH_TABLE * styles hash table of styles
TREE * tree tree of widgets

◆ N_GUI_LAYOUT

struct N_GUI_LAYOUT

structure of a N_GUI_DIALOG or N_GUI_WIDGET layout

Definition at line 52 of file n_gui.h.

+ Collaboration diagram for N_GUI_LAYOUT:
Data Fields
ALLEGRO_COLOR background_color background color
N_STR * background_image background image file string
N_STR * font font file string
size_t font_size font size
size_t font_style font style
size_t horizontal_align horziontal align type
size_t margin_bottom margin bottom
size_t margin_left margin left
size_t margin_right margin right
size_t margin_top margin top
size_t max_height maximum height
size_t max_width maximum width
size_t min_height minimum height
size_t min_width minimum width
size_t vertical_align vertical align type

◆ N_GUI_TOKEN

struct N_GUI_TOKEN

structure of a N_GUI_TOKENIZER token

Definition at line 119 of file n_gui.h.

+ Collaboration diagram for N_GUI_TOKEN:
Data Fields
size_t type type of token
char value[N_GUI_MAX_TOKEN_SIZE] token content

◆ N_GUI_TOKENIZER

struct N_GUI_TOKENIZER

structure of a N_GUI_DIALOG tokenizer

Definition at line 128 of file n_gui.h.

+ Collaboration diagram for N_GUI_TOKENIZER:
Data Fields
const char * input pointer to the input text
size_t position position in the input text

◆ N_GUI_WIDGET

struct N_GUI_WIDGET

structure of a N_GUI_DIALOG widget

Definition at line 91 of file n_gui.h.

+ Collaboration diagram for N_GUI_WIDGET:
Data Fields
size_t h computed height
N_GUI_LAYOUT layout layout of the widget
size_t type type of widget
size_t w computed width
size_t x computed x position
size_t y computed y position

Macro Definition Documentation

◆ N_ENUM_N_GUI_TOKEN

#define N_ENUM_N_GUI_TOKEN (   _)
Value:
_(N_GUI_TOKEN_TAG_OPEN, 2)\
_(N_GUI_TOKEN_TAG_CLOSE, 4)\
_(N_GUI_TOKEN_TAG_NAME, 8)\
_(N_GUI_TOKEN_ATTR_NAME, 16)\
_(N_GUI_TOKEN_ATTR_VALUE, 32)\
_(N_GUI_TOKEN_TEXT, 64)\
_(N_GUI_TOKEN_EOF, 128)

N_GUI_CTX codes definition.

Definition at line 38 of file n_gui.h.

◆ N_GUI_MAX_TOKEN_SIZE

#define N_GUI_MAX_TOKEN_SIZE   1024

maximum size of a single token content

Definition at line 27 of file n_gui.h.

Function Documentation

◆ n_gui_init_tokenizer()

void n_gui_init_tokenizer ( N_GUI_TOKENIZER tokenizer,
const char *  input 
)

Initialize tokenizer.

Parameters
tokenizerthe tokenizer to init
inputthe input on which we want to start with a fresh tokenizer

Definition at line 24 of file n_gui.c.

References N_GUI_TOKENIZER::input, and N_GUI_TOKENIZER::position.

Referenced by n_gui_load_dialog().

+ Here is the caller graph for this function:

◆ n_gui_is_eof()

int n_gui_is_eof ( N_GUI_TOKENIZER tokenizer)

 

Check if end of input is reached  

Parameters
tokenizerthe tokenizer from which we want to test if finished
Returns
TRUE or FALSE

Definition at line 52 of file n_gui.c.

References N_GUI_TOKENIZER::input, and N_GUI_TOKENIZER::position.

Referenced by n_gui_next_token().

+ Here is the caller graph for this function:

◆ n_gui_load_dialog()

N_GUI_DIALOG * n_gui_load_dialog ( char *  html,
char *  css 
)

Load a html + css file into a N_GUI_DIALOG.

Parameters
htmlpath to the html file
csspath to the css style file
Returns
a loaded N_GUI_DIALOG *dialog or NULL

Definition at line 189 of file n_gui.c.

References __n_assert, _nstr, file_to_nstr(), free_nstr, Malloc, n_gui_init_tokenizer(), n_gui_next_token(), and N_GUI_TOKEN::type.

+ Here is the call graph for this function:

◆ n_gui_next_char()

char n_gui_next_char ( N_GUI_TOKENIZER tokenizer)

Get next character from input.

Parameters
tokenizerthe tokenizer to read data from
Returns
the next character in input

Definition at line 34 of file n_gui.c.

References N_GUI_TOKENIZER::input, and N_GUI_TOKENIZER::position.

Referenced by n_gui_next_token().

+ Here is the caller graph for this function:

◆ n_gui_next_token()

N_GUI_TOKEN n_gui_next_token ( N_GUI_TOKENIZER tokenizer,
bool *  inside_open_tag 
)

Read next N_GUI_TOKEN from input.

Parameters
tokenizerthe tokenizer from which we want the next token from
inside_open_tagpointer to a boolean that will reflect the status of tag detection
Returns
the next N_GUI_TOKEN from the tokenizer input

Definition at line 62 of file n_gui.c.

References n_gui_is_eof(), N_GUI_MAX_TOKEN_SIZE, n_gui_next_char(), n_gui_next_token(), n_gui_peek_char(), N_GUI_TOKEN::type, and N_GUI_TOKEN::value.

Referenced by n_gui_load_dialog(), and n_gui_next_token().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_peek_char()

char n_gui_peek_char ( N_GUI_TOKENIZER tokenizer)

Peek at next character without advancing the position.

Parameters
tokenizerthe tokenizer from which we want to peek data from
Returns
the next character in the tokenizer input data

Definition at line 43 of file n_gui.c.

References N_GUI_TOKENIZER::input, and N_GUI_TOKENIZER::position.

Referenced by n_gui_next_token().

+ Here is the caller graph for this function:

◆ n_gui_print_token()

void n_gui_print_token ( N_GUI_TOKEN  token)

Function to print a token (for debugging purposes)

Parameters
tokenthe N_GUI_TOKEN token to print

Definition at line 171 of file n_gui.c.

References N_GUI_TOKEN::type, and N_GUI_TOKEN::value.