OpenTTD Source 20241224-master-gf74b0cf984
|
High level window description. More...
#include <window_gui.h>
Public Member Functions | |
WindowDesc (WindowPosition default_pos, const char *ini_key, int16_t def_width_trad, int16_t def_height_trad, WindowClass window_class, WindowClass parent_class, uint32_t flags, const std::span< const NWidgetPart > nwid_parts, HotkeyList *hotkeys=nullptr, const std::source_location location=std::source_location::current()) | |
Window description constructor. | |
int16_t | GetDefaultWidth () const |
Determine default width of window. | |
int16_t | GetDefaultHeight () const |
Determine default height of window. | |
Public Member Functions inherited from ZeroedMemoryAllocator | |
void * | operator new (size_t size) |
Memory allocator for a single class instance. | |
void * | operator new[] (size_t size) |
Memory allocator for an array of class instances. | |
void | operator delete (void *ptr) |
Memory release for a single class instance. | |
void | operator delete[] (void *ptr) |
Memory release for an array of class instances. | |
Static Public Member Functions | |
static void | LoadFromConfig () |
Load all WindowDesc settings from _windows_file. | |
static void | SaveToConfig () |
Save all WindowDesc settings to _windows_file. | |
Data Fields | |
const std::source_location | source_location |
Source location of this definition. | |
WindowPosition | default_pos |
Preferred position of the window. | |
WindowClass | cls |
Class of the window,. | |
WindowClass | parent_cls |
Class of the parent window. | |
const char * | ini_key |
Key to store window defaults in openttd.cfg. nullptr if nothing shall be stored. | |
uint32_t | flags |
Flags. | |
const std::span< const NWidgetPart > | nwid_parts |
Span of nested widget parts describing the window. | |
HotkeyList * | hotkeys |
Hotkeys for the window. | |
bool | pref_sticky |
Preferred stickyness. | |
int16_t | pref_width |
User-preferred width of the window. Zero if unset. | |
int16_t | pref_height |
User-preferred height of the window. Zero if unset. | |
Private Member Functions | |
WindowDesc (const WindowDesc &)=delete | |
Delete copy constructor to prevent compilers from copying the structure, which fails due to _window_descs. | |
WindowDesc & | operator= (const WindowDesc &)=delete |
Private Attributes | |
int16_t | default_width_trad |
Preferred initial width of the window (pixels at 1x zoom). | |
int16_t | default_height_trad |
Preferred initial height of the window (pixels at 1x zoom). | |
High level window description.
Definition at line 159 of file window_gui.h.
WindowDesc::WindowDesc | ( | WindowPosition | default_pos, |
const char * | ini_key, | ||
int16_t | def_width_trad, | ||
int16_t | def_height_trad, | ||
WindowClass | window_class, | ||
WindowClass | parent_class, | ||
uint32_t | flags, | ||
const std::span< const NWidgetPart > | nwid_parts, | ||
HotkeyList * | hotkeys = nullptr , |
||
const std::source_location | location = std::source_location::current() |
||
) |
Window description constructor.
Definition at line 105 of file window.cpp.
References _window_descs.
WindowDesc::~WindowDesc | ( | ) |
Definition at line 127 of file window.cpp.
int16_t WindowDesc::GetDefaultHeight | ( | ) | const |
Determine default height of window.
This is either a stored user preferred size, or the built-in default.
Definition at line 147 of file window.cpp.
References default_height_trad, pref_height, and ScaleGUITrad().
Referenced by DispatchLeftClickEvent(), and LocalGetWindowPlacement().
int16_t WindowDesc::GetDefaultWidth | ( | ) | const |
Determine default width of window.
This is either a stored user preferred size, or the built-in default.
Definition at line 137 of file window.cpp.
References default_width_trad, pref_width, and ScaleGUITrad().
Referenced by DispatchLeftClickEvent(), Window::FinishInitNested(), LocalGetWindowPlacement(), and Window::ReInit().
|
static |
Load all WindowDesc settings from _windows_file.
Definition at line 155 of file window.cpp.
References _window_descs, _windows_file, IniLoadWindowSettings(), IniLoadFile::LoadFromDisk(), and NO_DIRECTORY.
Referenced by AfterNewGRFScan::OnNewGRFsScanned().
|
static |
Save all WindowDesc settings to _windows_file.
Definition at line 177 of file window.cpp.
References _window_descs, _windows_file, DescSorter(), IniSaveWindowSettings(), IniLoadFile::LoadFromDisk(), NO_DIRECTORY, and IniFile::SaveToDisk().
WindowClass WindowDesc::cls |
Class of the window,.
Definition at line 170 of file window_gui.h.
Referenced by AllocateWindowDescFront(), Window::InitializeData(), and ShowCompanyGroup().
|
private |
Preferred initial height of the window (pixels at 1x zoom).
Definition at line 189 of file window_gui.h.
Referenced by GetDefaultHeight().
WindowPosition WindowDesc::default_pos |
Preferred position of the window.
Definition at line 169 of file window_gui.h.
Referenced by Window::InitializeData(), and LocalGetWindowPlacement().
|
private |
Preferred initial width of the window (pixels at 1x zoom).
Definition at line 188 of file window_gui.h.
Referenced by GetDefaultWidth().
uint32_t WindowDesc::flags |
Flags.
Definition at line 173 of file window_gui.h.
Referenced by CloseAllNonVitalWindows(), CloseConstructionWindows(), CloseNonVitalWindows(), DispatchLeftClickEvent(), DispatchRightClickEvent(), and MaybeBringWindowToFront().
HotkeyList* WindowDesc::hotkeys |
Hotkeys for the window.
Definition at line 175 of file window_gui.h.
Referenced by HandleKeypress(), and HandleToolbarHotkey().
const char* WindowDesc::ini_key |
Key to store window defaults in openttd.cfg. nullptr
if nothing shall be stored.
Definition at line 172 of file window_gui.h.
Referenced by DescSorter().
const std::span<const NWidgetPart> WindowDesc::nwid_parts |
Span of nested widget parts describing the window.
Definition at line 174 of file window_gui.h.
Referenced by Window::CreateNestedTree().
WindowClass WindowDesc::parent_cls |
Class of the parent window.
Definition at line 171 of file window_gui.h.
Referenced by LocalGetWindowPlacement().
int16_t WindowDesc::pref_height |
User-preferred height of the window. Zero if unset.
Definition at line 179 of file window_gui.h.
Referenced by DispatchLeftClickEvent(), and GetDefaultHeight().
bool WindowDesc::pref_sticky |
Preferred stickyness.
Definition at line 177 of file window_gui.h.
Referenced by Window::ApplyDefaults(), and DispatchLeftClickEvent().
int16_t WindowDesc::pref_width |
User-preferred width of the window. Zero if unset.
Definition at line 178 of file window_gui.h.
Referenced by DispatchLeftClickEvent(), and GetDefaultWidth().
const std::source_location WindowDesc::source_location |
Source location of this definition.
Definition at line 168 of file window_gui.h.