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

Go to the source code of this file.

Functions

void textwin_readjust (widgetdata *widget)
 
static int text_anchor_handle (const char *anchor_action, const char *buf, size_t len, void *custom_data)
 
static void textwin_tab_append (widgetdata *widget, uint8_t id, uint8_t type, const char *color, const char *str)
 
static int textwin_tab_compare (const void *a, const void *b)
 
size_t textwin_tab_name_to_id (const char *name)
 
void textwin_tab_free (textwin_tab_struct *tab)
 
void textwin_tab_remove (widgetdata *widget, const char *name)
 
void textwin_tab_add (widgetdata *widget, const char *name)
 
int textwin_tab_find (widgetdata *widget, uint8_t type, const char *name, size_t *id)
 
void textwin_tab_open (widgetdata *widget, const char *name)
 
void draw_info_tab (size_t type, const char *color, const char *str)
 
void draw_info_format (const char *color, const char *format,...)
 
void draw_info (const char *color, const char *str)
 
void textwin_handle_copy (widgetdata *widget)
 
void textwin_show (SDL_Surface *surface, int x, int y, int w, int h)
 
int textwin_tabs_height (widgetdata *widget)
 
void textwin_create_scrollbar (widgetdata *widget)
 
static void widget_draw (widgetdata *widget)
 
static void widget_background (widgetdata *widget, int draw)
 
static int widget_event (widgetdata *widget, SDL_Event *event)
 
static void widget_deinit (widgetdata *widget)
 
static int widget_load (widgetdata *widget, const char *keyword, const char *parameter)
 
static void widget_save (widgetdata *widget, FILE *fp, const char *padding)
 
static void menu_textwin_clear (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_textwin_copy (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void textwin_font_adjust (widgetdata *widget, int adjust)
 
static void menu_textwin_font_inc (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_textwin_font_dec (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_textwin_tabs_one (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_textwin_tabs (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static int text_anchor_handle_players_tab (const char *anchor_action, const char *buf, size_t len, void *custom_data)
 
static void menu_textwin_players_one_tab (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_textwin_players_one (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static void menu_textwin_players (widgetdata *widget, widgetdata *menuitem, SDL_Event *event)
 
static int widget_menu_handle (widgetdata *widget, SDL_Event *event)
 
void widget_textwin_init (widgetdata *widget)
 
void widget_textwin_handle_console (const char *text)
 

Variables

const char *const textwin_tab_names []
 
const char *const textwin_tab_commands []
 

Detailed Description

Implements text window type widgets.

Author
Alex Tokar

Definition in file textwin.c.

Function Documentation

void draw_info ( const char *  color,
const char *  str 
)

Add string to the text window.

Parameters
flagsVarious flags, like color.
strThe string.

Definition at line 448 of file textwin.c.

void draw_info_format ( const char *  color,
const char *  format,
  ... 
)

Draw info with format arguments.

Parameters
flagsVarious flags, like color.
formatFormat arguments.

Definition at line 429 of file textwin.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 82 of file textwin.c.

static int text_anchor_handle_players_tab ( 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 1110 of file textwin.c.

void textwin_create_scrollbar ( widgetdata widget)

Initialize text window scrollbar.

Parameters
widgetThe text window.

Definition at line 593 of file textwin.c.

void textwin_handle_copy ( widgetdata widget)

Handle ctrl+C for textwin widget

Parameters
widgetThe textwin widget. If NULL, try to find the first one in the priority list.

Definition at line 459 of file textwin.c.

void textwin_readjust ( widgetdata widget)

Readjust text window's scroll/entries counts due to a font size change.

Parameters
widgetText window's widget.

Definition at line 53 of file textwin.c.

void textwin_show ( SDL_Surface *  surface,
int  x,
int  y,
int  w,
int  h 
)

Display the message text window, without handling scrollbar/mouse actions.

Parameters
surfaceSurface to draw on.
xX position.
yY position.
wMaximum width.
hMaximum height.

Definition at line 523 of file textwin.c.

static void widget_background ( widgetdata widget,
int  draw 
)
static

Definition at line 740 of file textwin.c.

static void widget_deinit ( widgetdata widget)
static

Definition at line 888 of file textwin.c.

static void widget_draw ( widgetdata widget)
static

Definition at line 602 of file textwin.c.

static int widget_event ( widgetdata widget,
SDL_Event *  event 
)
static

Definition at line 755 of file textwin.c.

static int widget_load ( widgetdata widget,
const char *  keyword,
const char *  parameter 
)
static

Definition at line 907 of file textwin.c.

static void widget_save ( widgetdata widget,
FILE *  fp,
const char *  padding 
)
static

Definition at line 954 of file textwin.c.

Variable Documentation

const char* const textwin_tab_commands[]
Initial value:
= {
"say", NULL, "chat", "say", "reply", "guild", "party say", "opsay"
}

Definition at line 43 of file textwin.c.

const char* const textwin_tab_names[]
Initial value:
= {
"[ALL]", "[GAME]", "[CHAT]", "[LOCAL]", "[PRIVATE]", "[GUILD]", "[PARTY]", "[OPERATOR]"
}

Names of the text window tabs.

Definition at line 39 of file textwin.c.