Freeciv-3.2
|
#include <SDL2/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_Keysym 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 306 of file widget_edit.c.
Referenced by edit_field().
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 217 of file widget_edit.c.
Referenced by del_chain().
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 350 of file widget_edit.c.
Referenced by popup_diplomatic_objects(), popup_new_user_passwd_dialog(), popup_newcity_dialog(), popup_user_passwd_dialog(), and save_cma_callback().
Delete utf8_char structure.
Definition at line 237 of file widget_edit.c.
Referenced by edit_field().
set new x, y position and redraw edit.
Definition at line 392 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 681 of file widget_edit.c.
Referenced by widget_pressed_action().
|
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 423 of file widget_edit.c.
Referenced by edit_field().
|
static |
Handle mouse down events on edit widget.
Definition at line 659 of file widget_edit.c.
Referenced by edit_field().
Handle textinput strings coming to the edit widget
Definition at line 589 of file widget_edit.c.
Referenced by edit_field().
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 142 of file widget_edit.c.
Referenced by create_edit(), and draw_edit().
Draw the text being edited.
Definition at line 66 of file widget_edit.c.
Referenced by edit_field(), edit_key_down(), edit_key_down(), edit_textinput(), and redraw_edit().
Convert utf8 string to utf8_char structure. Memory allocation -> after all use need call del_chain(...) !
Definition at line 263 of file widget_edit.c.
Referenced by edit_field().
Definition at line 61 of file widget_edit.c.
Referenced by create_edit().