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, SDL_SWSURFACE);
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.sym
258 || (pwidget->key == SDLK_RETURN && key.sym == SDLK_KP_ENTER)
259 || (pwidget->key == SDLK_KP_ENTER && key.sym == 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),
489
490 /* calculate start position */
491 if ((pwidget->dst->dest_rect.y + pwidget->size.y) - info_label->h - adj_size(6) < 0) {
492 info_area->y = (pwidget->dst->dest_rect.y + pwidget->size.y) + pwidget->size.h + adj_size(3);
493 } else {
494 info_area->y = (pwidget->dst->dest_rect.y + pwidget->size.y) - info_label->h - adj_size(5);
495 }
496
497 if ((pwidget->dst->dest_rect.x + pwidget->size.x) + info_label->w + adj_size(5) > main_window_width()) {
498 info_area->x = (pwidget->dst->dest_rect.x + pwidget->size.x) - info_label->w - adj_size(5);
499 } else {
500 info_area->x = (pwidget->dst->dest_rect.x + pwidget->size.x) + adj_size(3);
501 }
502
503 info_area->w = info_label->w + adj_size(2);
504 info_area->h = info_label->h + adj_size(3);
505
506 /* draw text */
507 dstrect.x = adj_size(6);
508 dstrect.y = adj_size(3);
509
510 alphablit(text, NULL, info_label, &dstrect, 255);
511
512 FREESURFACE(text);
513
514 /* draw frame */
516 0, 0, info_label->w - 1, info_label->h - 1,
518
519 }
520
521 if (rect) {
522 dstrect.x = MAX(rect->x, info_area->x);
523 dstrect.y = MAX(rect->y, info_area->y);
524
525 srcrect.x = dstrect.x - info_area->x;
526 srcrect.y = dstrect.y - info_area->y;
527 srcrect.w = MIN((info_area->x + info_area->w), (rect->x + rect->w)) - dstrect.x;
528 srcrect.h = MIN((info_area->y + info_area->h), (rect->y + rect->h)) - dstrect.y;
529
531 } else {
533 }
534
537#if 0
539 info_area->w, info_area->h);
540#endif /* 0 */
541 }
542}
543
544/**********************************************************************/
549 Uint16 id, enum scan_direction direction)
550{
551 if (direction == SCAN_FORWARD) {
552 while (gui_list) {
553 if (gui_list->id == id) {
554 return (struct widget *) gui_list;
555 }
557 }
558 } else {
559 while (gui_list) {
560 if (gui_list->id == id) {
561 return (struct widget *) gui_list;
562 }
564 }
565 }
566
567 return NULL;
568}
569
570/**********************************************************************/
578
579/**********************************************************************/
583{
586 gui->id = id;
589 } else {
592 }
593}
594
595/**********************************************************************/
599{
600 new_widget->next = add_dock;
601 new_widget->prev = add_dock->prev;
602 if (add_dock->prev) {
603 add_dock->prev->next = new_widget;
604 }
605 add_dock->prev = new_widget;
608 }
609}
610
611/**********************************************************************/
619{
620 if (!gui) {
621 return;
622 }
623
626 }
627
628 if (gui->prev && gui->next) {
629 gui->prev->next = gui->next;
630 gui->next->prev = gui->prev;
631 } else {
632 if (gui->prev) {
633 gui->prev->next = NULL;
634 }
635
636 if (gui->next) {
637 gui->next->prev = NULL;
638 }
639
640 }
641
642 if (selected_widget == gui) {
644 }
645}
646
647/**********************************************************************/
654{
655 return (begin_main_widget_list == gui);
656}
657
658/**********************************************************************/
664{
665 if (!gui || gui == begin_main_widget_list) {
666 return;
667 }
668
669 /* gui->prev always exists because
670 we don't do this to begin_main_widget_list */
671 if (gui->next) {
672 gui->prev->next = gui->next;
673 gui->next->prev = gui->prev;
674 } else {
675 gui->prev->next = NULL;
676 }
677
681 gui->prev = NULL;
682}
683
684/**********************************************************************/
691
692/**********************************************************************/
696{
697 while (gui_list) {
698 if (gui_list->next) {
699 gui_list = gui_list->next;
700 FREEWIDGET(gui_list->prev);
701 } else {
703 }
704 }
705}
706
707/* ===================================================================== */
708/* ================================ Universal ========================== */
709/* ===================================================================== */
710
711/**********************************************************************/
717 const struct widget *end_group_widget_list,
718 int add_to_update)
719{
720 Uint16 count = 0;
721 struct widget *tmp_widget = (struct widget *) end_group_widget_list;
722
723 while (tmp_widget) {
724
725 if (!(get_wflags(tmp_widget) & WF_HIDDEN)) {
726
728
729 if (add_to_update) {
731 }
732
733 count++;
734 }
735
737 break;
738 }
739
740 tmp_widget = tmp_widget->prev;
741
742 }
743
744 return count;
745}
746
747/**********************************************************************/
752{
754
755 while (tmp_widget) {
758
760 break;
761 }
762
763 tmp_widget = tmp_widget->prev;
764 }
765}
766
767/**********************************************************************/
771 const struct widget *end_group_widget_list,
773{
774 struct widget *tmp_widget = (struct widget *) end_group_widget_list;
775
776 while (tmp_widget) {
777
779 tmp_widget->size.y + Yrel);
780
782 && tmp_widget->private_data.adv_dlg
783 && tmp_widget->private_data.adv_dlg->scroll) {
784 tmp_widget->private_data.adv_dlg->scroll->max += Yrel;
785 tmp_widget->private_data.adv_dlg->scroll->min += Yrel;
786 }
787
789 && tmp_widget->private_data.adv_dlg
790 && tmp_widget->private_data.adv_dlg->scroll) {
791 tmp_widget->private_data.adv_dlg->scroll->max += Xrel;
792 tmp_widget->private_data.adv_dlg->scroll->min += Xrel;
793 }
794
796 break;
797 }
798
799 tmp_widget = tmp_widget->prev;
800 }
801}
802
803/**********************************************************************/
810{
813
814 /* Widget Pointer Management */
815 while (tmp_widget) {
816
817 prev = tmp_widget->prev;
818
819 /* tmp_widget->prev always exists because we
820 don't do this to begin_main_widget_list */
821 if (tmp_widget->next) {
822 tmp_widget->prev->next = tmp_widget->next;
823 tmp_widget->next->prev = tmp_widget->prev;
824 } else {
825 tmp_widget->prev->next = NULL;
826 }
827
832
834 break;
835 }
836
837 tmp_widget = prev;
838 }
839
840 /* Window Buffer Management */
841 if (gui_layer) {
842 int i = 0;
843
844 while ((i < main_data.guis_count - 1) && main_data.guis[i]) {
845 if (main_data.guis[i] && main_data.guis[i + 1]
846 && (main_data.guis[i] == gui_layer)) {
847 main_data.guis[i] = main_data.guis[i + 1];
848 main_data.guis[i + 1] = gui_layer;
849 }
850 i++;
851 }
852 }
853}
854
855/**********************************************************************/
861{
863
865 return;
866 }
867
870 return;
871 }
872
873 tmp_widget = tmp_widget->prev;
874
875 while (tmp_widget) {
876 struct widget *buf_widget = NULL;
877
880
883 break;
884 }
885
886 tmp_widget = tmp_widget->prev;
887 }
888
889}
890
891/**********************************************************************/
895 struct widget *end_group_widget_list, enum widget_state state)
896{
898
899 while (tmp_widget) {
900 set_wstate(tmp_widget, state);
902 break;
903 }
904 tmp_widget = tmp_widget->prev;
905 }
906}
907
908/**********************************************************************/
913{
915
916 while (tmp_widget) {
918
920 break;
921 }
922
923 tmp_widget = tmp_widget->prev;
924 }
925}
926
927/**********************************************************************/
932{
934
935 while (tmp_widget) {
937
939 break;
940 }
941
942 tmp_widget = tmp_widget->prev;
943 }
944}
945
946/**********************************************************************/
952{
953 struct widget *pwidget = end_group_widget_list;
954
955 while (pwidget) {
956 widget_set_area(pwidget, area);
957
958 if (pwidget == begin_group_widget_list) {
959 break;
960 }
961
962 pwidget = pwidget->prev;
963 }
964}
965
966/* ===================================================================== *
967 * =========================== Window Group ============================ *
968 * ===================================================================== */
969
970/*
971 * Window Group - group with 'begin' and 'end' where
972 * windowed type widget is last on list ( 'end' ).
973 */
974
975/**********************************************************************/
989
990/**********************************************************************/
994bool select_window_group_dialog(struct widget *begin_widget_list,
995 struct widget *pwindow)
996{
997 if (!is_this_widget_first_on_list(begin_widget_list)) {
998 move_group_to_front_of_gui_list(begin_widget_list, pwindow);
999
1000 return TRUE;
1001 }
1002
1003 return FALSE;
1004}
1005
1006/**********************************************************************/
1014{
1015 bool ret = FALSE;
1016 Sint16 old_x = end_group_widget_list->size.x, old_y = end_group_widget_list->size.y;
1017
1021 end_group_widget_list->size.x - old_x,
1022 end_group_widget_list->size.y - old_y);
1023 ret = TRUE;
1024 }
1025
1026 return ret;
1027}
1028
1029/**********************************************************************/
1035void move_window_group(struct widget *begin_widget_list, struct widget *pwindow)
1036{
1037 if (select_window_group_dialog(begin_widget_list, pwindow)) {
1038 widget_flush(pwindow);
1039 }
1040
1041 move_window_group_dialog(begin_widget_list, pwindow);
1042}
1043
1044/**********************************************************************/
1048 Sint16 start_x, Sint16 start_y,
1049 Uint16 w, Uint16 h,
1050 struct widget *begin, struct widget *end)
1051{
1052 struct widget *buf = end;
1053 register int count = 0;
1054 register int real_start_x = start_x;
1055 int ret = 0;
1056
1057 while (buf) {
1058 buf->size.x = real_start_x;
1059 buf->size.y = start_y;
1060
1061 if (w) {
1062 buf->size.w = w;
1063 }
1064
1065 if (h) {
1066 buf->size.h = h;
1067 }
1068
1069 if (((count + 1) % step) == 0) {
1070 real_start_x = start_x;
1071 start_y += buf->size.h;
1072 if (!(get_wflags(buf) & WF_HIDDEN)) {
1073 ret += buf->size.h;
1074 }
1075 } else {
1076 real_start_x += buf->size.w;
1077 }
1078
1079 if (buf == begin) {
1080 break;
1081 }
1082 count++;
1083 buf = buf->prev;
1084 }
1085
1086 return ret;
1087}
1088
1089/* =================================================== */
1090/* ======================= WINDOWs ==================== */
1091/* =================================================== */
1092
1093/**************************************************************************
1094 Window Manager Mechanism.
1095 Idea is simple each window/dialog has own buffer layer which is draw
1096 on screen during flush operations.
1097 This consume lots of memory but is extremly effecive.
1098
1099 Each widget has own "destination" parm == where ( on what buffer )
1100 will be draw.
1101**************************************************************************/
1102
1103/* =================================================== */
1104/* ======================== MISC ===================== */
1105/* =================================================== */
1106
1107/**********************************************************************/
1111 Uint16 w, Uint16 h)
1112{
1114 resize_surface(current_theme->fr_left, current_theme->fr_left->w, h, 1);
1116 resize_surface(current_theme->fr_right, current_theme->fr_right->w, h, 1);
1118 resize_surface(current_theme->fr_top, w, current_theme->fr_top->h, 1);
1120 resize_surface(current_theme->fr_bottom, w, current_theme->fr_bottom->h, 1);
1121 SDL_Rect tmp,dst = {start_x, start_y, 0, 0};
1122
1123 tmp = dst;
1124 alphablit(tmp_left, NULL, pdest, &tmp, 255);
1125
1126 dst.x += w - tmp_right->w;
1127 tmp = dst;
1128 alphablit(tmp_right, NULL, pdest, &tmp, 255);
1129
1130 dst.x = start_x;
1131 tmp = dst;
1132 alphablit(tmp_top, NULL, pdest, &tmp, 255);
1133
1134 dst.y += h - tmp_bottom->h;
1135 tmp = dst;
1136 alphablit(tmp_bottom, NULL, pdest, &tmp, 255);
1137
1142}
1143
1144/**********************************************************************/
1148{
1149 if (pwidget) {
1150 if (pwidget->gfx && pwidget->gfx->w == pwidget->size.w
1151 && pwidget->gfx->h == pwidget->size.h) {
1152 clear_surface(pwidget->gfx, NULL);
1153 alphablit(pwidget->dst->surface, &pwidget->size, pwidget->gfx, NULL, 255);
1154 } else {
1155 FREESURFACE(pwidget->gfx);
1156 pwidget->gfx = crop_rect_from_surface(pwidget->dst->surface, &pwidget->size);
1157 }
1158 }
1159}
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:74
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:99
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