Freeciv-3.2
Loading...
Searching...
No Matches
gui_main.h
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 gui_main.h - description
16 -------------------
17 begin : Sep 6 2002
18 copyright : (C) 2002 by Rafał Bursig
19 email : Rafał Bursig <bursig@poczta.fm>
20***********************************************************************/
21
22#ifndef FC__GUI_MAIN_H
23#define FC__GUI_MAIN_H
24
25/* SDL2 */
26#ifdef SDL2_PLAIN_INCLUDE
27#include <SDL.h>
28#else /* SDL2_PLAIN_INCLUDE */
29#include <SDL2/SDL.h>
30#endif /* SDL2_PLAIN_INCLUDE */
31
32/* client/include */
33#include "gui_main_g.h"
34
35struct theme;
36
37#define GUI_SDL_OPTION(optname) gui_options.gui_sdl2_##optname
38#define GUI_SDL_OPTION_STR(optname) "gui_sdl2_" #optname
39
40/* Enable this to adjust sizes for 320x240 resolution */
41/* #define SMALL_SCREEN */
42
43/* SDL2 client Flags */
44#define CF_NONE 0
45#define CF_ORDERS_WIDGETS_CREATED (1<<0)
46#define CF_MAP_UNIT_W_CREATED (1<<1)
47#define CF_UNITINFO_SHOWN (1<<2)
48#define CF_OVERVIEW_SHOWN (1<<3)
49#define CF_GAME_JUST_STARTED (1<<6)
50
51#define CF_FOCUS_ANIMATION (1<<9)
52#define CF_CHANGED_PROD (1<<10)
53#define CF_CHANGED_CITY_NAME (1<<11)
54#define CF_CITY_STATUS_SPECIAL (1<<12)
55#define CF_CHANGE_TAXRATE_LUX_BLOCK (1<<13)
56#define CF_CHANGE_TAXRATE_SCI_BLOCK (1<<14)
57#define CF_DRAW_CITY_GRID (1<<17)
58#define CF_DRAW_CITY_WORKER_GRID (1<<18)
59#define CF_DRAW_PLAYERS_WAR_STATUS (1<<19)
60#define CF_DRAW_PLAYERS_CEASEFIRE_STATUS (1<<20)
61#define CF_DRAW_PLAYERS_PEACE_STATUS (1<<21)
62#define CF_DRAW_PLAYERS_ALLIANCE_STATUS (1<<22)
63#define CF_DRAW_PLAYERS_NEUTRAL_STATUS (1<<23)
64#define CF_SWRENDERER (1<<24)
65
66/* Mouse button behavior */
67#define MB_MEDIUM_HOLD_DELAY 500 /* Medium hold: 500ms */
68#define MB_LONG_HOLD_DELAY 2000 /* Long hold: 2000ms */
69
70/* Predicate for detecting basic widget activation events. */
71#define PRESSED_EVENT(event) ( \
72 (event).type == SDL_KEYDOWN \
73 || (event).type == SDL_FINGERDOWN \
74 || ((event).type == SDL_MOUSEBUTTONDOWN \
75 && (event).button.button == SDL_BUTTON_LEFT))
76
82
90
98
99extern struct widget *selected_widget;
101extern bool LSHIFT;
102extern bool RSHIFT;
103extern bool LCTRL;
104extern bool RCTRL;
105extern bool LALT;
106extern int *client_font_sizes[]; /* indexed by enum client_font */
107
109void enable_focus_animation(void);
110void disable_focus_animation(void);
111
112
113#define DEFAULT_MOVE_STEP 5
116
117Uint16 gui_event_loop(void *data, void (*loop_action)(void *data),
120 Uint16 (*textinput_handler)(const char *text, void *data),
124 void *data),
126 void *data),
128 void *data),
130 void *data));
131
132unsigned default_font_size(struct theme *act_theme);
134
135bool flush_event(void);
136
137/* Shrink sizes for 320x240 screen */
138#ifdef SMALL_SCREEN
139 #define adj_size(size) ((size) / 2)
140#else
141 #define adj_size(size) (size)
142#endif
143
144#endif /* FC__GUI_MAIN_H */
char * incite_cost
Definition comments.c:75
enum event_type event
Definition events.c:81
bool LSHIFT
Definition gui_main.c:108
int FilterMouseMotionEvents(void *data, SDL_Event *event)
Definition gui_main.c:581
void enable_focus_animation(void)
Definition gui_main.c:1195
bool flush_event(void)
Definition gui_main.c:1340
mouse_button_hold_state
Definition gui_main.h:77
@ MB_HOLD_LONG
Definition gui_main.h:80
@ MB_HOLD_MEDIUM
Definition gui_main.h:79
@ MB_HOLD_SHORT
Definition gui_main.h:78
Uint16 gui_event_loop(void *data, void(*loop_action)(void *data), Uint16(*key_down_handler)(SDL_Keysym key, void *data), Uint16(*key_up_handler)(SDL_Keysym key, void *data), Uint16(*textinput_handler)(const char *text, void *data), Uint16(*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_motion_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*mouse_button_down_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_button_up_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_motion_handler)(SDL_MouseMotionEvent *motion_event, void *data))
Definition gui_main.c:602
bool RSHIFT
Definition gui_main.c:109
int MOVE_STEP_Y
Definition gui_main.h:114
struct widget * selected_widget
Definition widget.c:48
void update_font_from_theme(int theme_font_size)
Definition gui_main.c:1323
bool LALT
Definition gui_main.c:112
bool LCTRL
Definition gui_main.c:110
unsigned default_font_size(struct theme *act_theme)
Definition gui_main.c:1313
void force_exit_from_event_loop(void)
Definition gui_main.c:565
void disable_focus_animation(void)
Definition gui_main.c:1204
int * client_font_sizes[]
Definition gui_main.c:115
Uint32 sdl2_client_flags
Definition gui_main.c:101
int MOVE_STEP_X
Definition gui_main.c:104
bool RCTRL
Definition gui_main.c:111
mouse_button_hold_state
Definition gui_main.h:72
Uint32 finger_down_ticks
Definition gui_main.h:85
struct tile * ptile
Definition gui_main.h:88
SDL_TouchFingerEvent event
Definition gui_main.h:87
enum mouse_button_hold_state hold_state
Definition gui_main.h:86
enum mouse_button_hold_state hold_state
Definition gui_main.h:94
SDL_MouseButtonEvent * event
Definition gui_main.h:95
struct tile * ptile
Definition gui_main.h:96
Definition tile.h:50
union widget::@194 data
SDL_Keycode key
Definition widget.h:153