19#ifdef SDL2_PLAIN_INCLUDE
69 SDL_Rect dest, dest_copy = {0, 0, 0, 0};
76 ret = (*baseclass_redraw)(edt->
pwidget);
90 dest_copy.y += (edt->
bg->h - input_chain_tmp->
tsurf->h) / 2;
94 while (input_chain_tmp) {
95 dest_copy.x += start_mod_x;
107 start_mod_x = input_chain_tmp->
tsurf->w;
114 dest.x - 1, dest.y + (edt->
bg->h / 8),
115 dest.x - 1, dest.y + edt->
bg->h - (edt->
bg->h / 4),
121 input_chain_tmp = input_chain_tmp->
next;
148 SDL_Rect rdest = {edit_widget->
size.x, edit_widget->
size.y, 0, 0};
149 SDL_Surface *pedit = NULL;
152 ret = (*baseclass_redraw)(edit_widget);
160 size_t len = strlen(backup) + 1;
163 memset(cbuf,
'*',
len - 1);
164 cbuf[
len - 1] =
'\0';
174 edit_widget->
size.w, edit_widget->
size.h);
185 rdest.y += (pedit->h - text->h) / 2;
188 rdest.x += (pedit->w - text->w) / 2;
191 rdest.x += pedit->w - text->w -
adj_size(5);
224 if (chain->
next == NULL) {
249 for (i = 0; i <
len - 1; i++) {
270 if (text_in == NULL) {
274 len = strlen(text_in);
281 out_chain->
chr[0] = text_in[0];
282 for (j = 1; (text_in[j] & (128 + 64)) == 128; j++) {
283 out_chain->
chr[j] = text_in[j];
285 out_chain->
bytes = j;
288 for (i = 1; i <
len; i += j) {
290 chr_tmp->
next->
chr[0] = text_in[i];
291 for (j = 1; (text_in[i + j] & (128 + 64)) == 128; j++) {
292 chr_tmp->
next->
chr[j] = text_in[i + j];
296 chr_tmp = chr_tmp->
next;
310 char *out_text = NULL;
314 if (!(
len && in_chain)) {
319 for (i = 0; i <
len; i++) {
322 for (j = 0; j < in_chain->
bytes && i <
len; j++) {
323 out_text[oi++] = in_chain->
chr[j];
326 total_size += in_chain->
bytes;
327 in_chain = in_chain->
next;
357 pedit->
theme2 = background;
377 pedit->
size.w = length;
394 pedit->
size.x = start_x;
595 for (i = 0; text[i] !=
'\0';) {
597 unsigned char leading = text[i++];
616 while (leading >= sum) {
625 char passwd_chr[2] = {
'*',
'\0'};
664 if (button_event->button == SDL_BUTTON_LEFT) {
685 struct utf8_char *input_chain_tmp = NULL;
687 void *backup = edit_widget->
data.
ptr;
695 edit_widget->
data.
ptr = (
void *)&edt;
698 SDL_EnableUNICODE(1);
699 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
703 edit_widget->
size.w, edit_widget->
size.h);
735 const char passwd_chr[2] = {
'*',
'\0'};
737 input_chain_tmp->
tsurf =
742 input_chain_tmp->
tsurf =
744 input_chain_tmp->
chr,
750 if (input_chain_tmp->
next == NULL) {
754 input_chain_tmp = input_chain_tmp->
next;
759 input_chain_tmp = NULL;
773 if (edt.begin_text_chain == edt.end_text_chain) {
774 edt.begin_text_chain = NULL;
799 edit_widget->
data.
ptr = backup;
813 SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
816 SDL_EnableUNICODE(0);
SDL_Color * get_theme_color(enum theme_color themecolor)
void create_line(SDL_Surface *dest, Sint16 x0, Sint16 y0, Sint16 x1, Sint16 y1, SDL_Color *pcolor)
int alphablit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, unsigned char alpha_mod)
struct gui_layer * add_gui_layer(int width, int height)
Uint16 gui_event_loop(void *data, void(*loop_action)(void *data), Uint16(*key_down_handler)(SDL_Keysym key, void *data), Uint16(*key_up_handler)(SDL_Keysym key, void *data), Uint16(*textinput_handler)(char *text, void *data), Uint16(*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_motion_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*mouse_button_down_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_button_up_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_motion_handler)(SDL_MouseMotionEvent *motion_event, void *data))
void utf8_str_size(utf8_str *pstr, SDL_Rect *fill)
SDL_Surface * create_text_surf_from_utf8(utf8_str *pstr)
#define fc_calloc(n, esz)
struct utf8_char * end_text_chain
struct utf8_char * input_chain
struct utf8_char * begin_text_chain
@ COLOR_THEME_EDITFIELD_CARET