Freeciv-3.3
|
#include <SDL3/SDL.h>
#include "colors.h"
#include "graphics.h"
#include "gui_id.h"
#include "gui_tilespec.h"
#include "mapview.h"
#include "themespec.h"
#include "utf8string.h"
#include "widget.h"
#include "widget_p.h"
Go to the source code of this file.
Data Structures | |
struct | utf8_char |
struct | text_edit |
Functions | |
static size_t | chainlen (const struct utf8_char *chain) |
static void | del_chain (struct utf8_char *chain) |
static struct utf8_char * | text2chain (const char *text_in) |
static char * | chain2text (const struct utf8_char *in_chain, size_t len, size_t *size) |
static int | redraw_edit_chain (struct text_edit *edt) |
static int | redraw_edit (struct widget *edit_widget) |
struct widget * | create_edit (SDL_Surface *background, struct gui_layer *pdest, utf8_str *pstr, int length, Uint32 flags) |
int | draw_edit (struct widget *pedit, Sint16 start_x, Sint16 start_y) |
static Uint16 | edit_key_down (SDL_KeyboardEvent *key, void *data) |
static Uint16 | edit_textinput (const char *text, void *data) |
static Uint16 | edit_mouse_button_down (SDL_MouseButtonEvent *button_event, void *data) |
enum edit_return_codes | edit_field (struct widget *edit_widget) |
Variables | |
static int(* | baseclass_redraw )(struct widget *pwidget) |
Convert utf8_char structure to chars WARNING: Do not free utf8_char structure but allocates new char array.
Definition at line 302 of file widget_edit.c.
Return length of utf8_char chain. WARRNING: if struct utf8_char has 1 member and utf8_char->chr == 0 then this function return 1 ( not 0 like in strlen )
Definition at line 213 of file widget_edit.c.
struct widget * create_edit | ( | SDL_Surface * | background, |
struct gui_layer * | pdest, | ||
utf8_str * | pstr, | ||
int | length, | ||
Uint32 | flags | ||
) |
Create ( malloc ) Edit Widget structure.
Edit Theme graphic is taken from current_theme->Edit surface; Text is taken from 'pstr'.
'length' parameter determinate width of Edit rect.
This function determinate future size of Edit ( width, height ) and save this in: pwidget->size rectangle ( SDL_Rect )
function return pointer to allocated Edit Widget.
Definition at line 346 of file widget_edit.c.
Delete utf8_char structure.
Definition at line 233 of file widget_edit.c.
set new x, y position and redraw edit.
Definition at line 388 of file widget_edit.c.
enum edit_return_codes edit_field | ( | struct widget * | edit_widget | ) |
Handle active edit. Returns what should happen to the edit next.
Definition at line 677 of file widget_edit.c.
|
static |
This functions are pure madness :) Create Edit Field surface ( with Text) and blit them to Main.screen, on position 'edit_widget->size.x , edit_widget->size.y'
Main role of this functions are been text input to GUI. This code allow you to add, del unichar from unistring.
Graphic is taken from 'edit_widget->theme' OldText is taken from 'edit_widget->string_utf8'
NewText is returned to 'edit_widget->string_utf8' ( after free OldText )
if flag 'FW_DRAW_THEME_TRANSPARENT' is set theme will be blit transparent ( Alpha = 128 )
NOTE: This functions can return NULL in 'edit_widget->string_utf8->text' but never free 'edit_widget->string_utf8' struct.
Definition at line 419 of file widget_edit.c.
|
static |
Handle mouse down events on edit widget.
Definition at line 655 of file widget_edit.c.
Handle textinput strings coming to the edit widget
Definition at line 585 of file widget_edit.c.
Create Edit Field surface ( with Text) and blit them to Main.screen, on position 'edit_widget->size.x , edit_widget->size.y'
Graphic is taken from 'edit_widget->theme' Text is taken from 'edit_widget->string_utf8'
if flag 'FW_DRAW_THEME_TRANSPARENT' is set theme will be blit transparent ( Alpha = 128 )
function return height of created surfaces or (-1) if theme surface can't be created.
Definition at line 138 of file widget_edit.c.
Draw the text being edited.
Definition at line 62 of file widget_edit.c.
Convert utf8 string to utf8_char structure. Memory allocation -> after all use need call del_chain(...) !
Definition at line 259 of file widget_edit.c.