Freeciv-3.2
Loading...
Searching...
No Matches
widget.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14/***********************************************************************
15 widget.c - description
16 -------------------
17 begin : June 30 2002
18 copyright : (C) 2002 by Rafał Bursig
19 email : Rafał Bursig <bursig@poczta.fm>
20***********************************************************************/
21
22#ifdef HAVE_CONFIG_H
23#include <fc_config.h>
24#endif
25
26/* SDL3 */
27#include <SDL3/SDL.h>
28
29/* utility */
30#include "log.h"
31
32/* gui-sdl3 */
33#include "colors.h"
34#include "graphics.h"
35#include "gui_id.h"
36#include "gui_main.h"
37#include "gui_tilespec.h"
38#include "mapview.h"
39#include "themespec.h"
40
41#include "widget.h"
42#include "widget_p.h"
43
46
48
49/* ================================ Private ============================ */
50
52
54
55/**********************************************************************/
60 int *width, int *height)
61{
62 *width = MAX(*width, 2 * (ptheme->w / adj_size(16)));
63 *height = MAX(*height, 2 * (ptheme->h / adj_size(16)));
64}
65
66/**********************************************************************/
76{
77 bool zoom;
80 int i, j;
81 SDL_Rect src, des;
82 SDL_Surface *background = NULL;
83 int start_y = (ptheme->h / 4) * state;
84
85 tile_width_len_end = ptheme->w / 16;
87
90
91 /* corrections I */
92 if (((tile_count_len_mid *
95 }
96
101
102 /* corrections II */
106 }
107
110 zoom = ((i != width) || (j != height));
111
112 /* Now allocate memory */
113 background = create_surf(i, j);
114
115 /* Copy left end */
116
117 /* Left top */
118 src.x = 0;
119 src.y = start_y;
120 src.w = tile_width_len_end;
121 src.h = tile_width_height_end;
122
123 des.x = 0;
124 des.y = 0;
125 alphablit(ptheme, &src, background, &des, 255);
126
127 /* left middle */
129 src.h = tile_width_height_mid;
130 for (i = 0; i < tile_count_height_mid; i++) {
132 alphablit(ptheme, &src, background, &des, 255);
133 }
134
135 /* left bottom */
136 src.y = start_y + ((ptheme->h / 4) - tile_width_height_end);
137 src.h = tile_width_height_end;
138 des.y = background->h - tile_width_height_end;
139 clear_surface(background, &des);
140 alphablit(ptheme, &src, background, &des, 255);
141
142 /* copy middle parts */
143
144 src.x = tile_width_len_end;
145 src.y = start_y;
146 src.w = tile_width_len_mid;
147
148 for (i = 0; i < tile_count_len_mid; i++) {
149
150 /* middle top */
152 des.y = 0;
153 src.y = start_y;
154 alphablit(ptheme, &src, background, &des, 255);
155
156 /* middle middle */
158 src.h = tile_width_height_mid;
159 for (j = 0; j < tile_count_height_mid; j++) {
161 alphablit(ptheme, &src, background, &des, 255);
162 }
163
164 /* middle bottom */
165 src.y = start_y + ((ptheme->h / 4) - tile_width_height_end);
166 src.h = tile_width_height_end;
167 des.y = background->h - tile_width_height_end;
168 clear_surface(background, &des);
169 alphablit(ptheme, &src, background, &des, 255);
170 }
171
172 /* copy right end */
173
174 /* right top */
175 src.x = ptheme->w - tile_width_len_end;
176 src.y = start_y;
177 src.w = tile_width_len_end;
178
179 des.x = background->w - tile_width_len_end;
180 des.y = 0;
181
182 alphablit(ptheme, &src, background, &des, 255);
183
184 /* right middle */
186 src.h = tile_width_height_mid;
187 for (i = 0; i < tile_count_height_mid; i++) {
189 alphablit(ptheme, &src, background, &des, 255);
190 }
191
192 /* right bottom */
193 src.y = start_y + ((ptheme->h / 4) - tile_width_height_end);
194 src.h = tile_width_height_end;
195 des.y = background->h - tile_width_height_end;
196 clear_surface(background, &des);
197 alphablit(ptheme, &src, background, &des, 255);
198
199 if (zoom) {
200 SDL_Surface *zoomed = resize_surface(background, width, height, 1);
201
202 FREESURFACE(background);
203 background = zoomed;
204 }
205
206 return background;
207}
208
209/* =================================================== */
210/* ===================== WIDGET LIST ==================== */
211/* =================================================== */
212
213/**********************************************************************/
219 int x, int y)
220{
221 struct widget *pwidget;
222
224
225 while (pwidget) {
226 SDL_Rect area = {
227 .x = pwidget->dst->dest_rect.x + pwidget->size.x,
228 .y = pwidget->dst->dest_rect.y + pwidget->size.y,
229 .w = pwidget->size.w,
230 .h = pwidget->size.h};
231
232 if (is_in_rect_area(x, y, &area)
233 && !((get_wflags(pwidget) & WF_HIDDEN) == WF_HIDDEN)) {
234 return (struct widget *) pwidget;
235 }
236 pwidget = pwidget->next;
237 }
238
239 return NULL;
240}
241
242/**********************************************************************/
250{
251 struct widget *pwidget;
252
254
256 while (pwidget) {
257 if ((pwidget->key == key->key
258 || (pwidget->key == SDLK_RETURN && key->key == SDLK_KP_ENTER)
259 || (pwidget->key == SDLK_KP_ENTER && key->key == SDLK_RETURN))
260 && ((pwidget->mod & key->mod) || (pwidget->mod == key->mod))) {
261 if (!((get_wstate(pwidget) == FC_WS_DISABLED)
262 || ((get_wflags(pwidget) & WF_HIDDEN) == WF_HIDDEN))) {
263 return (struct widget *) pwidget;
264 }
265 }
266 pwidget = pwidget->next;
267 }
268
269 return NULL;
270}
271
272/**********************************************************************/
293{
294 Uint16 id;
295
296 if (!pwidget) {
297 return 0;
298 }
299
301 if (info_area) {
305 }
306
307 switch (get_wtype(pwidget)) {
308 case WT_TI_BUTTON:
309 case WT_I_BUTTON:
310 case WT_ICON:
311 case WT_ICON2:
313 set_wstate(pwidget, FC_WS_PRESSED);
314 widget_redraw(pwidget);
315 widget_mark_dirty(pwidget);
316 flush_dirty();
317 set_wstate(pwidget, FC_WS_SELECTED);
318 SDL_Delay(300);
319 }
320 if (pwidget->action != NULL && pwidget->action(pwidget)) {
321 id = 0;
322 } else {
323 id = pwidget->id;
324 }
325
326 break;
327
328 case WT_EDIT:
329 {
331 bool ret, loop = (get_wflags(pwidget) & WF_EDIT_LOOP);
332 enum edit_return_codes change;
333
334 do {
335 ret = FALSE;
336 change = edit_field(pwidget);
337 if (change != ED_FORCE_EXIT && (!loop || change != ED_RETURN)) {
338 widget_redraw(pwidget);
339 widget_mark_dirty(pwidget);
340 flush_dirty();
341 }
342 if (change != ED_FORCE_EXIT && change != ED_ESC
343 && pwidget->action != NULL) {
344 pwidget->action(pwidget);
345 }
346 if (loop && change == ED_RETURN) {
347 ret = TRUE;
348 }
349 } while (ret);
350 }
351
352 id = 0;
353 break;
354 }
355 case WT_VSCROLLBAR:
356 case WT_HSCROLLBAR:
358 set_wstate(pwidget, FC_WS_PRESSED);
359 widget_redraw(pwidget);
360 widget_mark_dirty(pwidget);
361 flush_dirty();
362 }
363 if (pwidget->action != NULL && pwidget->action(pwidget)) {
364 id = 0;
365 } else {
366 id = pwidget->id;
367 }
368
369 break;
370 case WT_CHECKBOX:
371 case WT_TCHECKBOX:
373 set_wstate(pwidget, FC_WS_PRESSED);
374 widget_redraw(pwidget);
375 widget_mark_dirty(pwidget);
376 flush_dirty();
377 set_wstate(pwidget, FC_WS_SELECTED);
378 toggle_checkbox(pwidget);
379 SDL_Delay(300);
380 }
381 if (pwidget->action != NULL && pwidget->action(pwidget)) {
382 id = 0;
383 } else {
384 id = pwidget->id;
385 }
386
387 break;
388 case WT_COMBO:
390 set_wstate(pwidget, FC_WS_PRESSED);
391 combo_popup(pwidget);
392 } else {
393 combo_popdown(pwidget);
394 }
395
396 id = 0;
397 break;
398 default:
399 if (pwidget->action != NULL && pwidget->action(pwidget)) {
400 id = 0;
401 } else {
402 id = pwidget->id;
403 }
404
405 break;
406 }
407
408 return id;
409}
410
411/**********************************************************************/
415{
418
421
422 /* turn off quick info timer/counter */
424 }
425 }
426
427 if (info_area) {
431 }
432
434}
435
436/**********************************************************************/
439void widget_selected_action(struct widget *pwidget)
440{
441 if (!pwidget || pwidget == selected_widget) {
442 return;
443 }
444
445 if (selected_widget) {
447 }
448
449 set_wstate(pwidget, FC_WS_SELECTED);
450
451 pwidget->select(pwidget);
452
453 selected_widget = pwidget;
454
455 if (get_wflags(pwidget) & WF_WIDGET_HAS_INFO_LABEL) {
457 }
458}
459
460/**********************************************************************/
464{
465 SDL_Surface *text;
468 struct widget *pwidget = selected_widget;
469
470 if (!pwidget || !pwidget->info_label) {
471 return;
472 }
473
474 if (!info_label) {
475 info_area = fc_calloc(1, sizeof(SDL_Rect));
476
477 color = pwidget->info_label->fgcol;
478 pwidget->info_label->style |= TTF_STYLE_BOLD;
480
481 /* Create string and bcgd theme */
482 text = create_text_surf_from_utf8(pwidget->info_label);
483
484 pwidget->info_label->fgcol = color;
485
486 info_label = create_filled_surface(text->w + adj_size(10), text->h + adj_size(6),
488
489 /* Calculate start position */
490 if ((pwidget->dst->dest_rect.y + pwidget->size.y) - info_label->h - adj_size(6) < 0) {
491 info_area->y = (pwidget->dst->dest_rect.y + pwidget->size.y) + pwidget->size.h + adj_size(3);
492 } else {
493 info_area->y = (pwidget->dst->dest_rect.y + pwidget->size.y) - info_label->h - adj_size(5);
494 }
495
496 if ((pwidget->dst->dest_rect.x + pwidget->size.x) + info_label->w + adj_size(5) > main_window_width()) {
497 info_area->x = (pwidget->dst->dest_rect.x + pwidget->size.x) - info_label->w - adj_size(5);
498 } else {
499 info_area->x = (pwidget->dst->dest_rect.x + pwidget->size.x) + adj_size(3);
500 }
501
502 info_area->w = info_label->w + adj_size(2);
503 info_area->h = info_label->h + adj_size(3);
504
505 /* Draw text */
506 dstrect.x = adj_size(6);
507 dstrect.y = adj_size(3);
508
509 alphablit(text, NULL, info_label, &dstrect, 255);
510
511 FREESURFACE(text);
512
513 /* Draw frame */
515 0, 0, info_label->w - 1, info_label->h - 1,
517
518 }
519
520 if (rect) {
521 dstrect.x = MAX(rect->x, info_area->x);
522 dstrect.y = MAX(rect->y, info_area->y);
523
524 srcrect.x = dstrect.x - info_area->x;
525 srcrect.y = dstrect.y - info_area->y;
526 srcrect.w = MIN((info_area->x + info_area->w), (rect->x + rect->w)) - dstrect.x;
527 srcrect.h = MIN((info_area->y + info_area->h), (rect->y + rect->h)) - dstrect.y;
528
530 } else {
532 }
533
536#if 0
538 info_area->w, info_area->h);
539#endif /* 0 */
540 }
541}
542
543/**********************************************************************/
548 Uint16 id, enum scan_direction direction)
549{
550 if (direction == SCAN_FORWARD) {
551 while (gui_list) {
552 if (gui_list->id == id) {
553 return (struct widget *) gui_list;
554 }
556 }
557 } else {
558 while (gui_list) {
559 if (gui_list->id == id) {
560 return (struct widget *) gui_list;
561 }
563 }
564 }
565
566 return NULL;
567}
568
569/**********************************************************************/
577
578/**********************************************************************/
582{
585 gui->id = id;
588 } else {
591 }
592}
593
594/**********************************************************************/
598{
599 new_widget->next = add_dock;
600 new_widget->prev = add_dock->prev;
601 if (add_dock->prev) {
602 add_dock->prev->next = new_widget;
603 }
604 add_dock->prev = new_widget;
607 }
608}
609
610/**********************************************************************/
618{
619 if (!gui) {
620 return;
621 }
622
625 }
626
627 if (gui->prev && gui->next) {
628 gui->prev->next = gui->next;
629 gui->next->prev = gui->prev;
630 } else {
631 if (gui->prev) {
632 gui->prev->next = NULL;
633 }
634
635 if (gui->next) {
636 gui->next->prev = NULL;
637 }
638
639 }
640
641 if (selected_widget == gui) {
643 }
644}
645
646/**********************************************************************/
653{
654 return (begin_main_widget_list == gui);
655}
656
657/**********************************************************************/
663{
664 if (!gui || gui == begin_main_widget_list) {
665 return;
666 }
667
668 /* gui->prev always exists because
669 we don't do this to begin_main_widget_list */
670 if (gui->next) {
671 gui->prev->next = gui->next;
672 gui->next->prev = gui->prev;
673 } else {
674 gui->prev->next = NULL;
675 }
676
680 gui->prev = NULL;
681}
682
683/**********************************************************************/
690
691/**********************************************************************/
695{
696 while (gui_list) {
697 if (gui_list->next) {
698 gui_list = gui_list->next;
699 FREEWIDGET(gui_list->prev);
700 } else {
702 }
703 }
704}
705
706/* ===================================================================== */
707/* ================================ Universal ========================== */
708/* ===================================================================== */
709
710/**********************************************************************/
716 const struct widget *end_group_widget_list,
717 int add_to_update)
718{
719 Uint16 count = 0;
720 struct widget *tmp_widget = (struct widget *) end_group_widget_list;
721
722 while (tmp_widget) {
723
724 if (!(get_wflags(tmp_widget) & WF_HIDDEN)) {
725
727
728 if (add_to_update) {
730 }
731
732 count++;
733 }
734
736 break;
737 }
738
739 tmp_widget = tmp_widget->prev;
740
741 }
742
743 return count;
744}
745
746/**********************************************************************/
751{
753
754 while (tmp_widget) {
757
759 break;
760 }
761
762 tmp_widget = tmp_widget->prev;
763 }
764}
765
766/**********************************************************************/
770 const struct widget *end_group_widget_list,
772{
773 struct widget *tmp_widget = (struct widget *) end_group_widget_list;
774
775 while (tmp_widget) {
776
778 tmp_widget->size.y + Yrel);
779
781 && tmp_widget->private_data.adv_dlg
782 && tmp_widget->private_data.adv_dlg->scroll) {
783 tmp_widget->private_data.adv_dlg->scroll->max += Yrel;
784 tmp_widget->private_data.adv_dlg->scroll->min += Yrel;
785 }
786
788 && tmp_widget->private_data.adv_dlg
789 && tmp_widget->private_data.adv_dlg->scroll) {
790 tmp_widget->private_data.adv_dlg->scroll->max += Xrel;
791 tmp_widget->private_data.adv_dlg->scroll->min += Xrel;
792 }
793
795 break;
796 }
797
798 tmp_widget = tmp_widget->prev;
799 }
800}
801
802/**********************************************************************/
809{
812
813 /* Widget Pointer Management */
814 while (tmp_widget) {
815
816 prev = tmp_widget->prev;
817
818 /* tmp_widget->prev always exists because we
819 don't do this to begin_main_widget_list */
820 if (tmp_widget->next) {
821 tmp_widget->prev->next = tmp_widget->next;
822 tmp_widget->next->prev = tmp_widget->prev;
823 } else {
824 tmp_widget->prev->next = NULL;
825 }
826
831
833 break;
834 }
835
836 tmp_widget = prev;
837 }
838
839 /* Window Buffer Management */
840 if (gui_layer) {
841 int i = 0;
842
843 while ((i < main_data.guis_count - 1) && main_data.guis[i]) {
844 if (main_data.guis[i] && main_data.guis[i + 1]
845 && (main_data.guis[i] == gui_layer)) {
846 main_data.guis[i] = main_data.guis[i + 1];
847 main_data.guis[i + 1] = gui_layer;
848 }
849 i++;
850 }
851 }
852}
853
854/**********************************************************************/
860{
862
864 return;
865 }
866
869 return;
870 }
871
872 tmp_widget = tmp_widget->prev;
873
874 while (tmp_widget) {
875 struct widget *buf_widget = NULL;
876
879
882 break;
883 }
884
885 tmp_widget = tmp_widget->prev;
886 }
887
888}
889
890/**********************************************************************/
894 struct widget *end_group_widget_list, enum widget_state state)
895{
897
898 while (tmp_widget) {
899 set_wstate(tmp_widget, state);
901 break;
902 }
903 tmp_widget = tmp_widget->prev;
904 }
905}
906
907/**********************************************************************/
912{
914
915 while (tmp_widget) {
917
919 break;
920 }
921
922 tmp_widget = tmp_widget->prev;
923 }
924}
925
926/**********************************************************************/
931{
933
934 while (tmp_widget) {
936
938 break;
939 }
940
941 tmp_widget = tmp_widget->prev;
942 }
943}
944
945/**********************************************************************/
951{
952 struct widget *pwidget = end_group_widget_list;
953
954 while (pwidget) {
955 widget_set_area(pwidget, area);
956
957 if (pwidget == begin_group_widget_list) {
958 break;
959 }
960
961 pwidget = pwidget->prev;
962 }
963}
964
965/* ===================================================================== *
966 * =========================== Window Group ============================ *
967 * ===================================================================== */
968
969/*
970 * Window Group - group with 'begin' and 'end' where
971 * windowed type widget is last on list ( 'end' ).
972 */
973
974/**********************************************************************/
988
989/**********************************************************************/
993bool select_window_group_dialog(struct widget *begin_widget_list,
994 struct widget *pwindow)
995{
996 if (!is_this_widget_first_on_list(begin_widget_list)) {
997 move_group_to_front_of_gui_list(begin_widget_list, pwindow);
998
999 return TRUE;
1000 }
1001
1002 return FALSE;
1003}
1004
1005/**********************************************************************/
1013{
1014 bool ret = FALSE;
1015 Sint16 old_x = end_group_widget_list->size.x, old_y = end_group_widget_list->size.y;
1016
1020 end_group_widget_list->size.x - old_x,
1021 end_group_widget_list->size.y - old_y);
1022 ret = TRUE;
1023 }
1024
1025 return ret;
1026}
1027
1028/**********************************************************************/
1034void move_window_group(struct widget *begin_widget_list, struct widget *pwindow)
1035{
1036 if (select_window_group_dialog(begin_widget_list, pwindow)) {
1037 widget_flush(pwindow);
1038 }
1039
1040 move_window_group_dialog(begin_widget_list, pwindow);
1041}
1042
1043/**********************************************************************/
1047 Sint16 start_x, Sint16 start_y,
1048 Uint16 w, Uint16 h,
1049 struct widget *begin, struct widget *end)
1050{
1051 struct widget *buf = end;
1052 register int count = 0;
1053 register int real_start_x = start_x;
1054 int ret = 0;
1055
1056 while (buf) {
1057 buf->size.x = real_start_x;
1058 buf->size.y = start_y;
1059
1060 if (w) {
1061 buf->size.w = w;
1062 }
1063
1064 if (h) {
1065 buf->size.h = h;
1066 }
1067
1068 if (((count + 1) % step) == 0) {
1069 real_start_x = start_x;
1070 start_y += buf->size.h;
1071 if (!(get_wflags(buf) & WF_HIDDEN)) {
1072 ret += buf->size.h;
1073 }
1074 } else {
1075 real_start_x += buf->size.w;
1076 }
1077
1078 if (buf == begin) {
1079 break;
1080 }
1081 count++;
1082 buf = buf->prev;
1083 }
1084
1085 return ret;
1086}
1087
1088/* =================================================== */
1089/* ======================= WINDOWs ==================== */
1090/* =================================================== */
1091
1092/**************************************************************************
1093 Window Manager Mechanism.
1094 Idea is simple each window/dialog has own buffer layer which is draw
1095 on screen during flush operations.
1096 This consume lots of memory but is extremly effecive.
1097
1098 Each widget has own "destination" parm == where ( on what buffer )
1099 will be draw.
1100**************************************************************************/
1101
1102/* =================================================== */
1103/* ======================== MISC ===================== */
1104/* =================================================== */
1105
1106/**********************************************************************/
1110 Uint16 w, Uint16 h)
1111{
1113 resize_surface(current_theme->fr_left, current_theme->fr_left->w, h, 1);
1115 resize_surface(current_theme->fr_right, current_theme->fr_right->w, h, 1);
1117 resize_surface(current_theme->fr_top, w, current_theme->fr_top->h, 1);
1119 resize_surface(current_theme->fr_bottom, w, current_theme->fr_bottom->h, 1);
1120 SDL_Rect tmp,dst = {start_x, start_y, 0, 0};
1121
1122 tmp = dst;
1123 alphablit(tmp_left, NULL, pdest, &tmp, 255);
1124
1125 dst.x += w - tmp_right->w;
1126 tmp = dst;
1127 alphablit(tmp_right, NULL, pdest, &tmp, 255);
1128
1129 dst.x = start_x;
1130 tmp = dst;
1131 alphablit(tmp_top, NULL, pdest, &tmp, 255);
1132
1133 dst.y += h - tmp_bottom->h;
1134 tmp = dst;
1135 alphablit(tmp_bottom, NULL, pdest, &tmp, 255);
1136
1141}
1142
1143/**********************************************************************/
1147{
1148 if (pwidget) {
1149 if (pwidget->gfx && pwidget->gfx->w == pwidget->size.w
1150 && pwidget->gfx->h == pwidget->size.h) {
1151 clear_surface(pwidget->gfx, NULL);
1152 alphablit(pwidget->dst->surface, &pwidget->size, pwidget->gfx, NULL, 255);
1153 } else {
1154 FREESURFACE(pwidget->gfx);
1155 pwidget->gfx = crop_rect_from_surface(pwidget->dst->surface, &pwidget->size);
1156 }
1157 }
1158}
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
char * incite_cost
Definition comments.c:75
int int id
Definition editgui_g.h:28
QString current_theme
Definition fc_client.cpp:65
void flush_dirty(void)
Definition mapview.c:468
SDL_Color * get_theme_color(enum theme_color themecolor)
Definition colors.c:47
SDL_Surface * resize_surface(const SDL_Surface *psrc, Uint16 new_width, Uint16 new_height, int smooth)
Definition graphics.c:1237
int main_window_width(void)
Definition graphics.c:685
void update_main_screen(void)
Definition graphics.c:669
void remove_gui_layer(struct gui_layer *gui_layer)
Definition graphics.c:148
SDL_Surface * create_filled_surface(Uint16 w, Uint16 h, Uint32 flags, SDL_Color *pcolor)
Definition graphics.c:368
SDL_Surface * crop_rect_from_surface(SDL_Surface *psource, SDL_Rect *prect)
Definition graphics.c:236
int alphablit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, unsigned char alpha_mod)
Definition graphics.c:199
struct gui_layer * get_gui_layer(SDL_Surface *surface)
Definition graphics.c:90
bool is_in_rect_area(int x, int y, const SDL_Rect *rect)
Definition graphics.c:925
int screen_blit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Rect *dstrect, unsigned char alpha_mod)
Definition graphics.c:223
struct sdl2_data main_data
Definition graphics.c:57
SDL_Surface * create_surf(int width, int height, Uint32 flags)
Definition graphics.c:351
int clear_surface(SDL_Surface *surf, SDL_Rect *dstrect)
Definition graphics.c:400
bool correct_rect_region(SDL_Rect *prect)
Definition graphics.c:888
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top, Sint16 width, Sint16 height, SDL_Color *pcolor)
Definition graphics.c:1348
#define FREESURFACE(ptr)
Definition graphics.h:322
#define adj_size(size)
Definition gui_main.h:141
#define PRESSED_EVENT(event)
Definition gui_main.h:71
SDL_Surface * create_text_surf_from_utf8(utf8_str *pstr)
Definition gui_string.c:425
void flush_rect(SDL_Rect *rect, bool force_flush)
Definition mapview.c:103
void dirty_sdl_rect(SDL_Rect *Rect)
Definition mapview.c:181
@ COLOR_THEME_QUICK_INFO_TEXT
Definition themecolors.h:35
@ COLOR_THEME_QUICK_INFO_BG
Definition themecolors.h:33
@ COLOR_THEME_QUICK_INFO_FRAME
Definition themecolors.h:34
static struct widget * begin_main_widget_list
Definition widget.c:55
struct widget * find_next_widget_for_key(struct widget *start_widget, SDL_Keysym key)
Definition widget.c:252
void del_widget_pointer_from_gui_list(struct widget *gui)
Definition widget.c:622
void set_new_group_start_pos(const struct widget *begin_group_widget_list, const struct widget *end_group_widget_list, Sint16 Xrel, Sint16 Yrel)
Definition widget.c:774
void redraw_widget_info_label(SDL_Rect *rect)
Definition widget.c:467
Uint16 widget_pressed_action(struct widget *pwidget)
Definition widget.c:296
void set_group_state(struct widget *begin_group_widget_list, struct widget *end_group_widget_list, enum widget_state state)
Definition widget.c:898
void move_group_to_front_of_gui_list(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:812
void correct_size_bcgnd_surf(SDL_Surface *ptheme, int *width, int *height)
Definition widget.c:63
static SDL_Surface * info_label
Definition widget.c:57
void add_to_gui_list(Uint16 id, struct widget *gui)
Definition widget.c:586
void widget_selected_action(struct widget *pwidget)
Definition widget.c:443
struct widget * get_widget_pointer_from_main_list(Uint16 id)
Definition widget.c:578
void del_group_of_widgets_from_gui_list(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:863
bool move_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:1016
struct widget * find_next_widget_at_pos(struct widget *start_widget, int x, int y)
Definition widget.c:222
struct widget * selected_widget
Definition widget.c:48
void refresh_widget_background(struct widget *pwidget)
Definition widget.c:1151
void del_gui_list(struct widget *gui_list)
Definition widget.c:699
Uint32 widget_info_counter
Definition gui_main.c:103
void draw_frame(SDL_Surface *pdest, Sint16 start_x, Sint16 start_y, Uint16 w, Uint16 h)
Definition widget.c:1114
SDL_Rect * info_area
Definition widget.c:49
void show_group(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:934
void unselect_widget_action(void)
Definition widget.c:418
void hide_group(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:915
bool is_this_widget_first_on_list(struct widget *gui)
Definition widget.c:657
struct widget * get_widget_pointer_from_id(const struct widget *gui_list, Uint16 id, enum scan_direction direction)
Definition widget.c:552
void widget_add_as_prev(struct widget *new_widget, struct widget *add_dock)
Definition widget.c:602
void undraw_group(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:754
void del_main_list(void)
Definition widget.c:691
SDL_Surface * create_bcgnd_surf(SDL_Surface *ptheme, enum widget_state state, Uint16 width, Uint16 height)
Definition widget.c:78
bool select_window_group_dialog(struct widget *begin_widget_list, struct widget *pwindow)
Definition widget.c:998
void group_set_area(struct widget *begin_group_widget_list, struct widget *end_group_widget_list, SDL_Rect area)
Definition widget.c:953
int setup_vertical_widgets_position(int step, Sint16 start_x, Sint16 start_y, Uint16 w, Uint16 h, struct widget *begin, struct widget *end)
Definition widget.c:1051
void move_widget_to_front_of_gui_list(struct widget *gui)
Definition widget.c:667
Uint16 redraw_group(const struct widget *begin_group_widget_list, const struct widget *end_group_widget_list, int add_to_update)
Definition widget.c:720
void popdown_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:983
void move_window_group(struct widget *begin_widget_list, struct widget *pwindow)
Definition widget.c:1039
static void widget_set_position(struct widget *pwidget, int x, int y)
Definition widget.h:266
widget_state
Definition widget.h:95
@ FC_WS_DISABLED
Definition widget.h:99
@ FC_WS_NORMAL
Definition widget.h:96
@ FC_WS_PRESSED
Definition widget.h:98
@ FC_WS_SELECTED
Definition widget.h:97
void clear_wflag(struct widget *pwidget, enum widget_flag flag)
Definition widget_core.c:62
scan_direction
Definition widget.h:190
@ SCAN_FORWARD
Definition widget.h:191
static void widget_mark_dirty(struct widget *pwidget)
Definition widget.h:286
static void widget_flush(struct widget *pwidget)
Definition widget.h:291
enum widget_flag get_wflags(const struct widget *pwidget)
Definition widget_core.c:86
#define FREEWIDGET(pwidget)
Definition widget.h:305
void set_wstate(struct widget *pwidget, enum widget_state state)
Definition widget_core.c:36
enum widget_state get_wstate(const struct widget *pwidget)
Definition widget_core.c:70
static void widget_undraw(struct widget *pwidget)
Definition widget.h:296
@ WF_EDIT_LOOP
Definition widget.h:91
@ WF_WIDGET_HAS_INFO_LABEL
Definition widget.h:88
@ WF_HIDDEN
Definition widget.h:68
static int widget_redraw(struct widget *pwidget)
Definition widget.h:276
#define del_widget_from_gui_list(__gui)
Definition widget.h:372
static void widget_set_area(struct widget *pwidget, SDL_Rect area)
Definition widget.h:261
enum widget_type get_wtype(const struct widget *pwidget)
Definition widget_core.c:78
void set_wflag(struct widget *pwidget, enum widget_flag flag)
Definition widget_core.c:54
#define del_group(begin_group_widget_list, end_group_widget_list)
Definition widget.h:389
@ WT_TI_BUTTON
Definition widget.h:46
@ WT_VSCROLLBAR
Definition widget.h:50
@ WT_EDIT
Definition widget.h:48
@ WT_HSCROLLBAR
Definition widget.h:51
@ WT_TCHECKBOX
Definition widget.h:59
@ WT_COMBO
Definition widget.h:62
@ WT_CHECKBOX
Definition widget.h:58
@ WT_I_BUTTON
Definition widget.h:44
@ WT_ICON2
Definition widget.h:60
@ WT_ICON
Definition widget.h:49
void toggle_checkbox(struct widget *cbox)
void combo_popup(struct widget *combo)
void combo_popdown(struct widget *combo)
enum edit_return_codes edit_field(struct widget *edit_widget)
edit_return_codes
Definition widget_edit.h:17
@ ED_FORCE_EXIT
Definition widget_edit.h:21
@ ED_ESC
Definition widget_edit.h:19
@ ED_RETURN
Definition widget_edit.h:18
bool move_window(struct widget *pwindow)
#define fc_calloc(n, esz)
Definition mem.h:38
#define FC_FREE(ptr)
Definition mem.h:41
static mpgui * gui
Definition mpgui_qt.cpp:52
#define MIN(x, y)
Definition shared.h:55
#define MAX(x, y)
Definition shared.h:54
int step
Definition specpq.h:92
struct sprite int int y
Definition sprite_g.h:31
struct sprite int x
Definition sprite_g.h:31
Definition colors.h:21
SDL_Surface * surface
Definition graphics.h:229
SDL_Rect dest_rect
Definition graphics.h:228
int guis_count
Definition graphics.h:207
SDL_Event event
Definition graphics.h:217
struct gui_layer ** guis
Definition graphics.h:216
SDL_Window * screen
Definition graphics.h:209
Uint8 style
Definition gui_string.h:53
SDL_Color fgcol
Definition gui_string.h:57
void(* unselect)(struct widget *pwidget)
Definition widget.h:168
SDL_Keycode key
Definition widget.h:153
struct widget * prev
Definition widget.h:114
struct gui_layer * dst
Definition widget.h:116
Uint16 mod
Definition widget.h:154
int(* action)(struct widget *)
Definition widget.h:157
SDL_Rect area
Definition widget.h:149
SDL_Surface * gfx
Definition widget.h:120
struct widget * next
Definition widget.h:113
utf8_str * info_label
Definition widget.h:122
void(* select)(struct widget *pwidget)
Definition widget.h:167
Uint16 id
Definition widget.h:155
SDL_Rect size
Definition widget.h:145
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47