Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_gui_datagrid_keys.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "nilorea/n_common.h"
#include "nilorea/n_gui.h"
#include "nilorea/n_log.h"
Include dependency graph for ex_gui_datagrid_keys.c:

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static void expect_true (const char *label, int cond)
 Assert a condition, logging which check failed.
static ALLEGRO_EVENT key_event (int keycode, unsigned int modifiers)
 Build a key event for keycode with modifiers.
int main (void)
static ALLEGRO_EVENT mouse_event (int type, int x, int y)
 Build a left-button mouse event at (x, y).
static void on_select (int widget_id, int row, void *user_data)
 Record a row selection, to prove the keyboard path fires the same callback a click does.

Variables

static int failures = 0
 Count of failed assertions.
static int nb_selected_seen = 0
 How many entries of selected_seen are used.
static int selected_seen [64]
 Rows reported by the grid's on_select callback, in order.

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 38 of file ex_gui_datagrid_keys.c.

Function Documentation

◆ expect_true()

void expect_true ( const char * label,
int cond )
static

Assert a condition, logging which check failed.

Parameters
labelWhat is being checked.
condNon-zero to pass.

Definition at line 60 of file ex_gui_datagrid_keys.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ key_event()

ALLEGRO_EVENT key_event ( int keycode,
unsigned int modifiers )
static

Build a key event for keycode with modifiers.

Parameters
keycodeAn ALLEGRO_KEY_* code.
modifiersAn ALLEGRO_KEYMOD_* mask.
Returns
The event, ready for n_gui_process_event.
Examples
ex_gui_datagrid_keys.c, ex_gui_slider_step.c, and ex_gui_suggest.c.

Definition at line 89 of file ex_gui_datagrid_keys.c.

Referenced by char_event(), and main().

Here is the caller graph for this function:

◆ main()

◆ mouse_event()

ALLEGRO_EVENT mouse_event ( int type,
int x,
int y )
static

Build a left-button mouse event at (x, y).

Parameters
typeThe ALLEGRO_EVENT_MOUSE_* type.
xCursor x.
yCursor y.
Returns
The event.

Definition at line 105 of file ex_gui_datagrid_keys.c.

References type().

Here is the call graph for this function:

◆ on_select()

void on_select ( int widget_id,
int row,
void * user_data )
static

Record a row selection, to prove the keyboard path fires the same callback a click does.

Parameters
widget_idUnused.
rowThe selected row.
user_dataUnused.
Examples
ex_gui_datagrid_keys.c.

Definition at line 76 of file ex_gui_datagrid_keys.c.

References nb_selected_seen, row(), and selected_seen.

Referenced by main(), n_gui_add_combobox(), n_gui_add_datagrid(), n_gui_add_listbox(), n_gui_add_radiolist(), and n_gui_tree_create().

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

Variable Documentation

◆ failures

int failures = 0
static

Count of failed assertions.

Definition at line 49 of file ex_gui_datagrid_keys.c.

◆ nb_selected_seen

int nb_selected_seen = 0
static

How many entries of selected_seen are used.

Examples
ex_gui_datagrid_keys.c.

Definition at line 53 of file ex_gui_datagrid_keys.c.

Referenced by main(), and on_select().

◆ selected_seen

int selected_seen[64]
static

Rows reported by the grid's on_select callback, in order.

Examples
ex_gui_datagrid_keys.c.

Definition at line 51 of file ex_gui_datagrid_keys.c.

Referenced by main(), and on_select().