Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_gui_suggest.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_suggest.c:

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static ALLEGRO_EVENT char_event (char c)
 Build a key event that types c.
static void expect_text (const char *label, const char *got, const char *want)
 Assert two strings are equal.
static void expect_true (const char *label, int cond)
 Assert a condition, logging which check failed.
static ALLEGRO_EVENT key_event (int keycode)
 Build a key event for keycode.
int main (void)
static void nothing (const char *prefix, N_GUI_SUGGEST_SINK *sink, void *user_data)
 A provider that answers nothing, whatever it is asked.
static void type (N_GUI_CTX *gui, const char *s)
 Type a whole string into whatever has focus.
static void vocabulary (const char *prefix, N_GUI_SUGGEST_SINK *sink, void *user_data)
 A vocabulary to complete against, the way a catalog would answer.

Variables

static int asks = 0
 How many times the provider was asked.
static int failures = 0
 Count of failed assertions.
static char last_prefix [64] = ""
 The last prefix the provider was given.

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 39 of file ex_gui_suggest.c.

Function Documentation

◆ char_event()

ALLEGRO_EVENT char_event ( char c)
static

Build a key event that types c.

Parameters
cThe character.
Returns
The event.
Examples
ex_gui_suggest.c.

Definition at line 142 of file ex_gui_suggest.c.

References key_event().

Referenced by type().

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

◆ expect_text()

void expect_text ( const char * label,
const char * got,
const char * want )
static

Assert two strings are equal.

Parameters
labelWhat is being checked.
gotThe value under test.
wantThe expected value.
Examples
ex_gui_suggest.c, and ex_html.c.

Definition at line 78 of file ex_gui_suggest.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

Referenced by main(), and test_to_text().

Here is the caller graph for this function:

◆ 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 63 of file ex_gui_suggest.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ key_event()

ALLEGRO_EVENT key_event ( int keycode)
static

Build a key event for keycode.

Parameters
keycodeAn ALLEGRO_KEY_* code.
Returns
The event, ready for n_gui_process_event.

Definition at line 129 of file ex_gui_suggest.c.

◆ main()

◆ nothing()

void nothing ( const char * prefix,
N_GUI_SUGGEST_SINK * sink,
void * user_data )
static

A provider that answers nothing, whatever it is asked.

Parameters
prefixUnused.
sinkUnused.
user_dataUnused.
Examples
ex_gui_suggest.c.

Definition at line 118 of file ex_gui_suggest.c.

Referenced by main().

Here is the caller graph for this function:

◆ type()

void type ( N_GUI_CTX * gui,
const char * s )
static

Type a whole string into whatever has focus.

Parameters
guiThe context.
sThe text.
Examples
ex_gui_colorwheel.c, ex_gui_combobox_wheel.c, ex_gui_cursor.c, ex_gui_curve.c, ex_gui_custom_mouse.c, ex_gui_datagrid_keys.c, ex_gui_dictionary.c, ex_gui_double_click.c, ex_gui_frameless_drag.c, ex_gui_grid.c, ex_gui_hover.c, ex_gui_network.c, ex_gui_popup.c, ex_gui_reentrant.c, ex_gui_slider_default.c, ex_gui_slider_handle.c, ex_gui_slider_step.c, ex_gui_suggest.c, ex_http2_server.c, ex_icc.c, ex_network.h, and ex_tiff.c.

Definition at line 153 of file ex_gui_suggest.c.

References char_event(), gui, and n_gui_process_event().

Referenced by __attribute__(), _custom_mouse(), _from_png(), _is_focusable_type(), _is_tab_focusable_type(), _n_tiff_type_size(), _new_widget(), _tiff_file(), avro_type_to_string(), create_octree(), decode_chat_msg(), determine_octant(), feed(), feed(), feed(), feed(), feed(), feed_key(), get_net_datas(), insert_octree_node(), main(), main(), manage_client(), mouse(), mouse_event(), mouse_event(), mouse_event(), mouse_event(), mouse_event(), mouse_event(), mouse_event(), mouse_event(), mouse_event(), n_git_list_branches(), n_http2_frame_build_header(), netmsg_make_ident(), netmsg_make_ping(), netw_get_ident(), netw_get_ping(), netw_get_position(), netw_get_quit(), netw_get_string(), netw_send_ident(), netw_send_ping(), netw_wait_close_timed(), out_count(), out_find(), peer_frame(), pk_from_mark(), pk_new(), pk_run(), pk_string(), png_chunk(), put_entry(), set_uformat(), srv_send(), thread_pool_processing_function(), and was().

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

◆ vocabulary()

void vocabulary ( const char * prefix,
N_GUI_SUGGEST_SINK * sink,
void * user_data )
static

A vocabulary to complete against, the way a catalog would answer.

Case folded for the match and not for the answer, which is the rule a store of tags has to follow: offering a spelling that cannot be added is worse than offering nothing.

Parameters
prefixWhat has been typed of the word under the cursor.
sinkWhere the answers go.
user_dataUnused.
Examples
ex_gui_suggest.c.

Definition at line 98 of file ex_gui_suggest.c.

References asks, last_prefix, and n_gui_suggest_add().

Referenced by main().

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

Variable Documentation

◆ asks

int asks = 0
static

How many times the provider was asked.

Examples
ex_gui_suggest.c.

Definition at line 53 of file ex_gui_suggest.c.

Referenced by main(), and vocabulary().

◆ failures

int failures = 0
static

Count of failed assertions.

Definition at line 50 of file ex_gui_suggest.c.

◆ last_prefix

char last_prefix[64] = ""
static

The last prefix the provider was given.

Examples
ex_gui_suggest.c.

Definition at line 56 of file ex_gui_suggest.c.

Referenced by main(), and vocabulary().