OpenTTD Source
20240915-master-g3784a3d3d6
|
Go to the documentation of this file.
70 static constexpr
float ASPECT_LOCATION = 12.f / 14.f;
71 static constexpr
float ASPECT_RENAME = 12.f / 14.f;
72 static constexpr
float ASPECT_SETTINGS_BUTTON = 21.f / 12.f;
73 static constexpr
float ASPECT_TOGGLE_SIZE = 12.f / 14.f;
74 static constexpr
float ASPECT_LEFT_RIGHT_BUTTON = 8.f / 12.f;
75 static constexpr
float ASPECT_UP_DOWN_BUTTON = 11.f / 12.f;
76 static constexpr
float ASPECT_VEHICLE_ICON = 15.f / 12.f;
77 static constexpr
float ASPECT_VEHICLE_FLAG = 11.f / 12.f;
85 WD_SHADEBOX_WIDTH = 12,
86 WD_STICKYBOX_WIDTH = 12,
87 WD_DEBUGBOX_WIDTH = 12,
88 WD_DEFSIZEBOX_WIDTH = 12,
89 WD_RESIZEBOX_WIDTH = 12,
90 WD_CLOSEBOX_WIDTH = 11,
92 WD_CAPTION_HEIGHT = 14,
93 WD_DROPDOWN_HEIGHT = 12,
100 .
imgbtn = { .left = 1, .top = 1, .right = 1, .bottom = 1},
101 .inset = { .left = 2, .top = 1, .right = 2, .bottom = 1},
102 .vscrollbar = { .left = 2, .top = 3, .right = 2, .bottom = 3},
103 .hscrollbar = { .left = 3, .top = 2, .right = 3, .bottom = 2},
104 .bevel = { .left = 1, .top = 1, .right = 1, .bottom = 1},
105 .fullbevel = { .left = 1, .top = 1, .right = 1, .bottom = 1},
106 .framerect = { .left = 2, .top = 1, .right = 2, .bottom = 1},
107 .frametext = { .left = 6, .top = 6, .right = 6, .bottom = 6},
108 .matrix = { .left = 2, .top = 3, .right = 2, .bottom = 1},
109 .shadebox = { .left = 2, .top = 3, .right = 2, .bottom = 3},
110 .stickybox = { .left = 2, .top = 3, .right = 2, .bottom = 3},
111 .debugbox = { .left = 2, .top = 3, .right = 2, .bottom = 3},
112 .defsizebox = { .left = 2, .top = 3, .right = 2, .bottom = 3},
113 .resizebox = { .left = 2, .top = 2, .right = 2, .bottom = 2},
114 .closebox = { .left = 2, .top = 2, .right = 1, .bottom = 2},
115 .captiontext = { .left = 2, .top = 2, .right = 2, .bottom = 2},
116 .dropdowntext = { .left = 2, .top = 1, .right = 2, .bottom = 1},
117 .dropdownlist = { .left = 1, .top = 2, .right = 1, .bottom = 2},
118 .modalpopup = { .left = 20, .top = 10, .right = 20, .bottom = 10},
119 .picker = { .left = 3, .top = 3, .right = 3, .bottom = 3},
120 .sparse = { .left = 10, .top = 8, .right = 10, .bottom = 8},
121 .sparse_resize = { .left = 10, .top = 8, .right = 10, .bottom = 0},
136 DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, flags);
142 using WindowList = std::list<Window *>;
144 extern Window *_focused_window;
167 const std::source_location location = std::source_location::current());
266 enum TooltipCloseCondition {
300 inline void *
operator new[](
size_t size) =
delete;
332 WindowList::iterator z_position;
334 template <
class NWID>
336 template <
class NWID>
355 template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value,
int> = 0>
392 NWidgetCore *nwid = this->GetWidget<NWidgetCore>(widget_index);
393 if (nwid !=
nullptr) nwid->
SetDisabled(disab_stat);
421 return this->GetWidget<NWidgetCore>(widget_index)->IsDisabled();
431 return this->nested_focus !=
nullptr && this->nested_focus->
index == widget_index;
452 this->GetWidget<NWidgetCore>(widget_index)->SetLowered(lowered_stat);
461 bool lowered_state = this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
462 this->GetWidget<NWidgetCore>(widget_index)->SetLowered(!lowered_state);
502 return this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
509 virtual void InsertTextString(
WidgetID wid,
const char *str,
bool marked,
const char *
caret,
const char *insert_location,
const char *replacement_end);
523 template<
typename... Args>
534 template<
typename... Args>
544 template<
typename... Args>
559 virtual void Close(
int data = 0);
563 void ReInit(
int rx = 0,
int ry = 0,
bool reposition =
false);
673 virtual void OnClick([[maybe_unused]]
Point pt, [[maybe_unused]]
WidgetID widget, [[maybe_unused]]
int click_count) {}
697 virtual bool OnTooltip([[maybe_unused]]
Point pt, [[maybe_unused]]
WidgetID widget, [[maybe_unused]] TooltipCloseCondition close_cond) {
return false; }
789 virtual void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true) {}
813 virtual bool OnVehicleSelect([[maybe_unused]] VehicleList::const_iterator begin, [[maybe_unused]] VehicleList::const_iterator end) {
return false; }
870 template <
bool TtoBack>
875 typedef size_t difference_type;
876 typedef std::forward_iterator_tag iterator_category;
884 bool operator==(
const WindowIterator &other)
const {
return this->it == other.it; }
885 bool operator!=(
const WindowIterator &other)
const {
return !(*
this == other); }
886 Window * operator*()
const {
return *this->it; }
887 WindowIterator & operator++() { this->Next(); this->Validate();
return *
this; }
889 bool IsEnd()
const {
return this->it ==
_z_windows.end(); }
892 WindowList::iterator it;
895 while (!this->IsEnd() && *this->it ==
nullptr) this->Next();
899 if constexpr (!TtoBack) {
915 template <
bool Tfront>
920 if constexpr (Tfront) {
942 template <
class It,
class Pred>
945 return std::adjacent_find(begin, end, std::not_fn(pred)) == end;
954 template <
class NWID>
959 NWID *nwid =
dynamic_cast<NWID *
>(it->second);
960 assert(nwid !=
nullptr);
979 template <
class NWID>
982 return const_cast<Window *
>(
this)->GetWidget<NWID>(widnum);
997 void Close([[maybe_unused]]
int data = 0)
override;
1003 template<typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value,
int> = 0>
1017 template <
typename Wcls>
1021 if (w !=
nullptr)
return return_existing ? w :
nullptr;
1022 return new Wcls(desc, window_number);
1032 extern Point _cursorpos_drag_start;
1034 extern int _scrollbar_start_pos;
1035 extern int _scrollbar_size;
1036 extern uint8_t _scroller_click_timeout;
uint8_t timeout_timer
Timer value of the WF_TIMEOUT for flags.
Iterator to iterate all valid Windows.
Data structure for a window viewport.
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
virtual void OnPlaceObject([[maybe_unused]] Point pt, [[maybe_unused]] TileIndex tile)
The user clicked some place on the map when a tile highlight mode has been set.
int16_t pref_width
User-preferred width of the window. Zero if unset.
virtual bool OnVehicleSelect([[maybe_unused]] const struct Vehicle *v)
The user clicked on a vehicle while HT_VEHICLE has been set.
virtual void OnScroll([[maybe_unused]] Point delta)
Handle the request for (viewport) scrolling.
@ WC_INVALID
Invalid window.
int16_t default_height_trad
Preferred initial height of the window (pixels at 1x zoom).
@ WF_SIZING
Window is being resized.
virtual Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number)
Compute the initial position of the window.
void SetWhiteBorder()
Set the timeout flag of the window and initiate the timer.
SortButtonState
State of a sort direction button.
List of hotkeys for a window.
Dimensions (a width and height) of a rectangle in 2D.
virtual ~Window()
Remove window and all its child windows from the window stack.
virtual const struct Textbuf * GetFocusedTextbuf() const
Get the current input text buffer.
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
bool _scrolling_viewport
A viewport is being scrolled with the mouse.
NWidgetStacked * shade_select
Selection widget (NWID_SELECTION) to use for shading the window. If nullptr, window cannot shade.
@ WF_SIZING_RIGHT
Window is being resized towards the right.
virtual void ApplyDefaults()
Read default values from WindowDesc configuration an apply them to the window.
virtual void OnDropdownClose(Point pt, WidgetID widget, int index, bool instant_close)
A dropdown window associated to this window has been closed.
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it.
void ScrollbarClickHandler(Window *w, NWidgetCore *nw, int x, int y)
Special handling for the scrollbar widget type.
void InitializePositionSize(int x, int y, int min_width, int min_height)
Set the position and smallest size of the window.
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
virtual ptrdiff_t GetTextCharacterAtPosition(const Point &pt) const
Get the character that is rendered at a position by the focused edit box.
WindowList _z_windows
List of windows opened at the screen sorted from the front to back.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
@ WF_DISABLE_VP_SCROLL
Window does not do autoscroll,.
ViewportData * viewport
Pointer to viewport data, if present.
FrameFlags
Flags to describe the look of the frame.
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Owner
Enum for all companies/owners.
virtual void OnGameTick()
Called once per (game) tick.
virtual bool IsNewGRFInspectable() const
Is the data related to this window NewGRF inspectable?
@ WF_STICKY
Window is made sticky by user.
virtual void OnFocusLost(bool closing)
The window has lost focus.
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
void EnableWidget(WidgetID widget_index)
Sets a widget to Enabled.
@ WDF_NO_FOCUS
This window won't get focus/make any other window lose focus when click.
bool IsWidgetFocused(WidgetID widget_index) const
Check if given widget is focused within this window.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
bool IsWidgetHighlighted(WidgetID widget_index) const
Gets the highlighted status of a widget.
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
StringAlignment
How to align the to-be drawn text.
WindowClass cls
Class of the window,.
int32_t dest_scrollpos_y
Current destination y coordinate to display (virtual screen coordinate of topleft corner of the viewp...
virtual void OnTimeout()
Called when this window's timeout has been reached.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
@ FR_LOWERED
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
virtual void OnPlacePresize([[maybe_unused]] Point pt, [[maybe_unused]] TileIndex tile)
The user moves over the map when a tile highlight mode has been set when the special mouse mode has b...
virtual Point GetCaretPosition() const
Get the current caret position if an edit box has the focus.
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
@ FR_TRANSPARENT
Makes the background transparent if set.
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
const NWidgetCore * nested_focus
Currently focused nested widget, or nullptr if no nested widget has focus.
Data stored about a string that can be modified in the GUI.
std::vector< int > scheduled_invalidation_data
Data of scheduled OnInvalidateData() calls.
virtual void OnEditboxChanged([[maybe_unused]] WidgetID widget)
The text in an editbox has been edited.
virtual EventState OnCTRLStateChange()
The state of the control key has changed.
void ProcessScheduledInvalidations()
Process all scheduled invalidations.
virtual void OnMouseDrag([[maybe_unused]] Point pt, [[maybe_unused]] WidgetID widget)
An 'object' is being dragged at the provided position, highlight the target if possible.
WindowPosition default_pos
Preferred position of the window.
High level window description.
virtual void OnQueryTextFinished([[maybe_unused]] std::optional< std::string > str)
The query window opened from this window has closed.
void SetFocusedWindow(Window *w)
Set the window that has the focus.
@ WF_SIZING_LEFT
Window is being resized towards the left.
void SetShaded(bool make_shaded)
Set the shaded state of the window to make_shaded.
Padding dimensions to apply to each side of a Rect.
Data structure for viewport, display of a part of the world.
bool _mouse_hovering
The mouse is hovering over the same point.
void UnfocusFocusedWidget()
Makes no widget on this window have focus.
@ WDP_AUTO
Find a place automatically.
bool IsWidgetGloballyFocused(WidgetID widget_index) const
Check if given widget has user input focus.
const char * ini_key
Key to store window defaults in openttd.cfg. nullptr if nothing shall be stored.
ResizeInfo resize
Resize information.
@ WSM_PRESIZE
Presizing mode (docks, tunnels).
int32_t WindowNumber
Number to differentiate different windows of the same class.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
void ProcessHighlightedInvalidations()
Process all invalidation of highlighted widgets.
virtual void OnMouseWheel([[maybe_unused]] int wheel)
The mouse wheel has been turned.
std::unique_ptr< NWidgetBase > nested_root
Root of the nested tree.
void ScheduleResize()
Mark this window as resized and in need of OnResize() event.
void HandleButtonClick(WidgetID widget)
Do all things to make a button look clicked and mark it to be unclicked in a few ticks.
int height
Height of the window (number of pixels down in y direction)
const std::source_location source_location
Source location of this definition.
@ WF_CENTERED
Window is centered and shall stay centered after ReInit.
@ WF_WHITE_BORDER
Window white border counter bit mask.
Wcls * AllocateWindowDescFront(WindowDesc &desc, int window_number, bool return_existing=false)
Open a new window.
int32_t dest_scrollpos_x
Current destination x coordinate to display (virtual screen coordinate of topleft corner of the viewp...
int16_t pref_height
User-preferred height of the window. Zero if unset.
SpecialMouseMode
Mouse modes.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Point GetToolbarAlignedWindowPosition(int window_width)
Computer the position of the top-left corner of a window to be opened right under the toolbar.
virtual void OnDragDrop([[maybe_unused]] Point pt, [[maybe_unused]] WidgetID widget)
A dragged 'object' has been released.
virtual void OnFocus()
The window has gained focus.
virtual void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, [[maybe_unused]] TileIndex start_tile, [[maybe_unused]] TileIndex end_tile)
The user has dragged over the map when the tile highlight mode has been set.
Base class that provides memory initialization on dynamically created objects.
@ ES_NOT_HANDLED
The passed event is not handled.
void Close([[maybe_unused]] int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
void DisableAllWidgetHighlight()
Disable the highlighted status of all widgets.
int32_t scrollpos_y
Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
int16_t GetDefaultHeight() const
Determine default height of window.
virtual void OnPlaceDrag([[maybe_unused]] ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt)
The user is dragging over the map when the tile highlight mode has been set.
virtual bool OnTooltip([[maybe_unused]] Point pt, [[maybe_unused]] WidgetID widget, [[maybe_unused]] TooltipCloseCondition close_cond)
Event to display a custom tooltip.
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.
void ReInit(int rx=0, int ry=0, bool reposition=false)
Re-initialize a window, and optionally change its size.
static void DeleteClosedWindows()
Delete all closed windows.
Window * parent
Parent window.
void LowerWidget(WidgetID widget_index)
Marks a widget as lowered.
int left
x position of left edge of the window
WindowFlags flags
Window flags.
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
Draw frame rectangle.
WindowDesc & window_desc
Window description.
@ WF_TIMEOUT
Window timeout counter.
bool caret
is the caret ("_") visible or not
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
void GuiShowTooltips(Window *parent, StringID str, TooltipCloseCondition close_tooltip, uint paramcount=0)
Shows a tooltip.
WindowClass
Window classes.
virtual void ShowNewGRFInspectWindow() const
Show the NewGRF inspection window.
const QueryString * GetQueryString(WidgetID widnum) const
Return the querystring associated to a editbox.
uint32_t VehicleID
The type all our vehicle IDs have.
@ WDF_MODAL
The window is a modal child of some other window, meaning the parent is 'inactive'.
static const int TIMEOUT_DURATION
The initial timeout value for WF_TIMEOUT.
Coordinates of a point in 2D.
@ WF_HIGHLIGHTED
Window has a widget that has a highlight.
WindowDefaultFlag
Window default widget/window handling flags.
bool IsWidgetDisabled(WidgetID widget_index) const
Gets the enabled/disabled status of a widget.
@ WDF_NO_CLOSE
This window can't be interactively closed.
@ WSM_DRAGDROP
Drag&drop an object.
virtual void OnInit()
Notification that the nested widget tree gets initialized.
Dimension unshaded_size
Last known unshaded size (only valid while shaded).
static void SaveToConfig()
Save all WindowDesc settings to _windows_file.
WindowNumber window_number
Window number within the window class.
bool SetFocusedWidget(WidgetID widget_index)
Set focus within this window to the given widget.
uint step_height
Step-size of height resize changes.
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
virtual void InsertTextString(WidgetID wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end)
Insert a text string at the cursor position into the edit box widget.
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Iterable ensemble of all valid Windows.
bool scheduled_resize
Set if window has been resized.
void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
virtual void DrawWidget([[maybe_unused]] const Rect &r, [[maybe_unused]] WidgetID widget) const
Draw the contents of a nested widget.
bool IsWidgetLowered(WidgetID widget_index) const
Gets the lowered state of a widget.
std::map< WidgetID, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
@ SBS_DOWN
Sort ascending.
void DrawSortButtonState(WidgetID widget, SortButtonState state) const
Draw a sort button's up or down arrow symbol.
virtual void SetStringParameters([[maybe_unused]] WidgetID widget) const
Initialize string parameters for a widget.
virtual void OnMouseLoop()
Called for every mouse loop run, which is at least once per (game) tick.
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
uint step_width
Step-size of width resize changes.
bool IsShaded() const
Is window shaded currently?
virtual void OnRealtimeTick([[maybe_unused]] uint delta_ms)
Called periodically.
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
int16_t default_width_trad
Preferred initial width of the window (pixels at 1x zoom).
Data structure for resizing a window.
void DisableWidget(WidgetID widget_index)
Sets a widget to disabled.
static std::vector< Window * > closed_windows
List of closed windows to delete.
void CloseChildWindows(WindowClass wc=WC_INVALID) const
Close all children a window might have in a head-recursive manner.
virtual void UpdateWidgetSize([[maybe_unused]] WidgetID widget, [[maybe_unused]] Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize)
Update size and resize step of a widget in the window.
virtual Rect GetTextBoundingRect(const char *from, const char *to) const
Get the bounding rectangle for a text range if an edit box has the focus.
virtual void OnInvalidateData([[maybe_unused]] int data=0, [[maybe_unused]] bool gui_scope=true)
Some data on this window has become invalid.
virtual void OnPaint()
The window must be repainted.
int32_t scrollpos_x
Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
EventState
State of handling an event.
bool pref_sticky
Preferred stickyness.
WidgetID mouse_capture_widget
ID of current mouse capture widget (e.g. dragged scrollbar). -1 if no widget has mouse capture.
@ WF_DRAGGING
Window is being dragged.
@ WSM_DRAGGING
Dragging mode (trees).
WindowClass window_class
Window class.
virtual bool OnRightClick([[maybe_unused]] Point pt, [[maybe_unused]] WidgetID widget)
A click with the right mouse button has been made on the window.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
WidgetLookup widget_lookup
Indexed access to the nested widget tree. Do not access directly, use Window::GetWidget() instead.
virtual void OnDropdownSelect([[maybe_unused]] WidgetID widget, [[maybe_unused]] int index)
A dropdown option associated to this window has been selected.
Base class for windows opened from a toolbar.
SpecialMouseMode _special_mouse_mode
Mode of the mouse.
void UpdateQueryStringSize()
Update size of all QueryStrings of this window.
int top
y position of top edge of the window
void DrawViewport() const
Draw the viewport of this window.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
void SetWidgetsLoweredState(bool lowered_stat, Args... widgets)
Sets the lowered/raised status of a list of widgets.
void RaiseWidget(WidgetID widget_index)
Marks a widget as raised.
static const int WHITE_BORDER_DURATION
The initial timeout value for WF_WHITE_BORDER.
void RaiseWidgetWhenLowered(WidgetID widget_index)
Marks a widget as raised and dirty (redraw), when it is marked as lowered.
virtual void OnHover([[maybe_unused]] Point pt, [[maybe_unused]] WidgetID widget)
The mouse is hovering over a widget in the window, perform an action for it.
VehicleID follow_vehicle
VehicleID to follow if following a vehicle, INVALID_VEHICLE otherwise.
int width
width of the window (number of pixels to the right in x direction)
static void LoadFromConfig()
Load all WindowDesc settings from _windows_file.
void RelocateAllWindows(int neww, int newh)
Relocate all windows to fit the new size of the game application screen.
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
@ FR_DARKENED
If set the background is darker, allows for lowered frames with normal background colour when used wi...
int GetRowFromWidget(int clickpos, WidgetID widget, int padding, int line_height=-1) const
Compute the row of a widget that a user clicked in.
int scale
Scale of this window – used to determine how to resize.
void RaiseWidgetsWhenLowered(Args... widgets)
Raises the widgets and sets widgets dirty that are lowered.
FontSize
Available font sizes.
WindowClass parent_cls
Class of the parent window.
const std::span< const NWidgetPart > nwid_parts
Span of nested widget parts describing the window.
Data structure for an opened window.
void DrawWidgets() const
Paint all widgets of a window.
Window * FindWindowFromPt(int x, int y)
Do a search for a window at specific coordinates.
bool AllEqual(It begin, It end, Pred pred)
Generic helper function that checks if all elements of the range are equal with respect to the given ...
virtual void OnMouseOver([[maybe_unused]] Point pt, [[maybe_unused]] WidgetID widget)
The mouse is currently moving over the window or has just moved outside of the window.
@ SBS_OFF
Do not sort (with this button).
void SetWidgetHighlight(WidgetID widget_index, TextColour highlighted_colour)
Sets the highlighted status of a widget.
int16_t GetDefaultWidth() const
Determine default width of window.
Specification of a rectangle with absolute coordinates of all edges.
void ToggleWidgetLoweredState(WidgetID widget_index)
Invert the lowered/raised status of a widget.
EventState HandleEditBoxKey(WidgetID wid, char32_t key, uint16_t keycode)
Process keypress for editbox widget.
void SetWidgetsDisabledState(bool disab_stat, Args... widgets)
Sets the enabled/disabled status of a list of widgets.
virtual void OnResize()
Called after the window got resized.
virtual bool OnVehicleSelect([[maybe_unused]] VehicleList::const_iterator begin, [[maybe_unused]] VehicleList::const_iterator end)
The user clicked on a vehicle while HT_VEHICLE has been set.
HotkeyList * hotkeys
Hotkeys for the window.
WidgetID GetWidgetFromPos(const Window *w, int x, int y)
Returns the index for the widget located at the given position relative to the window.
WindowPosition
How do we the window to be placed?
virtual void OnClick([[maybe_unused]] Point pt, [[maybe_unused]] WidgetID widget, [[maybe_unused]] int click_count)
A click with the left mouse button has been made on the window.
@ WDP_CENTER
Center the window.
uint8_t white_border_timer
Timer value of the WF_WHITE_BORDER for flags.
virtual EventState OnKeyPress([[maybe_unused]] char32_t key, [[maybe_unused]] uint16_t keycode)
A key has been pressed.
@ WSM_NONE
No special mouse mode.
void InitializeData(WindowNumber window_number)
Initializes the data (except the position and initial size) of a new Window.
@ FR_BORDERONLY
Draw border only, no background.
Window * FindChildWindow(WindowClass wc=WC_INVALID) const
Find the Window whose parent pointer points to this window.
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
Resize window towards the default size.
Helper/buffer for input fields.
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
void DrawCaption(const Rect &r, Colours colour, Owner owner, TextColour text_colour, StringID str, StringAlignment align, FontSize fs)
Draw a caption bar.
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
void ProcessScheduledResize()
Process scheduled OnResize() event.