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

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static int click_and_report (N_GUI_CTX *gui, int x, int y)
 Press the primary button at (x, y) and report the double click.
static void click_at (N_GUI_CTX *gui, int x, int y)
 Press and release the primary button at (x, y).
static void expect_true (const char *label, int cond)
 Assert a condition, logging which check failed.
int main (void)
static ALLEGRO_EVENT mouse_event (int type, int x, int y)
 Build a left-button mouse event at (x, y).

Variables

static int failures = 0
 Count of failed assertions.

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 38 of file ex_gui_double_click.c.

Function Documentation

◆ click_and_report()

int click_and_report ( N_GUI_CTX * gui,
int x,
int y )
static

Press the primary button at (x, y) and report the double click.

The release is sent afterwards, so the answer is read at the moment the press was processed, which is when a host would read it.

Parameters
guiGUI context.
xCursor x.
yCursor y.
Returns
The widget the press double clicked, or -1.
Examples
ex_gui_double_click.c.

Definition at line 105 of file ex_gui_double_click.c.

References gui, mouse_event(), n_gui_double_clicked_widget(), and n_gui_process_event().

Referenced by main().

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

◆ click_at()

void click_at ( N_GUI_CTX * gui,
int x,
int y )
static

Press and release the primary button at (x, y).

Parameters
guiGUI context.
xCursor x.
yCursor y.

Definition at line 88 of file ex_gui_double_click.c.

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

Here is the call 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 56 of file ex_gui_double_click.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ 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 72 of file ex_gui_double_click.c.

References type().

Here is the call graph for this function:

Variable Documentation

◆ failures

int failures = 0
static

Count of failed assertions.

Definition at line 49 of file ex_gui_double_click.c.