Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_gui_dictionary.c File Reference
#include "nilorea/n_common.h"
#include "nilorea/n_list.h"
#include "nilorea/n_hash.h"
#include "nilorea/n_pcre.h"
#include "nilorea/n_str.h"
#include "nilorea/n_gui.h"
#include <allegro5/allegro_ttf.h>
Include dependency graph for ex_gui_dictionary.c:

Go to the source code of this file.

Data Structures

struct  DICTIONARY_DEFINITION
 dictionary definition for DICTIONARY_ENTRY More...
struct  DICTIONARY_ENTRY
 dictionary entry More...

Macros

#define ALLEGRO_UNSTABLE   1
#define HEIGHT   800
#define WIDTH   800

Functions

void free_entry (void *entry_ptr)
void free_entry_def (void *entry_def)
int main (int argc, char *argv[])
void on_clear_click (int widget_id, void *user_data)
void on_completion_select (int widget_id, int index, int selected, void *user_data)
void on_search_change (int widget_id, const char *text, void *user_data)
static void update_completion (N_GUI_CTX *gui, const char *text)
static void update_definitions (N_GUI_CTX *gui, const char *word)

Variables

static LIST * completion = NULL
static int completion_listbox_id = -1
static int definition_label_id = -1
static int definition_win_id = -1
static HASH_TABLE * dictionary = NULL
ALLEGRO_DISPLAY * display = NULL
int DONE = 0
ALLEGRO_TIMER * fps_timer = NULL
int getoptret = 0
static char last_search [4096] = ""
int log_level = 6
ALLEGRO_TIMER * logic_timer = NULL
static size_t max_results = 100
static int search_textarea_id = -1
static int status_label_id = -1
static int status_win_id = -1

Data Structure Documentation

◆ DICTIONARY_DEFINITION

struct DICTIONARY_DEFINITION

dictionary definition for DICTIONARY_ENTRY

Examples
ex_gui_dictionary.c.

Definition at line 53 of file ex_gui_dictionary.c.

Collaboration diagram for DICTIONARY_DEFINITION:
Data Fields
char * definition content of definition
char * type type of definition (verb, noun,...)

◆ DICTIONARY_ENTRY

struct DICTIONARY_ENTRY

dictionary entry

Examples
ex_gui_dictionary.c.

Definition at line 61 of file ex_gui_dictionary.c.

Collaboration diagram for DICTIONARY_ENTRY:
Data Fields
LIST * definitions list of DICTIONARY_DEFINITION for that entry
char * key key of the entry

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 31 of file ex_gui_dictionary.c.

◆ HEIGHT

#define HEIGHT   800

Definition at line 29 of file ex_gui_dictionary.c.

◆ WIDTH

#define WIDTH   800

Definition at line 28 of file ex_gui_dictionary.c.

Function Documentation

◆ free_entry()

void free_entry ( void * entry_ptr)
Examples
ex_gui_dictionary.c.

Definition at line 92 of file ex_gui_dictionary.c.

References DICTIONARY_ENTRY::definitions, FreeNoLog, DICTIONARY_ENTRY::key, and list_destroy().

Referenced by main().

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

◆ free_entry_def()

void free_entry_def ( void * entry_def)
Examples
ex_gui_dictionary.c.

Definition at line 86 of file ex_gui_dictionary.c.

References DICTIONARY_DEFINITION::definition, FreeNoLog, and DICTIONARY_DEFINITION::type.

Referenced by main().

Here is the caller graph for this function:

◆ main()

◆ on_clear_click()

void on_clear_click ( int widget_id,
void * user_data )
Examples
ex_gui_dictionary.c.

Definition at line 122 of file ex_gui_dictionary.c.

References gui, n_gui_textarea_set_text(), search_textarea_id, update_completion(), and update_definitions().

Referenced by main().

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

◆ on_completion_select()

void on_completion_select ( int widget_id,
int index,
int selected,
void * user_data )
Examples
ex_gui_dictionary.c.

Definition at line 108 of file ex_gui_dictionary.c.

References completion_listbox_id, gui, n_gui_listbox_get_item_text(), n_gui_textarea_set_text(), search_textarea_id, update_completion(), and update_definitions().

Referenced by main().

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

◆ on_search_change()

void on_search_change ( int widget_id,
const char * text,
void * user_data )
Examples
ex_gui_dictionary.c.

Definition at line 100 of file ex_gui_dictionary.c.

References gui, text(), update_completion(), and update_definitions().

Referenced by main().

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

◆ update_completion()

void update_completion ( N_GUI_CTX * gui,
const char * text )
static
Examples
ex_gui_dictionary.c.

Definition at line 130 of file ex_gui_dictionary.c.

References completion, completion_listbox_id, dictionary, gui, ht_get_completion_list(), last_search, list_destroy(), list_foreach, max_results, n_gui_listbox_add_item(), n_gui_listbox_clear(), and text().

Referenced by main(), on_clear_click(), on_completion_select(), and on_search_change().

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

◆ update_definitions()

void update_definitions ( N_GUI_CTX * gui,
const char * word )
static
Examples
ex_gui_dictionary.c.

Definition at line 149 of file ex_gui_dictionary.c.

References DICTIONARY_DEFINITION::definition, definition_label_id, DICTIONARY_ENTRY::definitions, dictionary, gui, ht_get_ptr(), list_foreach, n_gui_label_set_text(), and DICTIONARY_DEFINITION::type.

Referenced by on_clear_click(), on_completion_select(), and on_search_change().

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

Variable Documentation

◆ completion

LIST* completion = NULL
static
Examples
ex_gui_dictionary.c.

Definition at line 70 of file ex_gui_dictionary.c.

Referenced by main(), and update_completion().

◆ completion_listbox_id

int completion_listbox_id = -1
static
Examples
ex_gui_dictionary.c.

Definition at line 76 of file ex_gui_dictionary.c.

Referenced by main(), on_completion_select(), and update_completion().

◆ definition_label_id

int definition_label_id = -1
static
Examples
ex_gui_dictionary.c.

Definition at line 77 of file ex_gui_dictionary.c.

Referenced by main(), and update_definitions().

◆ definition_win_id

int definition_win_id = -1
static
Examples
ex_gui_dictionary.c.

Definition at line 78 of file ex_gui_dictionary.c.

Referenced by main().

◆ dictionary

HASH_TABLE* dictionary = NULL
static
Examples
ex_gui_dictionary.c.

Definition at line 69 of file ex_gui_dictionary.c.

Referenced by main(), update_completion(), and update_definitions().

◆ display

ALLEGRO_DISPLAY* display = NULL

Definition at line 43 of file ex_gui_dictionary.c.

◆ DONE

int DONE = 0

Definition at line 45 of file ex_gui_dictionary.c.

◆ fps_timer

ALLEGRO_TIMER* fps_timer = NULL

Definition at line 49 of file ex_gui_dictionary.c.

◆ getoptret

int getoptret = 0

Definition at line 46 of file ex_gui_dictionary.c.

◆ last_search

char last_search[4096] = ""
static
Examples
ex_gui_dictionary.c.

Definition at line 72 of file ex_gui_dictionary.c.

Referenced by main(), and update_completion().

◆ log_level

int log_level = 6

Definition at line 47 of file ex_gui_dictionary.c.

◆ logic_timer

ALLEGRO_TIMER* logic_timer = NULL

Definition at line 50 of file ex_gui_dictionary.c.

◆ max_results

size_t max_results = 100
static
Examples
ex_gui_dictionary.c.

Definition at line 71 of file ex_gui_dictionary.c.

Referenced by ht_get_completion_list(), and update_completion().

◆ search_textarea_id

int search_textarea_id = -1
static
Examples
ex_gui_dictionary.c.

Definition at line 75 of file ex_gui_dictionary.c.

Referenced by main(), on_clear_click(), and on_completion_select().

◆ status_label_id

int status_label_id = -1
static
Examples
ex_gui_dictionary.c.

Definition at line 80 of file ex_gui_dictionary.c.

Referenced by main().

◆ status_win_id

int status_win_id = -1
static
Examples
ex_gui_dictionary.c.

Definition at line 79 of file ex_gui_dictionary.c.

Referenced by main().