Freeciv-3.1
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/* Enable this to adjust sizes for 320x240 resolution */
38/* #define SMALL_SCREEN */
39
40/* SDL2 client Flags */
41#define CF_NONE 0
42#define CF_ORDERS_WIDGETS_CREATED (1<<0)
43#define CF_MAP_UNIT_W_CREATED (1<<1)
44#define CF_UNITINFO_SHOWN (1<<2)
45#define CF_OVERVIEW_SHOWN (1<<3)
46#define CF_GAME_JUST_STARTED (1<<6)
47
48#define CF_FOCUS_ANIMATION (1<<9)
49#define CF_CHANGED_PROD (1<<10)
50#define CF_CHANGED_CITY_NAME (1<<11)
51#define CF_CITY_STATUS_SPECIAL (1<<12)
52#define CF_CHANGE_TAXRATE_LUX_BLOCK (1<<13)
53#define CF_CHANGE_TAXRATE_SCI_BLOCK (1<<14)
54#define CF_DRAW_CITY_GRID (1<<17)
55#define CF_DRAW_CITY_WORKER_GRID (1<<18)
56#define CF_DRAW_PLAYERS_WAR_STATUS (1<<19)
57#define CF_DRAW_PLAYERS_CEASEFIRE_STATUS (1<<20)
58#define CF_DRAW_PLAYERS_PEACE_STATUS (1<<21)
59#define CF_DRAW_PLAYERS_ALLIANCE_STATUS (1<<22)
60#define CF_DRAW_PLAYERS_NEUTRAL_STATUS (1<<23)
61#define CF_SWRENDERER (1<<24)
62
63/* Mouse button behavior */
64#define MB_MEDIUM_HOLD_DELAY 500 /* Medium hold: 500ms */
65#define MB_LONG_HOLD_DELAY 2000 /* Long hold: 2000ms */
66
67/* Predicate for detecting basic widget activation events. */
68#define PRESSED_EVENT(event) ( \
69 (event).type == SDL_KEYDOWN \
70 || (event).type == SDL_FINGERDOWN \
71 || ((event).type == SDL_MOUSEBUTTONDOWN \
72 && (event).button.button == SDL_BUTTON_LEFT))
73
79
84 SDL_TouchFingerEvent event;
85 struct tile *ptile;
86};
87
92 SDL_MouseButtonEvent *event;
93 struct tile *ptile;
94};
95
96extern struct widget *selected_widget;
98extern bool LSHIFT;
99extern bool RSHIFT;
100extern bool LCTRL;
101extern bool RCTRL;
102extern bool LALT;
103extern int *client_font_sizes[]; /* indexed by enum client_font */
104
106void enable_focus_animation(void);
107void disable_focus_animation(void);
108
109
110#define DEFAULT_MOVE_STEP 5
113
114Uint16 gui_event_loop(void *data, void (*loop_action)(void *data),
117 Uint16 (*textinput_handler)(char *text, void *data),
121 void *data),
123 void *data),
125 void *data),
127 void *data));
128
129unsigned default_font_size(struct theme *act_theme);
131
132bool flush_event(void);
133
134/* Shrink sizes for 320x240 screen */
135#ifdef SMALL_SCREEN
136 #define adj_size(size) ((size) / 2)
137#else
138 #define adj_size(size) (size)
139#endif
140
141#endif /* FC__GUI_MAIN_H */
enum event_type event
Definition events.c:81
bool LSHIFT
Definition gui_main.c:104
int FilterMouseMotionEvents(void *data, SDL_Event *event)
Definition gui_main.c:572
void enable_focus_animation(void)
Definition gui_main.c:1177
bool flush_event(void)
Definition gui_main.c:1321
mouse_button_hold_state
Definition gui_main.h:74
@ MB_HOLD_LONG
Definition gui_main.h:77
@ MB_HOLD_MEDIUM
Definition gui_main.h:76
@ MB_HOLD_SHORT
Definition gui_main.h:75
bool RSHIFT
Definition gui_main.c:105
int MOVE_STEP_Y
Definition gui_main.h:111
struct widget * selected_widget
Definition widget.c:48
Uint16 gui_event_loop(void *data, void(*loop_action)(void *data), Uint16(*key_down_handler)(SDL_Keysym key, void *data), Uint16(*key_up_handler)(SDL_Keysym key, void *data), Uint16(*textinput_handler)(char *text, void *data), Uint16(*finger_down_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_up_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*finger_motion_handler)(SDL_TouchFingerEvent *touch_event, void *data), Uint16(*mouse_button_down_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_button_up_handler)(SDL_MouseButtonEvent *button_event, void *data), Uint16(*mouse_motion_handler)(SDL_MouseMotionEvent *motion_event, void *data))
Definition gui_main.c:593
void update_font_from_theme(int theme_font_size)
Definition gui_main.c:1304
bool LALT
Definition gui_main.c:108
bool LCTRL
Definition gui_main.c:106
unsigned default_font_size(struct theme *act_theme)
Definition gui_main.c:1295
void force_exit_from_event_loop(void)
Definition gui_main.c:556
void disable_focus_animation(void)
Definition gui_main.c:1186
int * client_font_sizes[]
Definition gui_main.c:111
Uint32 sdl2_client_flags
Definition gui_main.c:97
int MOVE_STEP_X
Definition gui_main.c:100
bool RCTRL
Definition gui_main.c:107
Uint32 finger_down_ticks
Definition gui_main.h:82
struct tile * ptile
Definition gui_main.h:85
SDL_TouchFingerEvent event
Definition gui_main.h:84
enum mouse_button_hold_state hold_state
Definition gui_main.h:83
enum mouse_button_hold_state hold_state
Definition gui_main.h:91
SDL_MouseButtonEvent * event
Definition gui_main.h:92
struct tile * ptile
Definition gui_main.h:93
Definition tile.h:49
SDL_Keycode key
Definition widget.h:153
union widget::@214 data
struct container * cont
Definition widget.h:127