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

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static void destroy_state (void *state)
 the owned state's destructor
static void expect_true (const char *what, int ok)
 record one check
static int feed (N_GUI_CTX *gui, int type, int x, int y, int button, int dz)
 feed one mouse event
int main (int argc, char **argv)
static int on_mouse (int widget_id, const N_GUI_MOUSE_EVENT *ev, void *user_data)
 the widget's mouse callback
static int process_args (int argc, char **argv)
 read -V LOGLEVEL
static int was (int type, int button, float x, float y)
 was the last thing told this

Variables

static int destroyed = 0
 how many times the owned state was destroyed
static int failures = 0
static N_GUI_MOUSE_EVENT last
 the last event the widget was told of, and how many
static int log_level = 3
static int told = 0
static int wheel_answer = 1
 what the widget answers to a wheel

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 16 of file ex_gui_custom_mouse.c.

Function Documentation

◆ destroy_state()

void destroy_state ( void * state)
static

the owned state's destructor

Examples
ex_gui_custom_mouse.c.

Definition at line 72 of file ex_gui_custom_mouse.c.

References destroyed.

Referenced by main().

Here is the caller graph for this function:

◆ expect_true()

void expect_true ( const char * what,
int ok )
static

record one check

Definition at line 39 of file ex_gui_custom_mouse.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ feed()

int feed ( N_GUI_CTX * gui,
int type,
int x,
int y,
int button,
int dz )
static

feed one mouse event

Definition at line 78 of file ex_gui_custom_mouse.c.

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

Here is the call graph for this function:

◆ main()

◆ on_mouse()

int on_mouse ( int widget_id,
const N_GUI_MOUSE_EVENT * ev,
void * user_data )
static

the widget's mouse callback

Examples
ex_gui_custom_mouse.c.

Definition at line 63 of file ex_gui_custom_mouse.c.

References last, N_GUI_MOUSE_WHEEL, told, N_GUI_MOUSE_EVENT::type, and wheel_answer.

Referenced by main(), and n_gui_custom_set_mouse().

Here is the caller graph for this function:

◆ process_args()

int process_args ( int argc,
char ** argv )
static

read -V LOGLEVEL

Definition at line 49 of file ex_gui_custom_mouse.c.

References log_level.

◆ was()

int was ( int type,
int button,
float x,
float y )
static

was the last thing told this

Examples
ex_gui_custom_mouse.c.

Definition at line 92 of file ex_gui_custom_mouse.c.

References last, and type().

Referenced by main().

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

Variable Documentation

◆ destroyed

int destroyed = 0
static

how many times the owned state was destroyed

Examples
ex_gui_custom_mouse.c.

Definition at line 36 of file ex_gui_custom_mouse.c.

Referenced by destroy_state(), and main().

◆ failures

int failures = 0
static

Definition at line 28 of file ex_gui_custom_mouse.c.

◆ last

◆ log_level

int log_level = 3
static

Definition at line 27 of file ex_gui_custom_mouse.c.

◆ told

int told = 0
static
Examples
ex_gui_custom_mouse.c.

Definition at line 32 of file ex_gui_custom_mouse.c.

Referenced by main(), and on_mouse().

◆ wheel_answer

int wheel_answer = 1
static

what the widget answers to a wheel

Examples
ex_gui_custom_mouse.c.

Definition at line 34 of file ex_gui_custom_mouse.c.

Referenced by main(), and on_mouse().