Atrinik Client  4.0
Functions | Variables
interface.c File Reference
#include <global.h>
#include <toolkit/packet.h>
#include <toolkit/string.h>

Go to the source code of this file.

Functions

static void interface_destroy (interface_struct *data)
 
static int text_anchor_handle (const char *anchor_action, const char *buf, size_t len, void *custom_data)
 
static void interface_execute_link (size_t link_id)
 
static int popup_draw_func (popup_struct *popup)
 
static int popup_draw_post_func (popup_struct *popup)
 
static int popup_destroy_callback (popup_struct *popup)
 
static int popup_button_event_func (popup_button *button)
 
static void button_hello_event (void)
 
static int popup_event_func (popup_struct *popup, SDL_Event *event)
 
static const char * popup_clipboard_copy_func (popup_struct *popup)
 
void socket_command_interface (uint8_t *data, size_t len, size_t pos)
 
void interface_redraw (void)
 
void interface_deinit (void)
 

Variables

static interface_structinterface_data = NULL
 
static popup_structinterface_popup = NULL
 
static button_struct button_hello
 
static button_struct button_close
 
static const char character_shortcuts [] = "123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM{}<>/?~!@#$%^&*()"
 
static text_input_history_structtext_input_history = NULL
 
static text_input_struct text_input
 

Detailed Description

Implements the interface used by NPCs and the like.

Author
Alex Tokar

Definition in file interface.c.

Function Documentation

static void button_hello_event ( void  )
static

Handles clicking the 'hello' button.

Definition at line 244 of file interface.c.

void interface_deinit ( void  )

Deinitialize the interface system.

Definition at line 664 of file interface.c.

static void interface_destroy ( interface_struct data)
static

Destroy the specified interface data.

Parameters
dataInterface data to destroy.

Definition at line 66 of file interface.c.

void interface_redraw ( void  )

Redraw the interface.

Definition at line 654 of file interface.c.

static int popup_button_event_func ( popup_button button)
static

Callback function to call when the button is clicked.

Parameters
buttonThe clicked button.
Return values
1Handled the event, should not do generic handling.
0Did not handle the event.

Definition at line 235 of file interface.c.

static const char* popup_clipboard_copy_func ( popup_struct popup)
static

Function used to get contents for clipboard copy operation.

Parameters
popupPopup.
Returns
Contents to copy.

Definition at line 385 of file interface.c.

static int popup_destroy_callback ( popup_struct popup)
static

Function used right before the visible popup is destroyed using popup_destroy_visible().

Parameters
popupThe popup.
Returns
1 to proceed with the destruction of the popup, 0 otherwise.

Definition at line 218 of file interface.c.

static int popup_draw_func ( popup_struct popup)
static

Function used for drawing on the popup's surface.

Parameters
popupThe popup.
Returns
0 to destroy the popup, 1 otherwise.

Definition at line 148 of file interface.c.

static int popup_draw_post_func ( popup_struct popup)
static

Function used for drawing after drawing the popup's surface on the main surface.

Parameters
popupThe popup.
Returns
0 to destroy the popup, 1 otherwise.

Definition at line 197 of file interface.c.

static int popup_event_func ( popup_struct popup,
SDL_Event *  event 
)
static

Function used for handling mouse/key events when popup is visible.

Parameters
eventSDL event.
Return values
-1Did not handle the event.
0Did not handle the event, but allow other keyboard events.
1Handled the event.

Definition at line 254 of file interface.c.

void socket_command_interface ( uint8_t *  data,
size_t  len,
size_t  pos 
)

Definition at line 391 of file interface.c.

static int text_anchor_handle ( const char *  anchor_action,
const char *  buf,
size_t  len,
void *  custom_data 
)
static

Anchor handler function to try and execute before the defaults.

Parameters
anchor_actionThe action to execute, which can be empty (but not NULL) - for example, 'help'.
bufText to pass to the action decided by the anchor action; in case of links, the URL to open, for example. Will not contain any markup, and should not be freed.
lenLength of 'buf'.
custom_dataUser-supplied data. Can be NULL.
Returns
1 if handled the action and should not handle it using default actions, 0 otherwise.

Definition at line 105 of file interface.c.

Variable Documentation

button_struct button_hello
static

Button buffers.

Definition at line 47 of file interface.c.

const char character_shortcuts[] = "123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM{}<>/?~!@#$%^&*()"
static

Character shortcuts for links.

Definition at line 51 of file interface.c.

interface_struct* interface_data = NULL
static

The current interface data.

Definition at line 39 of file interface.c.

popup_struct* interface_popup = NULL
static

The interface popup.

Definition at line 43 of file interface.c.

text_input_struct text_input
static

Text input in the interface.

Definition at line 59 of file interface.c.

text_input_history_struct* text_input_history = NULL
static

Text input history.

Definition at line 55 of file interface.c.