Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-sdl2/widget_icon.c File Reference

Freeciv-3.3

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

Go to the source code of this file.

## Functions

static int | redraw_icon (struct widget *icon)
static int | redraw_icon2 (struct widget *icon)
void | set_new_icon_theme (struct widget *icon_widget, SDL_Surface *new_theme)
SDL_Surface * | create_icon_theme_surf (SDL_Surface *icon)
struct widget * | create_themeicon (SDL_Surface *icon_theme, struct gui_layer *pdest, Uint32 flags)
int | draw_icon (struct widget *icon, Sint16 start_x, Sint16 start_y)
int | draw_icon_from_theme (SDL_Surface *icon_theme, Uint8 state, struct gui_layer *pdest, Sint16 start_x, Sint16 start_y)
SDL_Surface * | create_icon_from_theme (SDL_Surface *icon_theme, Uint8 state)
void | set_new_icon2_theme (struct widget *icon_widget, SDL_Surface *new_theme, bool free_old_theme)
struct widget * | create_icon2 (SDL_Surface *icon, struct gui_layer *pdest, Uint32 flags)

## Variables

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

## Function Documentation

## ◆ create_icon2()

struct widget * create_icon2 | ( | SDL_Surface * | icon,
|  | struct gui_layer * | pdest,
|  | Uint32 | flags
| ) |  |

Create ( malloc ) Icon2 Widget ( flat Button )

Definition at line 337 of file widget_icon.c.

Referenced by create_present_supported_units_widget_list(), create_tech_info(), create_tech_tree(), economy_report_dialog_popup(), popup_change_research_dialog(), popup_change_research_goal_dialog(), popup_impr_info(), popup_players_dialog(), popup_races_dialog(), popup_tech_info(), popup_unit_info(), popup_unitinfo_window(), popup_worklist_editor(), real_info_city_report_dialog_update(), redraw_unit_info_label(), science_report_dialog_popup(), spy_steal_popup_shared(), and update_intel_dialog().

## ◆ create_icon_from_theme()

SDL_Surface * create_icon_from_theme | ( | SDL_Surface * | icon_theme,
|  | Uint8 | state
| ) |  |

Create Icon image then return pointer to this image.

Graphic is take from icon_theme surface and blit to new created image.

Type of Icon depend of "state" parameter. state = 0 - normal state = 1 - selected state = 2 - pressed state = 3 - disabled

Function return NULL if icon_theme is NULL or blit fail.

Definition at line 298 of file widget_icon.c.

Referenced by create_textcheckbox(), create_themeicon_button(), real_info_city_report_dialog_update(), redraw_textcheckbox(), redraw_tibutton(), and update_diplomacy_dialog().

## ◆ create_icon_theme_surf()

SDL_Surface * create_icon_theme_surf | ( | SDL_Surface * | icon | ) |

Ugly hack to create 4-state icon theme from static icon.

Definition at line 158 of file widget_icon.c.

Referenced by popup_goto_airlift_dialog().

## ◆ create_themeicon()

struct widget * create_themeicon | ( | SDL_Surface * | icon_theme,
|  | struct gui_layer * | pdest,
|  | Uint32 | flags
| ) |  |

Create ( malloc ) Icon Widget ( flat Button )

Definition at line 212 of file widget_icon.c.

Referenced by create_units_order_widgets(), economy_report_dialog_popup(), init_options_button(), notify_goto_dialog_new(), option_dialog_new(), option_dialog_optset_category(), popup_advanced_terrain_dialog(), popup_bribe_dialog(), popup_change_research_dialog(), popup_change_research_goal_dialog(), popup_city_cma_dialog(), popup_find_dialog(), popup_goto_airlift_dialog(), popup_impr_info(), popup_incite_dialog(), popup_load_del_presets_dialog(), popup_load_game_dialog(), popup_minimap_window(), popup_notify_dialog(), popup_pillage_dialog(), popup_players_dialog(), popup_players_nations_dialog(), popup_sabotage_dialog(), popup_spaceship_dialog(), popup_tech_info(), popup_terrain_info_dialog(), popup_unit_info(), popup_unitinfo_window(), popup_worklist_editor(), real_activeunits_report_dialog_update(), real_city_dialog_popup(), real_info_city_report_dialog_update(), science_report_dialog_popup(), spy_steal_popup_shared(), unit_select_dialog_popup(), update_diplomacy_dialog(), and update_intel_dialog().

## ◆ draw_icon()

int draw_icon | ( | struct widget * | icon,
|  | Sint16 | start_x,
|  | Sint16 | start_y
| ) |  |

Draw the icon.

Definition at line 240 of file widget_icon.c.

## ◆ draw_icon_from_theme()

int draw_icon_from_theme | ( | SDL_Surface * | icon_theme,
|  | Uint8 | state,
|  | struct gui_layer * | pdest,
|  | Sint16 | start_x,
|  | Sint16 | start_y
| ) |  |

Blit Icon image to pdest(ination) on position start_x, start_y. WARNING: pdest must exist.

Graphic is taken from icon_theme surface.

Type of Icon depend of "state" parameter. state = 0 - normal state = 1 - selected state = 2 - pressed state = 3 - disabled

Function return: -3 if icon_theme is NULL. std return of alphablit(...) function.

Definition at line 268 of file widget_icon.c.

Referenced by draw_icon().

## ◆ redraw_icon()

static int redraw_icon | ( | struct widget * | icon | ) |

static

Blit icon gfx to surface its on.

Definition at line 45 of file widget_icon.c.

Referenced by create_themeicon().

## ◆ redraw_icon2()

static int redraw_icon2 | ( | struct widget * | icon | ) |

static

Blit icon2 gfx to surface its on.

Definition at line 78 of file widget_icon.c.

Referenced by create_icon2().

## ◆ set_new_icon2_theme()

void set_new_icon2_theme | ( | struct widget * | icon_widget,
|  | SDL_Surface * | new_theme,
|  | bool | free_old_theme
| ) |  |

Set new theme and calculate new size.

Definition at line 321 of file widget_icon.c.

Referenced by set_indicator_icons().

## ◆ set_new_icon_theme()

void set_new_icon_theme | ( | struct widget * | icon_widget,
|  | SDL_Surface * | new_theme
| ) |  |

Set new theme and callculate new size.

Definition at line 145 of file widget_icon.c.

## Variable Documentation

## ◆ baseclass_redraw

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

static

Definition at line 36 of file widget_icon.c.

Referenced by create_icon2(), and create_themeicon().