Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-sdl2/chatline.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
chatline.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 chatline.c - description
16 -------------------
17 begin : Sun Jun 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/* SDL2 */
27#ifdef SDL2_PLAIN_INCLUDE
28#include <SDL.h>
29#else /* SDL2_PLAIN_INCLUDE */
30#include <SDL2/SDL.h>
31#endif /* SDL2_PLAIN_INCLUDE */
32
33/* utility */
34#include "fcintl.h"
35#include "log.h"
36
37/* common */
38#include "game.h"
39#include "packets.h"
40
41/* client */
42#include "client_main.h"
43#include "clinet.h"
44#include "connectdlg_common.h"
45
46/* gui-sdl2 */
47#include "colors.h"
48#include "dialogs.h"
49#include "graphics.h"
50#include "gui_id.h"
51#include "gui_main.h"
52#include "gui_tilespec.h"
53#include "mapview.h"
54#include "messagewin.h"
55#include "pages.h"
56#include "themespec.h"
57#include "utf8string.h"
58#include "widget.h"
59
60#include "chatline.h"
61
62 struct CONNLIST {
63 struct advanced_dialog *users_dlg;
64 struct advanced_dialog *chat_dlg;
65 struct widget *begin_widget_list;
66 struct widget *end_widget_list;
67 struct widget *start_button;
68 struct widget *select_nation_button;
69 struct widget *load_game_button;
70 struct widget *configure;
71 struct widget *back_button;
72 struct widget *pedit;
73 int text_width;
74 int active;
75} *conn_dlg = NULL;
76
77static void popup_conn_list_dialog(void);
78static void add_to_chat_list(char *msg, size_t n_alloc);
79
80/**************************************************************************
81 LOAD GAME
82**************************************************************************/
83
84 struct advanced_dialog *load_dialog;
85
86/**********************************************************************/
89 static int move_load_game_dlg_callback(struct widget *pwindow)
90{
91 if (PRESSED_EVENT(main_data.event)) {
92 move_window_group(load_dialog->begin_widget_list, pwindow);
93 }
94
95 return -1;
96}
97
98/**********************************************************************/
101 void popdown_load_game_dialog(void)
102{
103 if (load_dialog) {
104 popdown_window_group_dialog(load_dialog->begin_widget_list,
105 load_dialog->end_widget_list);
106 FC_FREE(load_dialog->scroll);
107 FC_FREE(load_dialog);
108
109 /* enable buttons */
110 set_wstate(conn_dlg->back_button, FC_WS_NORMAL);
111 widget_redraw(conn_dlg->back_button);
112 widget_mark_dirty(conn_dlg->back_button);
113 set_wstate(conn_dlg->load_game_button, FC_WS_NORMAL);
114 widget_redraw(conn_dlg->load_game_button);
115 widget_mark_dirty(conn_dlg->load_game_button);
116 set_wstate(conn_dlg->start_button, FC_WS_NORMAL);
117 widget_redraw(conn_dlg->start_button);
118 widget_mark_dirty(conn_dlg->start_button);
119
120 flush_dirty();
121 }
122}
123
124/**********************************************************************/
127 static int exit_load_dlg_callback(struct widget *pwidget)
128{
129 if (PRESSED_EVENT(main_data.event)) {
130 if (get_client_page() == PAGE_LOAD) {
131 set_client_page(PAGE_START);
132 } else {
133 popdown_load_game_dialog();
134 }
135 }
136
137 return -1;
138}
139
140/**********************************************************************/
143 static int load_selected_game_callback(struct widget *pwidget)
144{
145 if (PRESSED_EVENT(main_data.event)) {
146 char *filename = (char*)pwidget->data.ptr;
147
148 if (is_server_running()) {
149 send_chat_printf("/load %s", filename);
150
151 if (get_client_page() == PAGE_LOAD) {
152 set_client_page(PAGE_START);
153 } else if (get_client_page() == PAGE_START) {
154 popdown_load_game_dialog();
155 }
156 } else {
157 set_client_page(PAGE_MAIN);
158 }
159 }
160
161 return -1;
162}
163
164/**********************************************************************/
167 static void popup_load_game_dialog(void)
168{
169 struct widget *pwindow;
170 struct widget *close_button;
171 struct widget *filename_label = NULL;
172 struct widget *first_label = NULL;
173 struct widget *last_label = NULL;
174 struct widget *next_label = NULL;
175 utf8_str *title, *filename;
176 SDL_Rect area;
177 struct fileinfo_list *files;
178 int count = 0;
179 int scrollbar_width = 0;
180 int max_label_width = 0;
181
182 if (load_dialog) {
183 return;
184 }
185
186 /* Disable buttons */
187 set_wstate(conn_dlg->back_button, FC_WS_DISABLED);
188 widget_redraw(conn_dlg->back_button);
189 widget_mark_dirty(conn_dlg->back_button);
190 set_wstate(conn_dlg->load_game_button, FC_WS_DISABLED);
191 widget_redraw(conn_dlg->load_game_button);
192 widget_mark_dirty(conn_dlg->load_game_button);
193 set_wstate(conn_dlg->select_nation_button, FC_WS_DISABLED);
194 widget_redraw(conn_dlg->select_nation_button);
195 widget_mark_dirty(conn_dlg->select_nation_button);
196 set_wstate(conn_dlg->start_button, FC_WS_DISABLED);
197 widget_redraw(conn_dlg->start_button);
198 widget_mark_dirty(conn_dlg->start_button);
199
200 /* Create dialog */
201 load_dialog = fc_calloc(1, sizeof(struct advanced_dialog));
202
203 title = create_utf8_from_char_fonto(_("Choose Saved Game to Load"),
204 FONTO_ATTENTION);
205 title->style |= TTF_STYLE_BOLD;
206
207 pwindow = create_window_skeleton(NULL, title, 0);
208 pwindow->action = move_load_game_dlg_callback;
209 set_wstate(pwindow, FC_WS_NORMAL);
210
211 add_to_gui_list(ID_WINDOW, pwindow);
212
213 load_dialog->end_widget_list = pwindow;
214
215 area = pwindow->area;
216
217 /* Close button */
218 close_button = create_themeicon(current_theme->small_cancel_icon,
219 pwindow->dst,
220 WF_WIDGET_HAS_INFO_LABEL
221 | WF_RESTORE_BACKGROUND);
222 close_button->info_label
223 = create_utf8_from_char_fonto(_("Close Dialog (Esc)"), FONTO_ATTENTION);
224 close_button->action = exit_load_dlg_callback;
225 set_wstate(close_button, FC_WS_NORMAL);
226 close_button->key = SDLK_ESCAPE;
227
228 add_to_gui_list(ID_BUTTON, close_button);
229
230 area.w += close_button->size.w;
231
232 load_dialog->begin_widget_list = close_button;
233
234 /* Create scrollbar */
235 scrollbar_width = create_vertical_scrollbar(load_dialog, 1, 20, TRUE, TRUE);
236 hide_scrollbar(load_dialog->scroll);
237
238 /* Search for user saved games. */
239 files = fileinfolist_infix(get_save_dirs(), ".sav", FALSE);
240 fileinfo_list_iterate(files, pfile) {
241 count++;
242
243 filename = create_utf8_from_char_fonto(pfile->name, FONTO_ATTENTION_PLUS);
244 filename->style |= SF_CENTER;
245 filename_label = create_iconlabel(NULL, pwindow->dst, filename,
246 (WF_FREE_DATA | WF_SELECT_WITHOUT_BAR | WF_RESTORE_BACKGROUND));
247
248 /* Store filename */
249 filename_label->data.ptr = fc_calloc(1, strlen(pfile->fullname) + 1);
250 fc_strlcpy((char*)filename_label->data.ptr, pfile->fullname,
251 strlen(pfile->fullname) + 1);
252
253 filename_label->action = load_selected_game_callback;
254
255 set_wstate(filename_label, FC_WS_NORMAL);
256
257 /* FIXME: This was supposed to be add_widget_to_vertical_scroll_widget_list(), but
258 * add_widget_to_vertical_scroll_widget_list() needs the scrollbar area to be defined
259 * for updating the scrollbar position, but the area is not known yet (depends on
260 * maximum label width) */
261 add_to_gui_list(ID_LABEL, filename_label);
262
263 if (count == 1) {
264 first_label = filename_label;
265 }
266
267 max_label_width = MAX(max_label_width, filename_label->size.w);
268 } fileinfo_list_iterate_end;
269 fileinfo_list_destroy(files);
270
271 last_label = filename_label;
272
273 area.w = MAX(area.w, max_label_width + scrollbar_width + 1);
274
275 if (count > 0) {
276 area.h = (load_dialog->scroll->active * filename_label->size.h) + adj_size(5);
277 }
278
279 resize_window(pwindow, theme_get_background(active_theme,
280 BACKGROUND_LOADGAMEDLG),
281 NULL,
282 (pwindow->size.w - pwindow->area.w) + area.w,
283 (pwindow->size.h - pwindow->area.h) + area.h);
284
285 area = pwindow->area;
286
287 setup_vertical_scrollbar_area(load_dialog->scroll,
288 area.x + area.w - 1,
289 area.y + 1,
290 area.h - adj_size(2), TRUE);
291
292 /* Add filename labels to list */
293 filename_label = first_label;
294 while (filename_label) {
295 filename_label->size.w = area.w - scrollbar_width - 3;
296
297 next_label = filename_label->prev;
298
299 del_widget_pointer_from_gui_list(filename_label);
300 if (filename_label == first_label) {
301 add_widget_to_vertical_scroll_widget_list(load_dialog,
302 filename_label, close_button,
303 FALSE,
304 area.x + 1,
305 area.y + adj_size(2));
306 } else {
307 add_widget_to_vertical_scroll_widget_list(load_dialog,
308 filename_label,
309 load_dialog->begin_active_widget_list,
310 FALSE,
311 area.x + 1,
312 area.y + adj_size(2));
313 }
314
315 if (filename_label == last_label) {
316 break;
317 }
318
319 filename_label = next_label;
320 }
321
322 widget_set_position(pwindow,
323 (main_window_width() - pwindow->size.w) / 2,
324 (main_window_height() - pwindow->size.h) / 2);
325
326 widget_set_position(close_button,
327 area.x + area.w - close_button->size.w - 1,
328 pwindow->size.y + adj_size(2));
329
330 /* FIXME: The scrollbar already got a background saved in
331 * add_widget_to_vertical_scroll_widget_list(), but the window
332 * is not drawn yet, so this saved background is wrong.
333 * Deleting it here as a workaround. */
334 FREESURFACE(load_dialog->scroll->pscroll_bar->gfx);
335
336 redraw_group(load_dialog->begin_widget_list, pwindow, 1);
337 flush_dirty();
338}
339
340/**********************************************************************/
343 static int inputline_return_callback(struct widget *pwidget)
344{
345 if (pwidget->string_utf8->text != NULL
346 && pwidget->string_utf8->text[0] != '\0') {
347 send_chat(pwidget->string_utf8->text);
348
349 output_window_append(ftc_any, pwidget->string_utf8->text);
350 }
351
352 return -1;
353}
354
355/**********************************************************************/
358 void popup_input_line(void)
359{
360 struct widget *input_edit;
361
362 input_edit = create_edit_from_chars_fonto(NULL, main_data.gui, "",
363 FONTO_ATTENTION,
364 adj_size(400), 0);
365
366 input_edit->size.x = (main_window_width() - input_edit->size.w) / 2;
367 input_edit->size.y = (main_window_height() - input_edit->size.h) / 2;
368
369 if (edit(input_edit) != ED_ESC) {
370 inputline_return_callback(input_edit);
371 }
372
373 widget_undraw(input_edit);
374 widget_mark_dirty(input_edit);
375 FREEWIDGET(input_edit);
376
377 flush_dirty();
378}
379
380/**********************************************************************/
384 void real_output_window_append(const char *astring,
385 const struct text_tag_list *tags,
386 int conn_id)
387{
388 /* Currently this is a wrapper to the message subsystem. */
389 if (conn_dlg) {
390 size_t n = strlen(astring);
391 char *buffer = fc_strdup(astring);
392
393 add_to_chat_list(buffer, n);
394 } else {
395 meswin_add(astring, tags, NULL, E_CHAT_MSG,
396 game.info.turn, game.info.phase);
397 }
398}
399
400/**********************************************************************/
404 void log_output_window(void)
405{
406 /* TODO */
407}
408
409/**********************************************************************/
412 void clear_output_window(void)
413{
414 /* TODO */
415}
416
417/* ====================================================================== */
418
419/**********************************************************************/
422 static int conn_dlg_callback(struct widget *pwindow)
423{
424 return -1;
425}
426
427/**********************************************************************/
430 static int disconnect_conn_callback(struct widget *pwidget)
431{
432 if (PRESSED_EVENT(main_data.event)) {
433 popdown_conn_list_dialog();
434 flush_dirty();
435 disconnect_from_server();
436 }
437
438 return -1;
439}
440
441/**********************************************************************/
444 static void add_to_chat_list(char *msg, size_t n_alloc)
445{
446 utf8_str *pstr;
447 struct widget *buf, *pwindow = conn_dlg->end_widget_list;
448
449 fc_assert_ret(msg != NULL);
450 fc_assert_ret(n_alloc != 0);
451
452 pstr = create_utf8_str_fonto(msg, n_alloc, FONTO_ATTENTION);
453
454 if (convert_utf8_str_to_const_surface_width(pstr,
455 conn_dlg->text_width - adj_size(5))) {
456 utf8_str *pstr2;
457 int count = 0;
458 char **utf8_texts = create_new_line_utf8strs(pstr->text);
459
460 while (utf8_texts[count] != NULL) {
461 pstr2 = create_utf8_str_fonto(utf8_texts[count],
462 strlen(utf8_texts[count]) + 1,
463 FONTO_ATTENTION);
464 pstr2->bgcol = (SDL_Color) {0, 0, 0, 0};
465 buf = create_themelabel2(NULL, pwindow->dst,
466 pstr2, conn_dlg->text_width, 0,
467 (WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE));
468
469 buf->size.w = conn_dlg->text_width;
470 add_widget_to_vertical_scroll_widget_list(conn_dlg->chat_dlg, buf,
471 conn_dlg->chat_dlg->begin_active_widget_list, FALSE,
472 pwindow->size.x + adj_size(10 + 60 + 10),
473 pwindow->size.y + adj_size(14));
474 count++;
475 }
476 redraw_group(conn_dlg->chat_dlg->begin_widget_list,
477 conn_dlg->chat_dlg->end_widget_list, TRUE);
478 FREEUTF8STR(pstr);
479 } else {
480 pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
481 buf = create_themelabel2(NULL, pwindow->dst,
482 pstr, conn_dlg->text_width, 0,
483 (WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE));
484
485 buf->size.w = conn_dlg->text_width;
486
487 if (add_widget_to_vertical_scroll_widget_list(conn_dlg->chat_dlg, buf,
488 conn_dlg->chat_dlg->begin_active_widget_list, FALSE,
489 pwindow->size.x + adj_size(10 + 60 + 10),
490 pwindow->size.y + adj_size(14))) {
491 redraw_group(conn_dlg->chat_dlg->begin_widget_list,
492 conn_dlg->chat_dlg->end_widget_list, TRUE);
493 } else {
494 widget_redraw(buf);
495 widget_mark_dirty(buf);
496 }
497 }
498
499 flush_dirty();
500}
501
502/**********************************************************************/
505 static int input_edit_conn_callback(struct widget *pwidget)
506{
507 if (pwidget->string_utf8->text != NULL) {
508 if (pwidget->string_utf8->text[0] != '\0') {
509 send_chat(pwidget->string_utf8->text);
510 }
511
512 free(pwidget->string_utf8->text);
513 pwidget->string_utf8->text = fc_malloc(1);
514 pwidget->string_utf8->text[0] = '\0';
515 pwidget->string_utf8->n_alloc = 0;
516 }
517
518 return -1;
519}
520
521/**********************************************************************/
524 static int start_game_callback(struct widget *pwidget)
525{
526 if (PRESSED_EVENT(main_data.event)) {
527 send_chat("/start");
528 }
529
530 return -1;
531}
532
533/**********************************************************************/
536 static int select_nation_callback(struct widget *pwidget)
537{
538 if (PRESSED_EVENT(main_data.event)) {
539 popup_races_dialog(client.conn.playing);
540 }
541
542 return -1;
543}
544
545/* not implemented yet */
546#if 0
547/**********************************************************************/
550static int server_config_callback(struct widget *pwidget)
551{
552 return -1;
553}
554#endif /* 0 */
555
556/**********************************************************************/
559 static int load_game_callback(struct widget *pwidget)
560{
561 if (PRESSED_EVENT(main_data.event)) {
562 /* set_wstate(conn_dlg->load_game_button, FC_WS_NORMAL);
563 * widget_redraw(conn_dlg->load_game_button);
564 * flush_dirty(); */
565 popup_load_game_dialog();
566 }
567
568 return -1;
569}
570
571/**********************************************************************/
574 void real_conn_list_dialog_update(void *unused)
575{
576 if (C_S_PREPARING == client_state()) {
577 if (conn_dlg) {
578 struct widget *buf = NULL, *pwindow = conn_dlg->end_widget_list;
579 utf8_str *pstr = create_utf8_str_fonto(NULL, 0, FONTO_ATTENTION);
580 bool create;
581
582 pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
583
584 if (conn_dlg->users_dlg) {
585 del_group(conn_dlg->users_dlg->begin_active_widget_list,
586 conn_dlg->users_dlg->end_active_widget_list);
587 conn_dlg->users_dlg->active_widget_list = NULL;
588 conn_dlg->users_dlg->begin_widget_list =
589 conn_dlg->users_dlg->scroll->pscroll_bar;
590 conn_dlg->users_dlg->scroll->count = 0;
591 } else {
592 conn_dlg->users_dlg = fc_calloc(1, sizeof(struct advanced_dialog));
593 conn_dlg->users_dlg->end_widget_list = conn_dlg->begin_widget_list;
594 conn_dlg->users_dlg->begin_widget_list = conn_dlg->begin_widget_list;
595
596 create_vertical_scrollbar(conn_dlg->users_dlg, 1,
597 conn_dlg->active, TRUE, TRUE);
598 conn_dlg->users_dlg->end_widget_list =
599 conn_dlg->users_dlg->end_widget_list->prev;
600 setup_vertical_scrollbar_area(conn_dlg->users_dlg->scroll,
601 pwindow->size.x + pwindow->size.w - adj_size(30),
602 pwindow->size.y + adj_size(14),
603 pwindow->size.h - adj_size(44) - adj_size(40), FALSE);
604 }
605
606 hide_scrollbar(conn_dlg->users_dlg->scroll);
607 create = TRUE;
608 conn_list_iterate(game.est_connections, pconn) {
609 copy_chars_to_utf8_str(pstr, pconn->username);
610
611 buf = create_themelabel2(NULL, pwindow->dst, pstr, adj_size(100), 0,
612 (WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE));
613 clear_wflag(buf, WF_FREE_STRING);
614
615 buf->id = ID_LABEL;
616
617 /* add to widget list */
618 if (create) {
619 add_widget_to_vertical_scroll_widget_list(conn_dlg->users_dlg,
620 buf, conn_dlg->users_dlg->begin_widget_list, FALSE,
621 pwindow->area.x + pwindow->area.w - adj_size(130),
622 pwindow->size.y + adj_size(14));
623 create = FALSE;
624 } else {
625 add_widget_to_vertical_scroll_widget_list(conn_dlg->users_dlg,
626 buf, conn_dlg->users_dlg->begin_active_widget_list, FALSE,
627 pwindow->area.x + pwindow->area.w - adj_size(130),
628 pwindow->size.y + adj_size(14));
629 }
630 } conn_list_iterate_end;
631
632 conn_dlg->begin_widget_list = conn_dlg->users_dlg->begin_widget_list;
633 FREEUTF8STR(pstr);
634
635/* FIXME: implement the server settings dialog and then reactivate this part */
636#if 0
637 if (ALLOW_CTRL == client.conn.access_level
638 || ALLOW_HACK == client.conn.access_level) {
639 set_wstate(conn_dlg->configure, FC_WS_NORMAL);
640 } else {
641 set_wstate(conn_dlg->configure, FC_WS_DISABLED);
642 }
643#endif /* 0 */
644
645 /* redraw */
646 redraw_group(conn_dlg->begin_widget_list, conn_dlg->end_widget_list, 0);
647
648 widget_flush(conn_dlg->end_widget_list);
649 } else {
650 popup_conn_list_dialog();
651 }
652
653 /* PAGE_LOAD -> the server was started from the main page to load a game */
654 if (get_client_page() == PAGE_LOAD) {
655 popup_load_game_dialog();
656 }
657 } else {
658 if (popdown_conn_list_dialog()) {
659 flush_dirty();
660 }
661 }
662}
663
664/**********************************************************************/
667 static void popup_conn_list_dialog(void)
668{
669 SDL_Color window_bg_color = {255, 255, 255, 96};
670
671 struct widget *pwindow = NULL, *buf = NULL, *label = NULL;
672 struct widget* back_button = NULL;
673 struct widget *start_game_button = NULL;
674 struct widget *select_nation_button = NULL;
675/* struct widget *server_settings_button = NULL; */
676 utf8_str *pstr = NULL;
677 int n;
678 SDL_Rect area;
679 SDL_Surface *surf;
680
681 if (conn_dlg || !client.conn.established) {
682 return;
683 }
684
685 meswin_dialog_popdown();
686
687 conn_dlg = fc_calloc(1, sizeof(struct CONNLIST));
688
689 pwindow = create_window_skeleton(NULL, NULL, 0);
690 pwindow->action = conn_dlg_callback;
691 set_wstate(pwindow, FC_WS_NORMAL);
692 clear_wflag(pwindow, WF_DRAW_FRAME_AROUND_WIDGET);
693
694 conn_dlg->end_widget_list = pwindow;
695 add_to_gui_list(ID_WINDOW, pwindow);
696
697 widget_set_position(pwindow, 0, 0);
698
699 /* Create window background */
700 surf = theme_get_background(active_theme, BACKGROUND_CONNLISTDLG);
701 if (resize_window(pwindow, surf, NULL, main_window_width(),
702 main_window_height())) {
703 FREESURFACE(surf);
704 }
705
706 conn_dlg->text_width
707 = pwindow->size.w - adj_size(130) - adj_size(20) - adj_size(20);
708
709 /* Chat area background */
710 area.x = adj_size(10);
711 area.y = adj_size(14);
712 area.w = conn_dlg->text_width + adj_size(20);
713 area.h = pwindow->size.h - adj_size(44) - adj_size(40);
714 fill_rect_alpha(pwindow->theme, &area, &window_bg_color);
715
716 create_frame(pwindow->theme,
717 area.x - 1, area.y - 1, area.w + 1, area.h + 1,
718 get_theme_color(COLOR_THEME_CONNLISTDLG_FRAME));
719
720 /* User list background */
721 area.x = pwindow->size.w - adj_size(130);
722 area.y = adj_size(14);
723 area.w = adj_size(120);
724 area.h = pwindow->size.h - adj_size(44) - adj_size(40);
725 fill_rect_alpha(pwindow->theme, &area, &window_bg_color);
726
727 create_frame(pwindow->theme,
728 area.x - 1, area.y - 1, area.w + 1, area.h + 1,
729 get_theme_color(COLOR_THEME_CONNLISTDLG_FRAME));
730
731 draw_frame(pwindow->theme, 0, 0, pwindow->theme->w, pwindow->theme->h);
732
733 /* -------------------------------- */
734
735 /* Chat area */
736
737 conn_dlg->chat_dlg = fc_calloc(1, sizeof(struct advanced_dialog));
738
739 n = conn_list_size(game.est_connections);
740
741 {
742 char cbuf[256];
743
744 fc_snprintf(cbuf, sizeof(cbuf), _("Total users logged in : %d"), n);
745 pstr = create_utf8_from_char_fonto(cbuf, FONTO_ATTENTION);
746 }
747
748 pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
749
750 label = create_themelabel2(NULL, pwindow->dst,
751 pstr, conn_dlg->text_width, 0,
752 (WF_RESTORE_BACKGROUND|WF_DRAW_TEXT_LABEL_WITH_SPACE));
753
754 widget_set_position(label, adj_size(10), adj_size(14));
755
756 add_to_gui_list(ID_LABEL, label);
757
758 conn_dlg->chat_dlg->begin_widget_list = label;
759 conn_dlg->chat_dlg->end_widget_list = label;
760 conn_dlg->chat_dlg->begin_active_widget_list = conn_dlg->chat_dlg->begin_widget_list;
761 conn_dlg->chat_dlg->end_active_widget_list = conn_dlg->chat_dlg->end_widget_list;
762
763 n = (pwindow->size.h - adj_size(44) - adj_size(40)) / label->size.h;
764 conn_dlg->active = n;
765
766 create_vertical_scrollbar(conn_dlg->chat_dlg, 1,
767 conn_dlg->active, TRUE, TRUE);
768
769 setup_vertical_scrollbar_area(conn_dlg->chat_dlg->scroll,
770 adj_size(10) + conn_dlg->text_width + 1,
771 adj_size(14), pwindow->size.h - adj_size(44) - adj_size(40), FALSE);
772 hide_scrollbar(conn_dlg->chat_dlg->scroll);
773
774 /* -------------------------------- */
775
776 /* Input field */
777
778 buf = create_edit_from_chars_fonto(NULL, pwindow->dst, "",
779 FONTO_ATTENTION,
780 pwindow->size.w - adj_size(10) - adj_size(10),
781 (WF_RESTORE_BACKGROUND|WF_EDIT_LOOP));
782
783 buf->size.x = adj_size(10);
784 buf->size.y = pwindow->size.h - adj_size(40) - adj_size(5) - buf->size.h;
785 buf->action = input_edit_conn_callback;
786 set_wstate(buf, FC_WS_NORMAL);
787 conn_dlg->pedit = buf;
788 add_to_gui_list(ID_EDIT, buf);
789
790 /* Buttons */
791
792 buf = create_themeicon_button_from_chars_fonto(current_theme->back_icon,
793 pwindow->dst,
794 _("Back"), FONTO_ATTENTION, 0);
795 buf->size.x = adj_size(10);
796 buf->size.y = pwindow->size.h - adj_size(10) - buf->size.h;
797 conn_dlg->back_button = buf;
798 buf->action = disconnect_conn_callback;
799 set_wstate(buf, FC_WS_NORMAL);
800 buf->key = SDLK_ESCAPE;
801 add_to_gui_list(ID_BUTTON, buf);
802 back_button = buf;
803
804 buf = create_themeicon_button_from_chars_fonto(current_theme->ok_icon,
805 pwindow->dst,
806 _("Start"),
807 FONTO_ATTENTION, 0);
808 buf->size.x = pwindow->size.w - adj_size(10) - buf->size.w;
809 buf->size.y = back_button->size.y;
810 conn_dlg->start_button = buf;
811 buf->action = start_game_callback;
812 set_wstate(buf, FC_WS_NORMAL);
813 add_to_gui_list(ID_BUTTON, buf);
814 start_game_button = buf;
815
816 buf = create_themeicon_button_from_chars_fonto(NULL, pwindow->dst,
817 _("Pick Nation"),
818 FONTO_ATTENTION, 0);
819 buf->size.h = start_game_button->size.h;
820 buf->size.x = start_game_button->size.x - adj_size(10) - buf->size.w;
821 buf->size.y = start_game_button->size.y;
822 conn_dlg->select_nation_button = buf;
823 buf->action = select_nation_callback;
824 set_wstate(buf, FC_WS_NORMAL);
825 add_to_gui_list(ID_BUTTON, buf);
826 select_nation_button = buf;
827
828 buf = create_themeicon_button_from_chars_fonto(NULL, pwindow->dst,
829 _("Load Game"),
830 FONTO_ATTENTION, 0);
831 buf->size.h = select_nation_button->size.h;
832 buf->size.x = select_nation_button->size.x - adj_size(10) - buf->size.w;
833 buf->size.y = select_nation_button->size.y;
834 conn_dlg->load_game_button = buf;
835 buf->action = load_game_callback;
836 set_wstate(buf, FC_WS_NORMAL);
837 add_to_gui_list(ID_BUTTON, buf);
838
839 /* Not implemented yet */
840#if 0
841 buf = create_themeicon_button_from_chars_fonto(NULL, pwindow->dst,
842 _("Server Settings"),
843 FONTO_ATTENTION, 0);
844 buf->size.h = select_nation_button->size.h;
845 buf->size.x = select_nation_button->size.x - adj_size(10) - buf->size.w;
846 buf->size.y = select_nation_button->size.y;
847 conn_dlg->configure = buf;
848 buf->action = server_config_callback;
849 set_wstate(buf, FC_WS_DISABLED);
850 add_to_gui_list(ID_BUTTON, buf);
851 server_settings_button = buf;
852#endif /* 0 */
853
854 /* Not implemented yet */
855#if 0
856 buf = create_themeicon_button_from_chars_fonto(NULL, pwindow->dst->surface,
857 "?", FONTO_ATTENTION, 0);
858 buf->size.y = pwindow->size.y + pwindow->size.h - (buf->size.h + 7);
859 buf->size.x = pwindow->size.x + pwindow->size.w - (buf->size.w + 10) - 5;
860
861 buf->action = client_config_callback;
862 set_wstate(buf, FC_WS_NORMAL);
863 add_to_gui_list(ID_BUTTON, buf);
864#endif /* 0 */
865
866 conn_dlg->begin_widget_list = buf;
867 /* ------------------------------------------------------------ */
868
869 conn_list_dialog_update();
870}
871
872/**********************************************************************/
875 bool popdown_conn_list_dialog(void)
876{
877 if (conn_dlg) {
878 if (get_wstate(conn_dlg->pedit) == FC_WS_PRESSED) {
879 force_exit_from_event_loop();
880 }
881
882 popdown_window_group_dialog(conn_dlg->begin_widget_list,
883 conn_dlg->end_widget_list);
884 if (conn_dlg->users_dlg) {
885 FC_FREE(conn_dlg->users_dlg->scroll);
886 FC_FREE(conn_dlg->users_dlg);
887 }
888
889 if (conn_dlg->chat_dlg) {
890 FC_FREE(conn_dlg->chat_dlg->scroll);
891 FC_FREE(conn_dlg->chat_dlg);
892 }
893
894 FC_FREE(conn_dlg);
895
896 return TRUE;
897 }
898
899 return FALSE;
900}
901
902/**********************************************************************/
905 void version_message(const char *vertext)
906{
907 output_window_append(ftc_client, vertext);
908}
n_alloc
#define n_alloc
Definition astring.c:78
n
#define n
Definition astring.c:77
send_chat_printf
int send_chat_printf(const char *format,...)
Definition chatline_common.c:55
send_chat
int send_chat(const char *message)
Definition chatline_common.c:46
output_window_append
void output_window_append(const struct ft_color color, const char *featured_text)
Definition chatline_common.c:104
client
struct civclient client
Definition client_main.c:149
client_state
enum client_states client_state(void)
Definition client_main.c:1029
client_main.h
C_S_PREPARING
@ C_S_PREPARING
Definition client_main.h:46
disconnect_from_server
void disconnect_from_server(void)
Definition clinet.c:305
clinet.h
is_server_running
bool is_server_running(void)
Definition connectdlg_common.c:124
connectdlg_common.h
conn_list_iterate
#define conn_list_iterate(connlist, pconn)
Definition connection.h:113
conn_list_iterate_end
#define conn_list_iterate_end
Definition connection.h:115
current_theme
QString current_theme
Definition fc_client.cpp:65
fcintl.h
_
#define _(String)
Definition fcintl.h:67
ftc_client
const struct ft_color ftc_client
Definition featured_text.c:78
ftc_any
const struct ft_color ftc_any
Definition featured_text.c:73
game
struct civ_game game
Definition game.c:57
game.h
version_message
void version_message(const char *vertext)
Definition chatline.c:1469
log_output_window
void log_output_window(void)
Definition chatline.c:928
clear_output_window
void clear_output_window(void)
Definition chatline.c:943
real_output_window_append
void real_output_window_append(const char *astring, const struct text_tag_list *tags, int conn_id)
Definition chatline.c:874
popup_races_dialog
void popup_races_dialog(struct player *pplayer)
Definition dialogs.c:1223
flush_dirty
void flush_dirty(void)
Definition mapview.c:450
meswin_dialog_popdown
void meswin_dialog_popdown(void)
Definition messagewin.c:431
title
const char * title
Definition repodlgs.c:1313
popdown_conn_list_dialog
bool popdown_conn_list_dialog(void)
Definition chatline.c:875
load_dialog
struct advanced_dialog * load_dialog
Definition chatline.c:84
load_selected_game_callback
static int load_selected_game_callback(struct widget *pwidget)
Definition chatline.c:143
popdown_load_game_dialog
void popdown_load_game_dialog(void)
Definition chatline.c:101
popup_conn_list_dialog
static void popup_conn_list_dialog(void)
Definition chatline.c:667
disconnect_conn_callback
static int disconnect_conn_callback(struct widget *pwidget)
Definition chatline.c:430
select_nation_callback
static int select_nation_callback(struct widget *pwidget)
Definition chatline.c:536
start_game_callback
static int start_game_callback(struct widget *pwidget)
Definition chatline.c:524
real_conn_list_dialog_update
void real_conn_list_dialog_update(void *unused)
Definition chatline.c:574
popup_load_game_dialog
static void popup_load_game_dialog(void)
Definition chatline.c:167
conn_dlg_callback
static int conn_dlg_callback(struct widget *pwindow)
Definition chatline.c:422
popup_input_line
void popup_input_line(void)
Definition chatline.c:358
add_to_chat_list
static void add_to_chat_list(char *msg, size_t n_alloc)
Definition chatline.c:444
exit_load_dlg_callback
static int exit_load_dlg_callback(struct widget *pwidget)
Definition chatline.c:127
load_game_callback
static int load_game_callback(struct widget *pwidget)
Definition chatline.c:559
conn_dlg
struct CONNLIST * conn_dlg
input_edit_conn_callback
static int input_edit_conn_callback(struct widget *pwidget)
Definition chatline.c:505
move_load_game_dlg_callback
static int move_load_game_dlg_callback(struct widget *pwindow)
Definition chatline.c:89
inputline_return_callback
static int inputline_return_callback(struct widget *pwidget)
Definition chatline.c:343
get_theme_color
SDL_Color * get_theme_color(enum theme_color themecolor)
Definition colors.c:44
main_window_width
int main_window_width(void)
Definition graphics.c:685
fill_rect_alpha
int fill_rect_alpha(SDL_Surface *surf, SDL_Rect *prect, SDL_Color *pcolor)
Definition graphics.c:865
main_data
struct sdl2_data main_data
Definition graphics.c:57
create_frame
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top, Sint16 width, Sint16 height, SDL_Color *pcolor)
Definition graphics.c:1347
main_window_height
int main_window_height(void)
Definition graphics.c:693
FREESURFACE
#define FREESURFACE(ptr)
Definition graphics.h:322
force_exit_from_event_loop
void force_exit_from_event_loop(void)
Definition gui_main.c:556
adj_size
#define adj_size(size)
Definition gui_main.h:138
PRESSED_EVENT
#define PRESSED_EVENT(event)
Definition gui_main.h:68
chatline.h
colors.h
dialogs.h
graphics.h
gui_main.h
mapview.h
messagewin.h
pages.h
gui_id.h
ID_BUTTON
@ ID_BUTTON
Definition gui_id.h:29
ID_EDIT
@ ID_EDIT
Definition gui_id.h:34
ID_LABEL
@ ID_LABEL
Definition gui_id.h:27
ID_WINDOW
@ ID_WINDOW
Definition gui_id.h:30
conn_list_dialog_update
void conn_list_dialog_update(void)
Definition update_queue.c:650
copy_chars_to_utf8_str
utf8_str * copy_chars_to_utf8_str(utf8_str *pstr, const char *pchars)
Definition gui_string.c:251
create_utf8_str_fonto
utf8_str * create_utf8_str_fonto(char *in_text, size_t n_alloc, enum font_origin origin)
Definition gui_string.c:241
convert_utf8_str_to_const_surface_width
bool convert_utf8_str_to_const_surface_width(utf8_str *pstr, int width)
Definition gui_string.c:449
FREEUTF8STR
#define FREEUTF8STR(pstr)
Definition gui_string.h:92
SF_CENTER
#define SF_CENTER
Definition gui_string.h:40
FONTO_ATTENTION
@ FONTO_ATTENTION
Definition gui_string.h:66
FONTO_ATTENTION_PLUS
@ FONTO_ATTENTION_PLUS
Definition gui_string.h:67
create_utf8_from_char_fonto
#define create_utf8_from_char_fonto(string_in, fonto)
Definition gui_string.h:107
gui_tilespec.h
log.h
fc_assert_ret
#define fc_assert_ret(condition)
Definition log.h:191
max_label_width
static int max_label_width
Definition mapview_common.c:1858
fc_calloc
#define fc_calloc(n, esz)
Definition mem.h:38
FC_FREE
#define FC_FREE(ptr)
Definition mem.h:41
fc_strdup
#define fc_strdup(str)
Definition mem.h:43
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
meswin_add
void meswin_add(const char *message, const struct text_tag_list *tags, struct tile *ptile, enum event_type event, int turn, int phase)
Definition messagewin_common.c:100
packets.h
set_client_page
void set_client_page(enum client_pages page)
Definition update_queue.c:496
get_client_page
enum client_pages get_client_page(void)
Definition update_queue.c:520
get_save_dirs
const struct strvec * get_save_dirs(void)
Definition shared.c:934
fileinfolist_infix
struct fileinfo_list * fileinfolist_infix(const struct strvec *dirs, const char *infix, bool nodups)
Definition shared.c:1204
MAX
#define MAX(x, y)
Definition shared.h:54
fileinfo_list_iterate
#define fileinfo_list_iterate(list, pnode)
Definition shared.h:176
fileinfo_list_iterate_end
#define fileinfo_list_iterate_end
Definition shared.h:178
CONNLIST
Definition chatline.c:62
CONNLIST::users_dlg
struct advanced_dialog * users_dlg
Definition chatline.c:63
CONNLIST::back_button
struct widget * back_button
Definition chatline.c:71
CONNLIST::chat_dlg
struct advanced_dialog * chat_dlg
Definition chatline.c:64
CONNLIST::text_width
int text_width
Definition chatline.c:73
CONNLIST::end_widget_list
struct widget * end_widget_list
Definition chatline.c:66
CONNLIST::configure
struct widget * configure
Definition chatline.c:70
CONNLIST::active
int active
Definition chatline.c:74
CONNLIST::start_button
struct widget * start_button
Definition chatline.c:67
CONNLIST::begin_widget_list
struct widget * begin_widget_list
Definition chatline.c:65
CONNLIST::pedit
struct widget * pedit
Definition chatline.c:72
CONNLIST::select_nation_button
struct widget * select_nation_button
Definition chatline.c:68
CONNLIST::load_game_button
struct widget * load_game_button
Definition chatline.c:69
advanced_dialog
Definition widget.h:180
advanced_dialog::active_widget_list
struct widget * active_widget_list
Definition widget.h:186
advanced_dialog::end_widget_list
struct widget * end_widget_list
Definition widget.h:182
advanced_dialog::begin_widget_list
struct widget * begin_widget_list
Definition widget.h:181
advanced_dialog::begin_active_widget_list
struct widget * begin_active_widget_list
Definition widget.h:184
advanced_dialog::end_active_widget_list
struct widget * end_active_widget_list
Definition widget.h:185
advanced_dialog::scroll
struct scroll_bar * scroll
Definition widget.h:187
astring
Definition astring.h:36
civ_game::est_connections
struct conn_list * est_connections
Definition game.h:97
civ_game::info
struct packet_game_info info
Definition game.h:89
civclient::conn
struct connection conn
Definition client_main.h:96
connection::established
bool established
Definition connection.h:145
connection::playing
struct player * playing
Definition connection.h:156
connection::access_level
enum cmdlevel access_level
Definition connection.h:182
gui_layer::surface
SDL_Surface * surface
Definition graphics.h:229
packet_game_info::turn
int turn
Definition packets_gen.h:241
packet_game_info::phase
int phase
Definition packets_gen.h:206
scroll_bar::pscroll_bar
struct widget * pscroll_bar
Definition widget_scrollbar.h:22
scroll_bar::active
Uint8 active
Definition widget_scrollbar.h:24
scroll_bar::count
Uint16 count
Definition widget_scrollbar.h:27
sdl2_data::gui
struct gui_layer * gui
Definition graphics.h:215
sdl2_data::event
SDL_Event event
Definition graphics.h:217
utf8_str
Definition gui_string.h:52
utf8_str::style
Uint8 style
Definition gui_string.h:53
utf8_str::n_alloc
size_t n_alloc
Definition gui_string.h:56
utf8_str::text
char * text
Definition gui_string.h:60
widget
Definition widget.h:112
widget::ptr
void * ptr
Definition widget.h:133
widget::info_label
utf8_str * info_label
Definition widget.h:122
widget::key
SDL_Keycode key
Definition widget.h:153
widget::data
union widget::@214 data
widget::dst
struct gui_layer * dst
Definition widget.h:116
widget::gfx
SDL_Surface * gfx
Definition widget.h:120
widget::prev
struct widget * prev
Definition widget.h:114
widget::action
int(* action)(struct widget *)
Definition widget.h:157
widget::cont
struct container * cont
Definition widget.h:127
widget::theme
SDL_Surface * theme
Definition widget.h:118
widget::string_utf8
utf8_str * string_utf8
Definition widget.h:121
widget::area
SDL_Rect area
Definition widget.h:149
widget::size
SDL_Rect size
Definition widget.h:145
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
fc_strlcpy
size_t fc_strlcpy(char *dest, const char *src, size_t n)
Definition support.c:787
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
theme_get_background
SDL_Surface * theme_get_background(const struct theme *t, enum theme_background background)
Definition themebackgrounds.c:94
BACKGROUND_LOADGAMEDLG
@ BACKGROUND_LOADGAMEDLG
Definition themebackgrounds.h:38
BACKGROUND_CONNLISTDLG
@ BACKGROUND_CONNLISTDLG
Definition themebackgrounds.h:34
COLOR_THEME_CONNLISTDLG_FRAME
@ COLOR_THEME_CONNLISTDLG_FRAME
Definition themecolors.h:79
active_theme
struct theme * active_theme
Definition themespec.c:154
themespec.h
create_new_line_utf8strs
char ** create_new_line_utf8strs(const char *pstr)
Definition utf8string.c:35
utf8string.h
del_widget_pointer_from_gui_list
void del_widget_pointer_from_gui_list(struct widget *gui)
Definition widget.c:621
add_to_gui_list
void add_to_gui_list(Uint16 id, struct widget *gui)
Definition widget.c:585
draw_frame
void draw_frame(SDL_Surface *pdest, Sint16 start_x, Sint16 start_y, Uint16 w, Uint16 h)
Definition widget.c:1113
redraw_group
Uint16 redraw_group(const struct widget *begin_group_widget_list, const struct widget *end_group_widget_list, int add_to_update)
Definition widget.c:719
popdown_window_group_dialog
void popdown_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:982
move_window_group
void move_window_group(struct widget *begin_widget_list, struct widget *pwindow)
Definition widget.c:1038
widget.h
widget_set_position
static void widget_set_position(struct widget *pwidget, int x, int y)
Definition widget.h:266
FC_WS_DISABLED
@ FC_WS_DISABLED
Definition widget.h:99
FC_WS_NORMAL
@ FC_WS_NORMAL
Definition widget.h:96
FC_WS_PRESSED
@ FC_WS_PRESSED
Definition widget.h:98
clear_wflag
void clear_wflag(struct widget *pwidget, enum widget_flag flag)
Definition widget_core.c:62
add_widget_to_vertical_scroll_widget_list
bool add_widget_to_vertical_scroll_widget_list(struct advanced_dialog *dlg, struct widget *new_widget, struct widget *add_dock, bool dir, Sint16 start_x, Sint16 start_y) fc__attribute((nonnull(2)))
Definition widget_scrollbar.c:1151
widget_mark_dirty
static void widget_mark_dirty(struct widget *pwidget)
Definition widget.h:286
widget_flush
static void widget_flush(struct widget *pwidget)
Definition widget.h:291
FREEWIDGET
#define FREEWIDGET(pwidget)
Definition widget.h:305
set_wstate
void set_wstate(struct widget *pwidget, enum widget_state state)
Definition widget_core.c:36
get_wstate
enum widget_state get_wstate(const struct widget *pwidget)
Definition widget_core.c:70
widget_undraw
static void widget_undraw(struct widget *pwidget)
Definition widget.h:296
WF_EDIT_LOOP
@ WF_EDIT_LOOP
Definition widget.h:91
WF_WIDGET_HAS_INFO_LABEL
@ WF_WIDGET_HAS_INFO_LABEL
Definition widget.h:88
WF_DRAW_FRAME_AROUND_WIDGET
@ WF_DRAW_FRAME_AROUND_WIDGET
Definition widget.h:86
WF_FREE_DATA
@ WF_FREE_DATA
Definition widget.h:78
WF_FREE_STRING
@ WF_FREE_STRING
Definition widget.h:76
WF_SELECT_WITHOUT_BAR
@ WF_SELECT_WITHOUT_BAR
Definition widget.h:89
WF_RESTORE_BACKGROUND
@ WF_RESTORE_BACKGROUND
Definition widget.h:85
WF_DRAW_TEXT_LABEL_WITH_SPACE
@ WF_DRAW_TEXT_LABEL_WITH_SPACE
Definition widget.h:87
widget_redraw
static int widget_redraw(struct widget *pwidget)
Definition widget.h:276
del_group
#define del_group(begin_group_widget_list, end_group_widget_list)
Definition widget.h:389
create_themeicon_button_from_chars_fonto
#define create_themeicon_button_from_chars_fonto(icon_theme, pdest, char_string, fonto, flags)
Definition widget_button.h:36
create_edit_from_chars_fonto
#define create_edit_from_chars_fonto(background, pdest, char_string, fonto, length, flags)
Definition widget_edit.h:29
ED_ESC
@ ED_ESC
Definition widget_edit.h:19
edit
#define edit(pedit)
Definition widget_edit.h:34
create_themeicon
struct widget * create_themeicon(SDL_Surface *icon_theme, struct gui_layer *pdest, Uint32 flags)
Definition widget_icon.c:208
create_themelabel2
struct widget * create_themelabel2(SDL_Surface *icon, struct gui_layer *pdest, utf8_str *pstr, Uint16 w, Uint16 h, Uint32 flags)
Definition widget_label.c:241
create_iconlabel
struct widget * create_iconlabel(SDL_Surface *icon, struct gui_layer *pdest, utf8_str *pstr, Uint32 flags)
Definition widget_label.c:215
setup_vertical_scrollbar_area
void setup_vertical_scrollbar_area(struct scroll_bar *scroll, Sint16 start_x, Sint16 start_y, Uint16 height, bool swap_start_x)
Definition widget_scrollbar.c:572
create_vertical_scrollbar
Uint32 create_vertical_scrollbar(struct advanced_dialog *dlg, Uint8 step, Uint8 active, bool create_scrollbar, bool create_buttons)
Definition widget_scrollbar.c:491
hide_scrollbar
#define hide_scrollbar(scrollbar)
Definition widget_scrollbar.h:36
resize_window
int resize_window(struct widget *pwindow, SDL_Surface *bcgd, SDL_Color *pcolor, Uint16 new_w, Uint16 new_h)
Definition widget_window.c:255
create_window_skeleton
struct widget * create_window_skeleton(struct gui_layer *pdest, utf8_str *title, Uint32 flags)
Definition widget_window.c:180