Atrinik Client  4.0
Data Fields
list_struct Struct Reference

#include <list.h>

Data Fields

int x
 
int y
 
int px
 
int py
 
int width
 
uint32_t max_rows
 
uint32_t rows
 
uint32_t cols
 
int spacing
 
uint32_t * col_widths
 
int * col_spacings
 
char ** col_names
 
uint8_t * col_centered
 
char *** text
 
int16_t row_height_adjust
 
int16_t frame_offset
 
uint16_t header_height
 
uint32_t row_highlighted
 
uint32_t row_selected
 
uint32_t row_offset
 
uint32_t click_tick
 
uint8_t focus
 
uint8_t scrollbar_enabled
 
scrollbar_struct scrollbar
 
font_structfont
 
SDL_Surface * surface
 
uint64_t text_flags
 
void * data
 
void(* draw_frame_func )(struct list_struct *list)
 
void(* row_color_func )(struct list_struct *list, int row, SDL_Rect box)
 
void(* row_highlight_func )(struct list_struct *list, SDL_Rect box)
 
void(* row_selected_func )(struct list_struct *list, SDL_Rect box)
 
void(* handle_esc_func )(struct list_struct *list)
 
void(* handle_enter_func )(struct list_struct *list, SDL_Event *event)
 
int(* key_event_func )(struct list_struct *list, SDLKey key)
 
void(* text_color_hook )(struct list_struct *list, uint32_t row, uint32_t col, const char **color, const char **color_shadow)
 
void(* post_column_func )(struct list_struct *list, uint32_t row, uint32_t col)
 
void(* handle_mouse_row_func )(struct list_struct *list, uint32_t row, SDL_Event *event)
 

Detailed Description

One list.

Definition at line 34 of file list.h.

Field Documentation

uint32_t list_struct::click_tick

Used for figuring out whether a double click occurred (keeps last ticks value).

Definition at line 123 of file list.h.

uint8_t* list_struct::col_centered

An array of which columns are centered.

Definition at line 78 of file list.h.

char** list_struct::col_names

An array of pointers to the column names.

Definition at line 75 of file list.h.

int* list_struct::col_spacings

An array of the column spacings.

Definition at line 72 of file list.h.

uint32_t* list_struct::col_widths

An array of the column widths.

Definition at line 69 of file list.h.

uint32_t list_struct::cols

Number of columns in a row.

Definition at line 63 of file list.h.

void* list_struct::data

Pointer to some custom data. If non-NULL, will be freed when list is destroyed.

Definition at line 147 of file list.h.

void(* list_struct::draw_frame_func)(struct list_struct *list)

Function that will draw frame (and/or other effects) right before the column names and the actual rows.

Parameters
listList.

Definition at line 155 of file list.h.

uint8_t list_struct::focus

If 1, this list has the active focus.

Definition at line 126 of file list.h.

font_struct* list_struct::font

Font used, one of FONT_xxx. Default is FONT_SANS10.

Definition at line 135 of file list.h.

int16_t list_struct::frame_offset

Frame offset (used when drawing the frame around the rows and when coloring the row entries).

Definition at line 94 of file list.h.

void(* list_struct::handle_enter_func)(struct list_struct *list, SDL_Event *event)

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 201 of file list.h.

void(* list_struct::handle_esc_func)(struct list_struct *list)

Function to handle ESC key being pressed while the list had focus.

Parameters
listList.

Definition at line 191 of file list.h.

void(* list_struct::handle_mouse_row_func)(struct list_struct *list, uint32_t row, SDL_Event *event)

Callback function to call when a mouse has been detected to be located over a list row.

Parameters
listThe list.
rowThe row in the list the mouse is over.
eventEvent that triggered this - can be used to figure out whether the event was a click, a motion, etc.

Definition at line 252 of file list.h.

uint16_t list_struct::header_height

Height of the header with column names.

Definition at line 97 of file list.h.

int(* list_struct::key_event_func)(struct list_struct *list, SDLKey key)

Custom function to call for handling keyboard events.

Parameters
listList.
keyKey ID.
Return values
-1Did not handle the event, but should still attempt to handle generic list events (eg, scrolling with arrow keys).
0Did not handle the event.
1Handled the event.

Definition at line 214 of file list.h.

uint32_t list_struct::max_rows

Maximum number of visible rows.

Definition at line 57 of file list.h.

void(* list_struct::post_column_func)(struct list_struct *list, uint32_t row, uint32_t col)

Callback function to call after drawing one column in a list.

Parameters
listThe list.
rowThe row of the column that was drawn.
colThe column.

Definition at line 239 of file list.h.

int list_struct::px

Parent X position, ie, X position of the surface the list is being drawn on.

Definition at line 45 of file list.h.

int list_struct::py

Parent Y position, ie, Y position of the surface the list is being drawn on.

Definition at line 51 of file list.h.

void(* list_struct::row_color_func)(struct list_struct *list, int row, SDL_Rect box)

Function that will color the specified row.

Parameters
listList.
rowRow number, 0-[max visible rows].
boxContains base x/y/width/height information to use.

Definition at line 166 of file list.h.

int16_t list_struct::row_height_adjust

How many pixels to adjust the height of a row by.

Definition at line 88 of file list.h.

void(* list_struct::row_highlight_func)(struct list_struct *list, SDL_Rect box)

Function to highlight a row (due to mouse being over it).

Parameters
listList.
boxContains base x/y/width/height information to use.

Definition at line 175 of file list.h.

uint32_t list_struct::row_highlighted

Currently highlighted row ID + 1, therefore, 0 means no highlighted row.

Definition at line 103 of file list.h.

uint32_t list_struct::row_offset

Row offset used for scrolling.

  • 0 = Row #0 is shown first in the list.
  • 10 = Row #10 is shown first in the list.

Definition at line 117 of file list.h.

uint32_t list_struct::row_selected

Currently selected row ID + 1, therefore, 0 means no selected row.

Definition at line 109 of file list.h.

void(* list_struct::row_selected_func)(struct list_struct *list, SDL_Rect box)

Function to color a selected row.

Parameters
listList.
boxContains base x/y/width/height information to use.

Definition at line 184 of file list.h.

uint32_t list_struct::rows

Number of rows.

Definition at line 60 of file list.h.

scrollbar_struct list_struct::scrollbar

The scrollbar.

Definition at line 132 of file list.h.

uint8_t list_struct::scrollbar_enabled

Does the list use scrollbars?

Definition at line 129 of file list.h.

int list_struct::spacing

Spacing between column names and the actual rows start.

Definition at line 66 of file list.h.

SDL_Surface* list_struct::surface

Surface used to draw the list on.

Definition at line 138 of file list.h.

char*** list_struct::text

Array of arrays of pointers to the text. In other words:

row -> col -> text.

Definition at line 85 of file list.h.

void(* list_struct::text_color_hook)(struct list_struct *list, uint32_t row, uint32_t col, const char **color, const char **color_shadow)

Hook to use for setting text color based on row/column.

Parameters
listList.
rowText row.
colColumn.
[out]colorWhat color to use.
[out]color_shadowWhat color to use for the text's shadow, NULL to disable shadow.

Definition at line 228 of file list.h.

uint64_t list_struct::text_flags

Additional text API flags.

Definition at line 141 of file list.h.

int list_struct::width

List's maximum width.

Definition at line 54 of file list.h.

int list_struct::x

X position of the list.

Definition at line 36 of file list.h.

int list_struct::y

Y position of the list.

Definition at line 39 of file list.h.


The documentation for this struct was generated from the following file: