OpenTTD Source: WindowDesc Struct Reference

OpenTTD Source 12.0-beta1

Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions | Private Attributes
WindowDesc Struct Reference

High level window description. More...

`#include <window_gui.h>`

Inheritance diagram for WindowDesc:

## Public Member Functions
| WindowDesc (WindowPosition default_pos, const char *ini_key, int16 def_width_trad, int16 def_height_trad, WindowClass window_class, WindowClass parent_class, uint32 flags, const NWidgetPart *nwid_parts, int16 nwid_length, HotkeyList *hotkeys=nullptr)
| Window description constructor.
int16 | GetDefaultWidth () const
| Determine default width of window. More...
int16 | GetDefaultHeight () const
| Determine default height of window. More...
Public Member Functions inherited from ZeroedMemoryAllocator
void * | operator new (size_t size)
| Memory allocator for a single class instance. More...
void * | operator new[] (size_t size)
| Memory allocator for an array of class instances. More...
void | operator delete (void *ptr)
| Memory release for a single class instance. More...
void | operator delete[] (void *ptr)
| Memory release for an array of class instances. More...

## 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
WindowPosition | default_pos
| Preferred position of the window. More...
WindowClass | cls
| Class of the window,. More...
WindowClass | parent_cls
| Class of the parent window. More...
const char * | ini_key
| Key to store window defaults in openttd.cfg. `nullptr` if nothing shall be stored.
uint32 | flags
| Flags. More...
const NWidgetPart * | nwid_parts
| Nested widget parts describing the window.
int16 | nwid_length
| Length of the nwid_parts array.
HotkeyList * | hotkeys
| Hotkeys for the window.
bool | pref_sticky
| Preferred stickyness.
int16 | pref_width
| User-preferred width of the window. Zero if unset.
int16 | pref_height
| User-preferred height of the window. Zero if unset.

## Private Member Functions
| WindowDesc (const WindowDesc &other)
| Dummy private copy constructor to prevent compilers from copying the structure, which fails due to _window_descs.

## Private Attributes
int16 | default_width_trad
| Preferred initial width of the window (pixels at 1x zoom).
int16 | default_height_trad
| Preferred initial height of the window (pixels at 1x zoom).

## Detailed Description

High level window description.

Definition at line 168 of file window_gui.h.

## Member Function Documentation

## ◆ GetDefaultHeight()

int16 WindowDesc::GetDefaultHeight | ( |  | ) | const

Determine default height of window.

This is either a stored user preferred size, or the built-in default.

Returns
  Height in pixels.

Definition at line 146 of file window.cpp.

References default_height_trad, pref_height, and ScaleGUITrad().

Referenced by LocalGetWindowPlacement().

## ◆ GetDefaultWidth()

int16 WindowDesc::GetDefaultWidth | ( |  | ) | const

Determine default width of window.

This is either a stored user preferred size, or the built-in default.

Returns
  Width in pixels.

Definition at line 136 of file window.cpp.

References default_width_trad, pref_width, and ScaleGUITrad().

Referenced by Window::FinishInitNested(), and LocalGetWindowPlacement().

## Field Documentation

## ◆ cls

WindowClass WindowDesc::cls

Class of the window,.

See also
  WindowClass.

Definition at line 177 of file window_gui.h.

Referenced by AllocateWindowDescFront(), and Window::InitializeData().

## ◆ default_pos

WindowPosition WindowDesc::default_pos

Preferred position of the window.

See also
  WindowPosition()

Definition at line 176 of file window_gui.h.

Referenced by Window::InitializeData().

## ◆ flags

uint32 WindowDesc::flags

Flags.

See also
  WindowDefaultFlag

Definition at line 180 of file window_gui.h.

Referenced by CloseConstructionWindows().

## ◆ parent_cls

WindowClass WindowDesc::parent_cls

Class of the parent window.

See also
  WindowClass

Definition at line 178 of file window_gui.h.

Referenced by LocalGetWindowPlacement().

The documentation for this struct was generated from the following files:

- src/window_gui.h
- src/window.cpp