Freeciv-3.2: /fast/freeciv/nightly/S3_2/client/gui-sdl3/widget_button.c File Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Functions | Variables
widget_button.c File Reference
`#include <SDL3/SDL.h>`
`#include "log.h"`
`#include "colors.h"`
`#include "graphics.h"`
`#include "gui_tilespec.h"`
`#include "themespec.h"`
`#include "widget.h"`
`#include "widget_p.h"`

Go to the source code of this file.

## Functions

static int | redraw_ibutton (struct widget *icon_button)
static int | redraw_tibutton (struct widget *theme_icon_button)
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)

## Variables

static int(* | baseclass_redraw )(struct widget *pwidget)

## 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 261 of file widget_button.c.

## ◆ 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 339 of file widget_button.c.

## ◆ redraw_ibutton()

static int redraw_ibutton | ( | struct widget * | icon_button | ) |

static

Create Icon Button image with text and Icon then blit to dest(ination) on position icon_button->size.x, icon_button->size.y.

Text with attributes is taken from icob_button->string_utf8 parameter.

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

Graphic for Icon is taken from icon_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 50 of file widget_button.c.

## ◆ redraw_tibutton()

static int redraw_tibutton | ( | struct widget * | theme_icon_button | ) |

static

Create Icon Button image with text and Icon then blit to dest(ination) on position theme_icon_button->size.x, theme_icon_button->size.y.

Text with attributes is taken from theme_icon_button->string_utf8 parameter.

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

Graphic for Icon Theme is taken from theme_icon_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 224 of file widget_button.c.

## Variable Documentation

## ◆ baseclass_redraw

int(* baseclass_redraw) (struct widget *pwidget) | ( | struct widget * | pwidget | ) |

static

Definition at line 33 of file widget_button.c.