Freeciv-3.1
|
#include <SDL2/SDL.h>
#include "log.h"
#include "colors.h"
#include "graphics.h"
#include "gui_id.h"
#include "gui_tilespec.h"
#include "mapview.h"
#include "themespec.h"
#include "widget.h"
#include "widget_p.h"
Go to the source code of this file.
Data Structures | |
struct | UP_DOWN |
Macros | |
#define | widget_add_next(new_widget, add_dock) |
Functions | |
static SDL_Surface * | create_vertical_surface (SDL_Surface *vert_theme, enum widget_state state, Uint16 height) |
static int | redraw_vert (struct widget *vert) |
struct widget * | create_vertical (SDL_Surface *vert_theme, struct gui_layer *pdest, Uint16 height, Uint32 flags) |
int | draw_vert (struct widget *vert, Sint16 x, Sint16 y) |
static SDL_Surface * | create_horizontal_surface (SDL_Surface *horiz_theme, Uint8 state, Uint16 width) |
static int | redraw_horiz (struct widget *horiz) |
struct widget * | create_horizontal (SDL_Surface *horiz_theme, struct gui_layer *pdest, Uint16 width, Uint32 flags) |
int | draw_horiz (struct widget *horiz, Sint16 x, Sint16 y) |
static int | get_step (struct scroll_bar *scroll) |
static int | get_position (struct advanced_dialog *dlg) |
static struct widget * | up_scroll_widget_list (struct scroll_bar *vscroll, struct widget *begin_active_widget_list, struct widget *begin_widget_list, struct widget *end_widget_list) |
static struct widget * | down_scroll_widget_list (struct scroll_bar *vscroll, struct widget *begin_active_widget_list, struct widget *begin_widget_list, struct widget *end_widget_list) |
static struct widget * | vertic_scroll_widget_list (struct scroll_bar *vscroll, struct widget *begin_active_widget_list, struct widget *begin_widget_list, struct widget *end_widget_list) |
static int | std_up_advanced_dlg_callback (struct widget *pwidget) |
static int | std_down_advanced_dlg_callback (struct widget *pwidget) |
static int | std_vscroll_advanced_dlg_callback (struct widget *pscroll_bar) |
Uint32 | create_vertical_scrollbar (struct advanced_dialog *dlg, Uint8 step, Uint8 active, bool create_scrollbar, bool create_buttons) |
void | setup_vertical_scrollbar_area (struct scroll_bar *scroll, Sint16 start_x, Sint16 start_y, Uint16 height, bool swap_start_x) |
static struct widget * | vertical_scroll_widget_list (struct widget *active_widget_list, struct widget *begin_widget_list, struct widget *end_widget_list, int active, int step, int dir) |
static void | inside_scroll_down_loop (void *data) |
static void | inside_scroll_up_loop (void *data) |
static Uint16 | scroll_mouse_motion_handler (SDL_MouseMotionEvent *motion_event, void *data) |
static Uint16 | scroll_mouse_button_up (SDL_MouseButtonEvent *button_event, void *data) |
bool | add_widget_to_vertical_scroll_widget_list (struct advanced_dialog *dlg, struct widget *new_widget, struct widget *add_dock, bool dir, Sint16 start_x, Sint16 start_y) |
bool | del_widget_from_vertical_scroll_widget_list (struct advanced_dialog *dlg, struct widget *pwidget) |
void | setup_vertical_scrollbar_default_callbacks (struct scroll_bar *scroll) |
Uint32 | create_horizontal_scrollbar (struct advanced_dialog *dlg, Sint16 start_x, Sint16 start_y, Uint16 width, Uint16 active, bool create_scrollbar, bool create_buttons, bool swap_start_y) |
Variables | |
static int(* | baseclass_redraw )(struct widget *pwidget) |
#define widget_add_next | ( | new_widget, | |
add_dock | |||
) |
Definition at line 52 of file widget_scrollbar.c.
bool add_widget_to_vertical_scroll_widget_list | ( | struct advanced_dialog * | dlg, |
struct widget * | new_widget, | ||
struct widget * | add_dock, | ||
bool | dir, | ||
Sint16 | start_x, | ||
Sint16 | start_y | ||
) |
Add new widget to scrolled list and set draw position of all changed widgets. dir : TRUE - upper add => add_dock->next = new_widget. FALSE - down add => add_dock->prev = new_widget. start_x, start_y - positions of first seen widget (active_widget_list). dlg->scroll ( scrollbar ) must exist. It isn't full secure to multi widget list.
Definition at line 1151 of file widget_scrollbar.c.
Referenced by add_global_worklist(), add_new_worklist_callback(), add_target_to_worklist(), add_to_chat_list(), popup_load_game_dialog(), real_conn_list_dialog_update(), real_meswin_dialog_update(), set_global_worklist(), and update_clauses_list().
struct widget * create_horizontal | ( | SDL_Surface * | horiz_theme, |
struct gui_layer * | pdest, | ||
Uint16 | width, | ||
Uint32 | flags | ||
) |
Create ( malloc ) horizontal scroll_bar widget structure.
Theme graphic is taken from horiz_theme surface;
This function determinate future size of horizontal scroll_bar ( width = 'width', height = 'horiz_theme->h' ) and save this in: pwidget->size rectangle ( SDL_Rect )
Return pointer to created widget.
Definition at line 301 of file widget_scrollbar.c.
Referenced by create_horizontal_scrollbar(), economy_report_dialog_popup(), and popup_city_cma_dialog().
Uint32 create_horizontal_scrollbar | ( | struct advanced_dialog * | dlg, |
Sint16 | start_x, | ||
Sint16 | start_y, | ||
Uint16 | width, | ||
Uint16 | active, | ||
bool | create_scrollbar, | ||
bool | create_buttons, | ||
bool | swap_start_y | ||
) |
Create a new horizontal scrollbar to active widgets list.
Definition at line 1550 of file widget_scrollbar.c.
|
static |
Create background image for hscrollbars then return pointer to this image.
Graphic is taken from horiz_theme surface and blit to new created image.
Type of image depend of "state" parameter. state = 0 - normal state = 1 - selected state = 2 - pressed state = 3 - disabled
Definition at line 212 of file widget_scrollbar.c.
Referenced by redraw_horiz().
struct widget * create_vertical | ( | SDL_Surface * | vert_theme, |
struct gui_layer * | pdest, | ||
Uint16 | height, | ||
Uint32 | flags | ||
) |
Create ( malloc ) vertical scroll_bar widget structure.
Theme graphic is taken from vert_theme surface;
This function determinate future size of vertical scroll_bar ( width = 'vert_theme->w', height = 'height' ) and save this in: pwidget->size rectangle ( SDL_Rect )
Return pointer to created widget.
Definition at line 164 of file widget_scrollbar.c.
Referenced by create_vertical_scrollbar().
Uint32 create_vertical_scrollbar | ( | struct advanced_dialog * | dlg, |
Uint8 | step, | ||
Uint8 | active, | ||
bool | create_scrollbar, | ||
bool | create_buttons | ||
) |
Create a new vertical scrollbar to active widgets list.
Definition at line 491 of file widget_scrollbar.c.
Referenced by create_present_supported_units_widget_list(), economy_report_dialog_popup(), meswin_dialog_popup(), option_dialog_optset_category(), option_dialog_worklist(), popup_advanced_terrain_dialog(), popup_change_research_dialog(), popup_change_research_goal_dialog(), popup_conn_list_dialog(), popup_connection_dialog(), popup_diplomatic_objects(), popup_find_dialog(), popup_goto_airlift_dialog(), popup_impr_info(), popup_load_del_presets_dialog(), popup_load_game_dialog(), popup_players_nations_dialog(), popup_races_dialog(), popup_sabotage_dialog(), popup_tech_info(), popup_unit_info(), popup_worklist_editor(), real_activeunits_report_dialog_update(), real_conn_list_dialog_update(), real_info_city_report_dialog_update(), rebuild_imprm_list(), redraw_unit_info_label(), spy_steal_popup_shared(), unit_select_dialog_popup(), update_diplomacy_dialog(), and update_intel_dialog().
|
static |
Create background image for vscrollbars, then return pointer to that image.
Graphic is taken from vert_theme surface and blit to new created image.
Definition at line 74 of file widget_scrollbar.c.
Referenced by redraw_vert().
bool del_widget_from_vertical_scroll_widget_list | ( | struct advanced_dialog * | dlg, |
struct widget * | pwidget | ||
) |
Delete widget from scrolled list and set draw position of all changed widgets. Don't free dlg and dlg->scroll (if exist) It is full secure for multi widget list case.
Definition at line 1349 of file widget_scrollbar.c.
Referenced by edit_worklist_callback(), ok_sell_impr_callback(), real_units_report_dialog_update(), remove_clause_widget_from_list(), remove_item_from_worklist(), sell_imprvm_dlg_ok_callback(), and set_global_worklist().
|
static |
Scroll widgets down.
Definition at line 1059 of file widget_scrollbar.c.
Referenced by std_down_advanced_dlg_callback().
int draw_horiz | ( | struct widget * | horiz, |
Sint16 | x, | ||
Sint16 | y | ||
) |
Draw horizontal scrollbar.
Definition at line 325 of file widget_scrollbar.c.
int draw_vert | ( | struct widget * | vert, |
Sint16 | x, | ||
Sint16 | y | ||
) |
Draw vertical scrollbar.
Definition at line 187 of file widget_scrollbar.c.
|
static |
Get current active position of the scrollbar.
Definition at line 357 of file widget_scrollbar.c.
Referenced by add_widget_to_vertical_scroll_widget_list(), and del_widget_from_vertical_scroll_widget_list().
|
static |
Get step of the scrollbar.
Definition at line 341 of file widget_scrollbar.c.
Referenced by down_scroll_widget_list(), get_position(), up_scroll_widget_list(), and vertic_scroll_widget_list().
|
static |
Callback for the scroll-down event loop.
Definition at line 873 of file widget_scrollbar.c.
Referenced by down_scroll_widget_list().
|
static |
Callback for the scroll-up event loop.
Definition at line 920 of file widget_scrollbar.c.
Referenced by up_scroll_widget_list().
|
static |
Blit horizontal scrollbar gfx to surface its on.
Definition at line 269 of file widget_scrollbar.c.
Referenced by create_horizontal(), and draw_horiz().
|
static |
Blit vertical scrollbar gfx to surface its on.
Definition at line 132 of file widget_scrollbar.c.
Referenced by add_widget_to_vertical_scroll_widget_list(), create_vertical(), draw_vert(), inside_scroll_down_loop(), inside_scroll_up_loop(), scroll_mouse_motion_handler(), and std_vscroll_advanced_dlg_callback().
|
static |
Callback for scrollbar event loops' mouse up events.
Definition at line 1050 of file widget_scrollbar.c.
Referenced by down_scroll_widget_list(), up_scroll_widget_list(), and vertic_scroll_widget_list().
|
static |
Handle mouse motion events of the vertical scrollbar event loop.
Definition at line 962 of file widget_scrollbar.c.
Referenced by vertic_scroll_widget_list().
void setup_vertical_scrollbar_area | ( | struct scroll_bar * | scroll, |
Sint16 | start_x, | ||
Sint16 | start_y, | ||
Uint16 | height, | ||
bool | swap_start_x | ||
) |
Setup area for the vertical scrollbar.
Definition at line 572 of file widget_scrollbar.c.
Referenced by add_target_to_worklist(), create_present_supported_units_widget_list(), economy_report_dialog_popup(), meswin_dialog_popup(), option_dialog_optset_category(), option_dialog_worklist(), popup_advanced_terrain_dialog(), popup_change_research_dialog(), popup_change_research_goal_dialog(), popup_conn_list_dialog(), popup_connection_dialog(), popup_diplomatic_objects(), popup_find_dialog(), popup_goto_airlift_dialog(), popup_impr_info(), popup_load_game_dialog(), popup_players_nations_dialog(), popup_races_dialog(), popup_sabotage_dialog(), popup_tech_info(), popup_unit_info(), popup_worklist_editor(), real_activeunits_report_dialog_update(), real_conn_list_dialog_update(), real_info_city_report_dialog_update(), rebuild_imprm_list(), remove_item_from_worklist(), spy_steal_popup_shared(), unit_select_dialog_popup(), update_diplomacy_dialog(), and update_intel_dialog().
void setup_vertical_scrollbar_default_callbacks | ( | struct scroll_bar * | scroll | ) |
Set default vertical scrollbar handling for scrollbar.
Definition at line 1527 of file widget_scrollbar.c.
|
static |
User interacted with down button of advanced dialog.
Definition at line 437 of file widget_scrollbar.c.
Referenced by create_vertical_scrollbar(), and setup_vertical_scrollbar_default_callbacks().
|
static |
User interacted with up button of advanced dialog.
Definition at line 410 of file widget_scrollbar.c.
Referenced by create_vertical_scrollbar(), and setup_vertical_scrollbar_default_callbacks().
|
static |
FIXME : fix main funct : vertic_scroll_widget_list(...)
Definition at line 464 of file widget_scrollbar.c.
Referenced by create_vertical_scrollbar(), and setup_vertical_scrollbar_default_callbacks().
|
static |
Scroll widgets up.
Definition at line 1088 of file widget_scrollbar.c.
Referenced by std_up_advanced_dlg_callback().
|
static |
Scroll vertical widget list with the mouse movement.
Definition at line 1110 of file widget_scrollbar.c.
Referenced by std_vscroll_advanced_dlg_callback().
|
static |
Scroll pointers on list. dir == directions: up == -1, down == 1.
Definition at line 638 of file widget_scrollbar.c.
Referenced by inside_scroll_down_loop(), inside_scroll_up_loop(), and scroll_mouse_motion_handler().
Definition at line 62 of file widget_scrollbar.c.
Referenced by create_horizontal(), and create_vertical().