OpenTTD Source: src/window_func.h Source File

OpenTTD Source 15.0-RC2

window_func.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef WINDOW_FUNC_H
11#define WINDOW_FUNC_H
12
13#include "window_type.h"
14#include "company_type.h"
15#include "core/geometry_type.hpp"
16
17 Window *FindWindowById(WindowClass cls, WindowNumber number);
18 Window *FindWindowByClass(WindowClass cls);
19 Window *GetMainWindow();
20void ChangeWindowOwner(Owner old_owner, Owner new_owner);
21
22void ResizeWindow(Window *w, int x, int y, bool clamp_to_screen = true, bool schedule_resize = true);
23int PositionMainToolbar(Window *w);
24int PositionStatusbar(Window *w);
25int PositionNewsMessage(Window *w);
26int PositionNetworkChatWindow(Window *w);
27
28int GetMainViewTop();
29int GetMainViewBottom();
30
31void InitWindowSystem();
32void UnInitWindowSystem();
33void ResetWindowSystem();
34void SetupColoursAndInitialWindow();
35void InputLoop();
36
37void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0, bool gui_scope = false);
38void InvalidateWindowData(WindowClass cls, WindowNumber number, ConvertibleThroughBase auto data, bool gui_scope = false) { InvalidateWindowData(cls, number, data.base(), gui_scope); }
39void InvalidateWindowClassesData(WindowClass cls, int data = 0, bool gui_scope = false);
40void InvalidateWindowClassesData(WindowClass cls, ConvertibleThroughBase auto data, bool gui_scope = false) { InvalidateWindowClassesData(cls, data.base(), gui_scope); }
41
42void CloseNonVitalWindows();
43void CloseAllNonVitalWindows();
44void DeleteAllMessages();
45void CloseConstructionWindows();
46void HideVitalWindows();
47void ShowVitalWindows();
48
53void ReInitAllWindows(bool zoom_changed);
54
55void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, WidgetID widget_index);
56void SetWindowDirty(WindowClass cls, WindowNumber number);
57void SetWindowClassesDirty(WindowClass cls);
58
59void CloseWindowById(WindowClass cls, WindowNumber number, bool force = true, int data = 0);
60void CloseWindowByClass(WindowClass cls, int data = 0);
61
62bool EditBoxInGlobalFocus();
63bool FocusedWindowIsConsole();
64 Point GetCaretPosition();
65
66#endif /* WINDOW_FUNC_H */
company_type.h
Types related to companies.
ConvertibleThroughBase
A type is considered 'convertible through base()' when it has a 'base()' function that returns someth...
Definition convertible_through_base.hpp:19
geometry_type.hpp
All geometry types in OpenTTD.
Coord2D< int >
PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >
WindowNumber
Number to differentiate different windows of the same class.
Definition window_type.h:760
Window
Data structure for an opened window.
Definition window_gui.h:274
PositionStatusbar
int PositionStatusbar(Window *w)
(Re)position statusbar window at the screen.
Definition window.cpp:3476
CloseConstructionWindows
void CloseConstructionWindows()
Close all windows that are used for construction of vehicle etc.
Definition window.cpp:3380
ShowVitalWindows
void ShowVitalWindows()
Show the vital in-game windows.
Definition main_gui.cpp:582
GetMainWindow
Window * GetMainWindow()
Get the main window, i.e.
Definition window.cpp:1180
InputLoop
void InputLoop()
Regular call from the global game loop.
Definition window.cpp:3059
PositionMainToolbar
int PositionMainToolbar(Window *w)
(Re)position main toolbar window at the screen.
Definition window.cpp:3465
CloseNonVitalWindows
void CloseNonVitalWindows()
Try to close a non-vital window.
Definition window.cpp:3336
PositionNetworkChatWindow
int PositionNetworkChatWindow(Window *w)
(Re)position network chat window at the screen.
Definition window.cpp:3498
SetupColoursAndInitialWindow
void SetupColoursAndInitialWindow()
Initialise the default colours (remaps and the likes), and load the main windows.
Definition main_gui.cpp:553
FindWindowByClass
Window * FindWindowByClass(WindowClass cls)
Find any window by its class.
Definition window.cpp:1166
InvalidateWindowClassesData
void InvalidateWindowClassesData(WindowClass cls, int data=0, bool gui_scope=false)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Definition window.cpp:3311
DeleteAllMessages
void DeleteAllMessages()
Delete all messages and close their corresponding window (if any).
Definition window.cpp:3368
GetMainViewTop
int GetMainViewTop()
Return the top of the main view available for general use.
Definition window.cpp:2136
ReInitAllWindows
void ReInitAllWindows(bool zoom_changed)
Re-initialize all windows.
Definition window.cpp:3410
PositionNewsMessage
int PositionNewsMessage(Window *w)
(Re)position news message window at the screen.
Definition window.cpp:3487
GetMainViewBottom
int GetMainViewBottom()
Return the bottom of the main view available for general use.
Definition window.cpp:2147
ChangeWindowOwner
void ChangeWindowOwner(Owner old_owner, Owner new_owner)
Change the owner of all the windows one company can take over from another company in the case of a c...
Definition window.cpp:1241
SetWindowClassesDirty
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
Definition window.cpp:3202
FocusedWindowIsConsole
bool FocusedWindowIsConsole()
Check if a console is focused.
Definition window.cpp:461
ResetWindowSystem
void ResetWindowSystem()
Reset the windowing system, by means of shutting it down followed by re-initialization.
Definition window.cpp:1892
EditBoxInGlobalFocus
bool EditBoxInGlobalFocus()
Check if an edit box is in global focus.
Definition window.cpp:447
InvalidateWindowData
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data=0, bool gui_scope=false)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
Definition window.cpp:3294
HideVitalWindows
void HideVitalWindows()
Close all always on-top windows to get an empty screen.
Definition window.cpp:3393
ResizeWindow
void ResizeWindow(Window *w, int x, int y, bool clamp_to_screen=true, bool schedule_resize=true)
Resize the window.
Definition window.cpp:2096
CloseWindowByClass
void CloseWindowByClass(WindowClass cls, int data=0)
Close all windows of a given class.
Definition window.cpp:1205
CloseAllNonVitalWindows
void CloseAllNonVitalWindows()
It is possible that a stickied window gets to a position where the 'close' button is outside the gami...
Definition window.cpp:3355
FindWindowById
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Definition window.cpp:1151
UnInitWindowSystem
void UnInitWindowSystem()
Close down the windowing system.
Definition window.cpp:1878
CloseWindowById
void CloseWindowById(WindowClass cls, WindowNumber number, bool force=true, int data=0)
Close a window by its class and window number (if it is open).
Definition window.cpp:1193
InitWindowSystem
void InitWindowSystem()
(re)initialize the windowing system
Definition window.cpp:1856
SetWindowWidgetDirty
void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, WidgetID widget_index)
Mark a particular widget in a particular window as dirty (in need of repainting)
Definition window.cpp:3189
SetWindowDirty
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
Definition window.cpp:3176
window_type.h
Types related to windows.
WidgetID
int WidgetID
Widget ID.
Definition window_type.h:20
WindowClass
WindowClass
Window classes.
Definition window_type.h:49