Atrinik Client  4.0
Data Structures | Macros | Typedefs | Enumerations | Functions
buddy.c File Reference
#include <global.h>
#include <toolkit/string.h>
#include <toolkit/path.h>

Go to the source code of this file.

Data Structures

struct  buddy_struct
 

Macros

#define WIDGET_BUDDY(_widget)   ((buddy_struct *) (_widget)->subwidget)
 

Typedefs

typedef struct buddy_struct buddy_struct
 

Enumerations

enum  {
  BUTTON_ADD, BUTTON_REMOVE, BUTTON_CLOSE, BUTTON_HELP,
  BUTTON_NUM
}
 

Functions

static void list_handle_enter (list_struct *list, SDL_Event *event)
 
void widget_buddy_add (widgetdata *widget, const char *name, uint8_t sort)
 
void widget_buddy_remove (widgetdata *widget, const char *name)
 
ssize_t widget_buddy_check (widgetdata *widget, const char *name)
 
static void widget_buddy_load (widgetdata *widget)
 
static void widget_buddy_save (widgetdata *widget)
 
static void widget_draw (widgetdata *widget)
 
static void widget_background (widgetdata *widget, int draw)
 
static void widget_event_buddy_add (widgetdata *widget)
 
static int widget_event (widgetdata *widget, SDL_Event *event)
 
static void widget_deinit (widgetdata *widget)
 
void widget_buddy_init (widgetdata *widget)
 

Detailed Description

Implements buddy type widgets.

Author
Alex Tokar

Definition in file buddy.c.

Typedef Documentation

typedef struct buddy_struct buddy_struct

Buddy data structure.

Function Documentation

static void list_handle_enter ( list_struct list,
SDL_Event *  event 
)
static

Function to handle enter key being pressed on a selected row, or a row being double clicked.

Parameters
listList.
EventEvent that triggered this.

Definition at line 78 of file buddy.c.

static void widget_background ( widgetdata widget,
int  draw 
)
static

Definition at line 313 of file buddy.c.

void widget_buddy_add ( widgetdata widget,
const char *  name,
uint8_t  sort 
)

Add a buddy.

Parameters
widgetWidget to add to.
nameBuddy's name. Can be NULL, in which case nothing is added.
sortIf 1, sort the buddy list.

Definition at line 99 of file buddy.c.

ssize_t widget_buddy_check ( widgetdata widget,
const char *  name 
)

Check if the specified character name is a buddy.

Parameters
widgetWidget to check. Can be NULL, in which case -1 is returned.
nameCharacter name to check.
Returns
-1 if the character name is not a buddy, index in the character names array otherwise.

Definition at line 160 of file buddy.c.

void widget_buddy_init ( widgetdata widget)

Initialize one buddy widget.

Definition at line 477 of file buddy.c.

static void widget_buddy_load ( widgetdata widget)
static

Load the buddy data file.

Parameters
widgetThe buddy widget.

Definition at line 184 of file buddy.c.

void widget_buddy_remove ( widgetdata widget,
const char *  name 
)

Remove a buddy.

Parameters
widgetWidget to remove from.
nameBuddy's name.

Definition at line 126 of file buddy.c.

static void widget_buddy_save ( widgetdata widget)
static

Save the buddy data file.

Parameters
widgetThe buddy widget.

Definition at line 224 of file buddy.c.

static void widget_deinit ( widgetdata widget)
static

Definition at line 457 of file buddy.c.

static void widget_draw ( widgetdata widget)
static

Definition at line 257 of file buddy.c.

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

Definition at line 361 of file buddy.c.

static void widget_event_buddy_add ( widgetdata widget)
static

Handles event for adding of a buddy to the specified buddy widget.

Parameters
widgetThe buddy widget.

Definition at line 346 of file buddy.c.