Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-sdl2/widget_button.h File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Macros | Functions
widget_button.h File Reference

Go to the source code of this file.

## Macros

#define | create_icon_button_from_chars(icon, pdest, char_string, ptsize, flags)
#define | create_icon_button_from_chars_fonto(icon, pdest, char_string, fonto, flags)
#define | create_themeicon_button_from_chars(icon_theme, pdest, char_string, ptsize, flags)
#define | create_themeicon_button_from_chars_fonto(icon_theme, pdest, char_string, fonto, flags)

## Functions

struct widget * | create_icon_button (SDL_Surface *icon, struct gui_layer *pdest, utf8_str *pstr, Uint32 flags)
struct widget * | create_themeicon_button (SDL_Surface *icon_theme, struct gui_layer *pdest, utf8_str *pstr, Uint32 flags)
int | draw_tibutton (struct widget *button, Sint16 start_x, Sint16 start_y)
int | draw_ibutton (struct widget *button, Sint16 start_x, Sint16 start_y)

## Macro Definition Documentation

## ◆ create_icon_button_from_chars

#define create_icon_button_from_chars | ( |  | icon,
|  |  | pdest,
|  |  | char_string,
|  |  | ptsize,
|  |  | flags
| ) |  |

Value:
create_icon_button(icon, pdest, \
create_utf8_from_char(char_string, ptsize), \
flags)
create_utf8_from_char
#define create_utf8_from_char(string_in, ptsize)
Definition gui_string.h:102
create_icon_button
struct widget * create_icon_button(SDL_Surface *icon, struct gui_layer *pdest, utf8_str *pstr, Uint32 flags)
Definition widget_button.c:265

Definition at line 17 of file widget_button.h.

## ◆ create_icon_button_from_chars_fonto

#define create_icon_button_from_chars_fonto | ( |  | icon,
|  |  | pdest,
|  |  | char_string,
|  |  | fonto,
|  |  | flags
| ) |  |

Value:
create_icon_button(icon, pdest, \
create_utf8_from_char_fonto(char_string, fonto), \
flags)
create_utf8_from_char_fonto
#define create_utf8_from_char_fonto(string_in, fonto)
Definition gui_string.h:107

Definition at line 23 of file widget_button.h.

## ◆ create_themeicon_button_from_chars

#define create_themeicon_button_from_chars | ( |  | icon_theme,
|  |  | pdest,
|  |  | char_string,
|  |  | ptsize,
|  |  | flags
| ) |  |

Value:
create_themeicon_button(icon_theme, pdest, \
create_utf8_from_char(char_string, \
ptsize), \
flags)
create_themeicon_button
struct widget * create_themeicon_button(SDL_Surface *icon_theme, struct gui_layer *pdest, utf8_str *pstr, Uint32 flags)
Definition widget_button.c:343

Definition at line 29 of file widget_button.h.

## ◆ create_themeicon_button_from_chars_fonto

#define create_themeicon_button_from_chars_fonto | ( |  | icon_theme,
|  |  | pdest,
|  |  | char_string,
|  |  | fonto,
|  |  | flags
| ) |  |

Value:
create_themeicon_button(icon_theme, pdest, \
create_utf8_from_char_fonto(char_string, \
fonto), \
flags)

Definition at line 36 of file widget_button.h.

## Function Documentation

## ◆ create_icon_button()

struct widget * create_icon_button | ( | SDL_Surface * | icon,
|  | struct gui_layer * | pdest,
|  | utf8_str * | pstr,
|  | Uint32 | flags
| ) |  |

Create ( malloc ) Icon (theme)Button Widget structure.

Icon graphic is taken from 'icon' surface (don't change with button changes ); Button Theme graphic is taken from current_theme->button surface; Text is taken from 'pstr'.

This function determinate future size of Button ( width, height ) and save this in: pwidget->size rectangle ( SDL_Rect )

function return pointer to allocated Button Widget.

Definition at line 265 of file widget_button.c.

Referenced by create_city_options_widget_list(), create_themeicon_button(), and popup_government_dialog().

## ◆ create_themeicon_button()

struct widget * create_themeicon_button | ( | SDL_Surface * | icon_theme,
|  | struct gui_layer * | pdest,
|  | utf8_str * | pstr,
|  | Uint32 | flags
| ) |  |

Create ( malloc ) Theme Icon (theme)Button Widget structure.

Icon Theme graphic is taken from 'icon_theme' surface ( change with button changes ); Button Theme graphic is taken from current_theme->button surface; Text is taken from 'pstr'.

This function determinate future size of Button ( width, height ) and save this in: pwidget->size rectangle ( SDL_Rect )

function return pointer to allocated Button Widget.

Definition at line 343 of file widget_button.c.

Referenced by create_horizontal_scrollbar(), create_vertical_scrollbar(), economy_report_dialog_popup(), and popup_races_dialog().

## ◆ draw_ibutton()

int draw_ibutton | ( | struct widget * | button,
|  | Sint16 | start_x,
|  | Sint16 | start_y
| ) |  |

Create Button image with text and Icon. Then blit to Main.screen on position start_x, start_y.

Text with atributes is taken from button->string_utf8 parameter.

Graphic for button is taken from button->theme surface and blit to new created image.

Graphic for Icon is taken from button->theme2 surface and blit to new created image.

Returns
  0 on success, 1 when there is no icon nor text, or negative SDL error

Definition at line 399 of file widget_button.c.

## ◆ draw_tibutton()

int draw_tibutton | ( | struct widget * | button,
|  | Sint16 | start_x,
|  | Sint16 | start_y
| ) |  |

Create Button image with text and Icon. Then blit to Main.screen on position start_x, start_y.

Text with atributes is taken from button->string_utf8 parameter.

Graphic for button is taken from button->theme surface and blit to new created image.

Graphic for Icon theme is taken from button->theme2 surface and blit to new created image.

Returns
  0 on success, 1 when there is no icon nor text, or negative SDL error

Definition at line 376 of file widget_button.c.