OpenTTD Source  1.11.2
window_gui.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 <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef WINDOW_GUI_H
11 #define WINDOW_GUI_H
12 
13 #include "vehicle_type.h"
14 #include "viewport_type.h"
15 #include "company_type.h"
16 #include "tile_type.h"
17 #include "widget_type.h"
18 #include "core/smallvec_type.hpp"
19 #include "core/smallmap_type.hpp"
20 #include "string_type.h"
21 
25 enum FrameFlags {
26  FR_NONE = 0,
27  FR_TRANSPARENT = 1 << 0,
28  FR_BORDERONLY = 1 << 4,
29  FR_LOWERED = 1 << 5,
30  FR_DARKENED = 1 << 6,
31 };
32 
34 
35 
37  /* WWT_IMGBTN(_2) */
42 
43  /* WWT_INSET */
47 
52 
53  /* Size of the pure frame bevel without any padding. */
58 
59  /* FrameRect widgets, all text buttons, panel, editbox */
64 
65  /* Extra space at top/bottom of text panels */
68 
69  /* WWT_FRAME */
74 
75  /* WWT_MATRIX */
80 
81  /* WWT_SHADEBOX */
87 
88  /* WWT_STICKYBOX */
94 
95  /* WWT_DEBUGBOX */
101 
102  /* WWT_DEFSIZEBOX */
108 
109  /* WWT_RESIZEBOX */
115 
116  /* WWT_CLOSEBOX */
122 
123  /* WWT_CAPTION */
129 
130  /* Dropdown widget. */
136 
139 };
140 
141 /* widget.cpp */
142 void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags);
143 void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str);
144 
145 /* window.cpp */
146 extern Window *_z_front_window;
147 extern Window *_z_back_window;
148 extern Window *_focused_window;
149 
150 
157 };
158 
159 Point GetToolbarAlignedWindowPosition(int window_width);
160 
161 struct HotkeyList;
162 
167 
168  WindowDesc(WindowPosition default_pos, const char *ini_key, int16 def_width_trad, int16 def_height_trad,
169  WindowClass window_class, WindowClass parent_class, uint32 flags,
170  const NWidgetPart *nwid_parts, int16 nwid_length, HotkeyList *hotkeys = nullptr);
171 
172  ~WindowDesc();
173 
177  const char *ini_key;
178  uint32 flags;
180  int16 nwid_length;
182 
183  bool pref_sticky;
184  int16 pref_width;
185  int16 pref_height;
186 
187  int16 GetDefaultWidth() const;
188  int16 GetDefaultHeight() const;
189 
190  static void LoadFromConfig();
191  static void SaveToConfig();
192 
193 private:
196 
201  WindowDesc(const WindowDesc &other);
202 };
203 
208  WDF_CONSTRUCTION = 1 << 0,
209  WDF_MODAL = 1 << 1,
210  WDF_NO_FOCUS = 1 << 2,
211 };
212 
216 struct ResizeInfo {
217  uint step_width;
218  uint step_height;
219 };
220 
226 };
227 
232  WF_TIMEOUT = 1 << 0,
233 
234  WF_DRAGGING = 1 << 3,
235  WF_SIZING_RIGHT = 1 << 4,
236  WF_SIZING_LEFT = 1 << 5,
238  WF_STICKY = 1 << 6,
240  WF_WHITE_BORDER = 1 << 8,
241  WF_HIGHLIGHTED = 1 << 9,
242  WF_CENTERED = 1 << 10,
243 };
245 
246 static const int TIMEOUT_DURATION = 7;
247 static const int WHITE_BORDER_DURATION = 3;
248 
258  int32 scrollpos_x;
259  int32 scrollpos_y;
262 };
263 
264 struct QueryString;
265 
266 /* misc_gui.cpp */
267 enum TooltipCloseCondition {
268  TCC_RIGHT_CLICK,
269  TCC_HOVER,
270  TCC_NONE,
271  TCC_EXIT_VIEWPORT,
272 };
273 
278 protected:
280  void InitializePositionSize(int x, int y, int min_width, int min_height);
281  virtual void FindWindowPlacementAndResize(int def_width, int def_height);
282 
283  std::vector<int> scheduled_invalidation_data;
284 
285 public:
286  Window(WindowDesc *desc);
287 
288  virtual ~Window();
289 
296  inline void *operator new[](size_t size)
297  {
298  NOT_REACHED();
299  }
300 
306  inline void operator delete(void *ptr)
307  {
308  }
309 
314 
317 
318  int left;
319  int top;
320  int width;
321  int height;
322 
324 
326 
335 
337 
341 
342  template <class NWID>
343  inline const NWID *GetWidget(uint widnum) const;
344  template <class NWID>
345  inline NWID *GetWidget(uint widnum);
346 
347  const Scrollbar *GetScrollbar(uint widnum) const;
348  Scrollbar *GetScrollbar(uint widnum);
349 
350  const QueryString *GetQueryString(uint widnum) const;
351  QueryString *GetQueryString(uint widnum);
352 
353  virtual const char *GetFocusedText() const;
354  virtual const char *GetCaret() const;
355  virtual const char *GetMarkedText(size_t *length) const;
356  virtual Point GetCaretPosition() const;
357  virtual Rect GetTextBoundingRect(const char *from, const char *to) const;
358  virtual const char *GetTextCharacterAtPosition(const Point &pt) const;
359 
360  void InitNested(WindowNumber number = 0);
361  void CreateNestedTree(bool fill_nested = true);
363 
367  inline void SetTimeout()
368  {
369  this->flags |= WF_TIMEOUT;
370  this->timeout_timer = TIMEOUT_DURATION;
371  }
372 
376  inline void SetWhiteBorder()
377  {
378  this->flags |= WF_WHITE_BORDER;
379  this->white_border_timer = WHITE_BORDER_DURATION;
380  }
381 
383  void SetWidgetHighlight(byte widget_index, TextColour highlighted_colour);
384  bool IsWidgetHighlighted(byte widget_index) const;
385 
393  inline void SetWidgetDisabledState(byte widget_index, bool disab_stat)
394  {
395  assert(widget_index < this->nested_array_size);
396  if (this->nested_array[widget_index] != nullptr) this->GetWidget<NWidgetCore>(widget_index)->SetDisabled(disab_stat);
397  }
398 
403  inline void DisableWidget(byte widget_index)
404  {
405  SetWidgetDisabledState(widget_index, true);
406  }
407 
412  inline void EnableWidget(byte widget_index)
413  {
414  SetWidgetDisabledState(widget_index, false);
415  }
416 
422  inline bool IsWidgetDisabled(byte widget_index) const
423  {
424  assert(widget_index < this->nested_array_size);
425  return this->GetWidget<NWidgetCore>(widget_index)->IsDisabled();
426  }
427 
433  inline bool IsWidgetFocused(byte widget_index) const
434  {
435  return this->nested_focus != nullptr && this->nested_focus->index == widget_index;
436  }
437 
444  inline bool IsWidgetGloballyFocused(byte widget_index) const
445  {
446  return _focused_window == this && IsWidgetFocused(widget_index);
447  }
448 
454  inline void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
455  {
456  assert(widget_index < this->nested_array_size);
457  this->GetWidget<NWidgetCore>(widget_index)->SetLowered(lowered_stat);
458  }
459 
464  inline void ToggleWidgetLoweredState(byte widget_index)
465  {
466  assert(widget_index < this->nested_array_size);
467  bool lowered_state = this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
468  this->GetWidget<NWidgetCore>(widget_index)->SetLowered(!lowered_state);
469  }
470 
475  inline void LowerWidget(byte widget_index)
476  {
477  SetWidgetLoweredState(widget_index, true);
478  }
479 
484  inline void RaiseWidget(byte widget_index)
485  {
486  SetWidgetLoweredState(widget_index, false);
487  }
488 
494  inline bool IsWidgetLowered(byte widget_index) const
495  {
496  assert(widget_index < this->nested_array_size);
497  return this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
498  }
499 
500  void UnfocusFocusedWidget();
501  bool SetFocusedWidget(int widget_index);
502 
503  EventState HandleEditBoxKey(int wid, WChar key, uint16 keycode);
504  virtual void InsertTextString(int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end);
505 
506  void HandleButtonClick(byte widget);
507  int GetRowFromWidget(int clickpos, int widget, int padding, int line_height = -1) const;
508 
509  void RaiseButtons(bool autoraise = false);
510  void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...);
511  void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
512  void SetWidgetDirty(byte widget_index) const;
513 
514  void DrawWidgets() const;
515  void DrawViewport() const;
516  void DrawSortButtonState(int widget, SortButtonState state) const;
517  static int SortButtonWidth();
518 
519  void DeleteChildWindows(WindowClass wc = WC_INVALID) const;
520 
521  void SetDirty() const;
522  void ReInit(int rx = 0, int ry = 0);
523 
525  inline bool IsShaded() const
526  {
527  return this->shade_select != nullptr && this->shade_select->shown_plane == SZSP_HORIZONTAL;
528  }
529 
530  void SetShaded(bool make_shaded);
531 
532  void InvalidateData(int data = 0, bool gui_scope = true);
535 
536  /*** Event handling ***/
537 
542  virtual void OnInit() { }
543 
544  virtual void ApplyDefaults();
545 
553  virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number);
554 
559  virtual void OnPaint()
560  {
561  this->DrawWidgets();
562  }
563 
570  virtual void DrawWidget(const Rect &r, int widget) const {}
571 
584  virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) {}
585 
592  virtual void SetStringParameters(int widget) const {}
593 
594  virtual void OnFocus();
595 
596  virtual void OnFocusLost();
597 
605  virtual EventState OnKeyPress(WChar key, uint16 keycode) { return ES_NOT_HANDLED; }
606 
607  virtual EventState OnHotkey(int hotkey);
608 
615 
616 
623  virtual void OnClick(Point pt, int widget, int click_count) {}
624 
632  virtual bool OnRightClick(Point pt, int widget) { return false; }
633 
639  virtual void OnHover(Point pt, int widget) {}
640 
647  virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) { return false; }
648 
654  virtual void OnMouseDrag(Point pt, int widget) {}
655 
661  virtual void OnDragDrop(Point pt, int widget) {}
662 
667  virtual void OnScroll(Point delta) {}
668 
675  virtual void OnMouseOver(Point pt, int widget) {}
676 
681  virtual void OnMouseWheel(int wheel) {}
682 
683 
687  virtual void OnMouseLoop() {}
688 
692  virtual void OnGameTick() {}
693 
699  virtual void OnHundredthTick() {}
700 
704  virtual void OnRealtimeTick(uint delta_ms) {}
705 
709  virtual void OnTimeout() {}
710 
711 
716  virtual void OnResize() {}
717 
723  virtual void OnDropdownSelect(int widget, int index) {}
724 
725  virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close);
726 
731  virtual void OnEditboxChanged(int widget) {}
732 
739  virtual void OnQueryTextFinished(char *str) {}
740 
746  virtual void OnInvalidateData(int data = 0, bool gui_scope = true) {}
747 
754  virtual void OnPlaceObject(Point pt, TileIndex tile) {}
755 
761  virtual bool OnVehicleSelect(const struct Vehicle *v) { return false; }
762 
766  virtual void OnPlaceObjectAbort() {}
767 
768 
776  virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) {}
777 
787  virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) {}
788 
796  virtual void OnPlacePresize(Point pt, TileIndex tile) {}
797 
798  /*** End of the event handling ***/
799 
804  virtual bool IsNewGRFInspectable() const { return false; }
805 
812  virtual void ShowNewGRFInspectWindow() const { NOT_REACHED(); }
813 };
814 
821 template <class NWID>
822 inline NWID *Window::GetWidget(uint widnum)
823 {
824  if (widnum >= this->nested_array_size || this->nested_array[widnum] == nullptr) return nullptr;
825  NWID *nwid = dynamic_cast<NWID *>(this->nested_array[widnum]);
826  assert(nwid != nullptr);
827  return nwid;
828 }
829 
831 template <>
832 inline const NWidgetBase *Window::GetWidget<NWidgetBase>(uint widnum) const
833 {
834  if (widnum >= this->nested_array_size) return nullptr;
835  return this->nested_array[widnum];
836 }
837 
844 template <class NWID>
845 inline const NWID *Window::GetWidget(uint widnum) const
846 {
847  return const_cast<Window *>(this)->GetWidget<NWID>(widnum);
848 }
849 
850 
854 class PickerWindowBase : public Window {
855 
856 public:
858  {
859  this->parent = parent;
860  }
861 
862  virtual ~PickerWindowBase();
863 };
864 
866 Window *FindWindowFromPt(int x, int y);
867 
876 template <typename Wcls>
877 Wcls *AllocateWindowDescFront(WindowDesc *desc, int window_number, bool return_existing = false)
878 {
879  Wcls *w = static_cast<Wcls *>(BringWindowToFrontById(desc->cls, window_number));
880  if (w != nullptr) return return_existing ? w : nullptr;
881  return new Wcls(desc, window_number);
882 }
883 
884 void RelocateAllWindows(int neww, int newh);
885 
886 void GuiShowTooltips(Window *parent, StringID str, uint paramcount = 0, const uint64 params[] = nullptr, TooltipCloseCondition close_tooltip = TCC_HOVER);
887 
888 /* widget.cpp */
889 int GetWidgetFromPos(const Window *w, int x, int y);
890 
892 #define FOR_ALL_WINDOWS_FROM_BACK_FROM(w, start) for (w = start; w != nullptr; w = w->z_front) if (w->window_class != WC_INVALID)
893 #define FOR_ALL_WINDOWS_FROM_FRONT_FROM(w, start) for (w = start; w != nullptr; w = w->z_back) if (w->window_class != WC_INVALID)
894 #define FOR_ALL_WINDOWS_FROM_BACK(w) FOR_ALL_WINDOWS_FROM_BACK_FROM(w, _z_back_window)
895 #define FOR_ALL_WINDOWS_FROM_FRONT(w) FOR_ALL_WINDOWS_FROM_FRONT_FROM(w, _z_front_window)
896 
897 extern Point _cursorpos_drag_start;
898 
899 extern int _scrollbar_start_pos;
900 extern int _scrollbar_size;
901 extern byte _scroller_click_timeout;
902 
903 extern bool _scrolling_viewport;
904 extern bool _mouse_hovering;
905 
913 };
915 
916 void SetFocusedWindow(Window *w);
917 
918 void ScrollbarClickHandler(Window *w, NWidgetCore *nw, int x, int y);
919 
920 #endif /* WINDOW_GUI_H */
ViewportData
Data structure for a window viewport.
Definition: window_gui.h:256
Window::SetTimeout
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
Definition: window_gui.h:367
WD_FRAMERECT_TOP
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
Definition: window_gui.h:62
WD_DEFSIZEBOX_LEFT
@ WD_DEFSIZEBOX_LEFT
Left offset of defsize sprite.
Definition: window_gui.h:104
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:83
WC_INVALID
@ WC_INVALID
Invalid window.
Definition: window_type.h:700
WD_RESIZEBOX_BOTTOM
@ WD_RESIZEBOX_BOTTOM
Bottom offset of resize sprite.
Definition: window_gui.h:114
PickerWindowBase::~PickerWindowBase
virtual ~PickerWindowBase()
Destructor of the base class PickerWindowBase Main utility is to stop the base Window destructor from...
Definition: window.cpp:3640
Window::z_back
Window * z_back
The window behind us in z-order.
Definition: window_gui.h:340
Window::timeout_timer
uint8 timeout_timer
Timer value of the WF_TIMEOUT for flags.
Definition: window_gui.h:315
Window::OnHundredthTick
virtual void OnHundredthTick()
Called once every 100 (game) ticks, or once every 3s, whichever comes last.
Definition: window_gui.h:699
WD_MATRIX_RIGHT
@ WD_MATRIX_RIGHT
Offset at right of a matrix cell.
Definition: window_gui.h:77
WChar
char32_t WChar
Type for wide characters, i.e.
Definition: string_type.h:35
WF_SIZING
@ WF_SIZING
Window is being resized.
Definition: window_gui.h:237
Window::OnEditboxChanged
virtual void OnEditboxChanged(int widget)
The text in an editbox has been edited.
Definition: window_gui.h:731
Window::SetWhiteBorder
void SetWhiteBorder()
Set the timeout flag of the window and initiate the timer.
Definition: window_gui.h:376
SortButtonState
SortButtonState
State of a sort direction button.
Definition: window_gui.h:222
HotkeyList
List of hotkeys for a window.
Definition: hotkeys.h:40
WD_STICKYBOX_WIDTH
@ WD_STICKYBOX_WIDTH
Width of a standard sticky box widget.
Definition: window_gui.h:89
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
Window::~Window
virtual ~Window()
Remove window and all its child windows from the window stack.
Definition: window.cpp:1084
AllocateWindowDescFront
Wcls * AllocateWindowDescFront(WindowDesc *desc, int window_number, bool return_existing=false)
Open a new window.
Definition: window_gui.h:877
Window::DrawSortButtonState
void DrawSortButtonState(int widget, SortButtonState state) const
Draw a sort button's up or down arrow symbol.
Definition: widget.cpp:636
Window::nested_root
NWidgetBase * nested_root
Root of the nested tree.
Definition: window_gui.h:330
Window::DeleteChildWindows
void DeleteChildWindows(WindowClass wc=WC_INVALID) const
Delete all children a window might have in a head-recursive manner.
Definition: window.cpp:1072
Window::GetScrollbar
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Definition: window.cpp:309
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:208
_scrolling_viewport
bool _scrolling_viewport
A viewport is being scrolled with the mouse.
Definition: window.cpp:77
Window::shade_select
NWidgetStacked * shade_select
Selection widget (NWID_SELECTION) to use for shading the window. If nullptr, window cannot shade.
Definition: window_gui.h:333
WD_SHADEBOX_BOTTOM
@ WD_SHADEBOX_BOTTOM
Bottom offset of shade sprite.
Definition: window_gui.h:86
WF_SIZING_RIGHT
@ WF_SIZING_RIGHT
Window is being resized towards the right.
Definition: window_gui.h:235
Window::OnHover
virtual void OnHover(Point pt, int widget)
The mouse is hovering over a widget in the window, perform an action for it.
Definition: window_gui.h:639
Window::ApplyDefaults
virtual void ApplyDefaults()
Read default values from WindowDesc configuration an apply them to the window.
Definition: window.cpp:182
Window::ReInit
void ReInit(int rx=0, int ry=0)
Re-initialize a window, and optionally change its size.
Definition: window.cpp:995
Window::DrawWidget
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Definition: window_gui.h:570
ViewportDragDropSelectionProcess
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it.
Definition: viewport_type.h:115
WD_MATRIX_TOP
@ WD_MATRIX_TOP
Offset at top of a matrix cell.
Definition: window_gui.h:78
ScrollbarClickHandler
void ScrollbarClickHandler(Window *w, NWidgetCore *nw, int x, int y)
Special handling for the scrollbar widget type.
Definition: widget.cpp:136
Window::InitializePositionSize
void InitializePositionSize(int x, int y, int min_width, int min_height)
Set the position and smallest size of the window.
Definition: window.cpp:1508
widget_type.h
WF_DISABLE_VP_SCROLL
@ WF_DISABLE_VP_SCROLL
Window does not do autoscroll,.
Definition: window_gui.h:239
Window::viewport
ViewportData * viewport
Pointer to viewport data, if present.
Definition: window_gui.h:327
WD_STICKYBOX_TOP
@ WD_STICKYBOX_TOP
Top offset of sticky sprite.
Definition: window_gui.h:92
ViewportData::scrollpos_y
int32 scrollpos_y
Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
Definition: window_gui.h:259
FrameFlags
FrameFlags
Flags to describe the look of the frame.
Definition: window_gui.h:25
smallvec_type.hpp
Window::CreateNestedTree
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Definition: window.cpp:1832
WDP_ALIGN_TOOLBAR
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Definition: window_gui.h:156
Window::OnGameTick
virtual void OnGameTick()
Called once per (game) tick.
Definition: window_gui.h:692
WD_CLOSEBOX_RIGHT
@ WD_CLOSEBOX_RIGHT
Right offset of closebox string.
Definition: window_gui.h:119
Window::IsNewGRFInspectable
virtual bool IsNewGRFInspectable() const
Is the data related to this window NewGRF inspectable?
Definition: window_gui.h:804
WF_STICKY
@ WF_STICKY
Window is made sticky by user.
Definition: window_gui.h:238
WidgetDrawDistances
WidgetDrawDistances
Distances used in drawing widgets.
Definition: window_gui.h:36
WDF_NO_FOCUS
@ WDF_NO_FOCUS
This window won't get focus/make any other window lose focus when click.
Definition: window_gui.h:210
TextColour
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
Definition: gfx_type.h:250
Window::OnInvalidateData
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
Definition: window_gui.h:746
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:573
WD_FRAMETEXT_TOP
@ WD_FRAMETEXT_TOP
Top offset of the text of the frame.
Definition: window_gui.h:72
WD_SCROLLBAR_RIGHT
@ WD_SCROLLBAR_RIGHT
Right offset of scrollbar.
Definition: window_gui.h:49
WD_DEFSIZEBOX_BOTTOM
@ WD_DEFSIZEBOX_BOTTOM
Bottom offset of defsize sprite.
Definition: window_gui.h:107
Window::SetWidgetHighlight
void SetWidgetHighlight(byte widget_index, TextColour highlighted_colour)
Sets the highlighted status of a widget.
Definition: window.cpp:232
WindowDesc::cls
WindowClass cls
Class of the window,.
Definition: window_gui.h:175
SZSP_HORIZONTAL
@ SZSP_HORIZONTAL
Display plane with zero size vertically, and filling and resizing horizontally.
Definition: widget_type.h:398
Window::OnTimeout
virtual void OnTimeout()
Called when this window's timeout has been reached.
Definition: window_gui.h:709
Window::owner
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
Definition: window_gui.h:325
Window::OnDropdownClose
virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close)
A dropdown window associated to this window has been closed.
Definition: window.cpp:282
WindowNumber
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:711
FR_LOWERED
@ FR_LOWERED
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
Definition: window_gui.h:29
smallmap_type.hpp
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:222
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:96
WD_DEBUGBOX_LEFT
@ WD_DEBUGBOX_LEFT
Left offset of debug sprite.
Definition: window_gui.h:97
Window::HandleButtonClick
void HandleButtonClick(byte widget)
Do all things to make a button look clicked and mark it to be unclicked in a few ticks.
Definition: window.cpp:635
Window::GetCaretPosition
virtual Point GetCaretPosition() const
Get the current caret position if an edit box has the focus.
Definition: window.cpp:390
_z_back_window
Window * _z_back_window
List of windows opened at the screen sorted from the back.
Definition: window.cpp:59
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:598
WD_FRAMETEXT_LEFT
@ WD_FRAMETEXT_LEFT
Left offset of the text of the frame.
Definition: window_gui.h:70
FR_TRANSPARENT
@ FR_TRANSPARENT
Makes the background transparent if set.
Definition: window_gui.h:27
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:610
Window::Window
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1871
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:919
Window::nested_focus
const NWidgetCore * nested_focus
Currently focused nested widget, or nullptr if no nested widget has focus.
Definition: window_gui.h:328
QueryString
Data stored about a string that can be modified in the GUI.
Definition: querystring_gui.h:20
Window::scheduled_invalidation_data
std::vector< int > scheduled_invalidation_data
Data of scheduled OnInvalidateData() calls.
Definition: window_gui.h:283
Window::IsWidgetHighlighted
bool IsWidgetHighlighted(byte widget_index) const
Gets the highlighted status of a widget.
Definition: window.cpp:265
Window::GetCaret
virtual const char * GetCaret() const
Get the string at the caret if an edit box has the focus.
Definition: window.cpp:363
WD_IMGBTN_BOTTOM
@ WD_IMGBTN_BOTTOM
Bottom offset of image in the button.
Definition: window_gui.h:41
WD_INSET_TOP
@ WD_INSET_TOP
Top offset of string.
Definition: window_gui.h:46
Window::OnCTRLStateChange
virtual EventState OnCTRLStateChange()
The state of the control key has changed.
Definition: window_gui.h:614
Window::GetTextCharacterAtPosition
virtual const char * GetTextCharacterAtPosition(const Point &pt) const
Get the character that is rendered at a position by the focused edit box.
Definition: window.cpp:421
Window::querystrings
SmallMap< int, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
Definition: window_gui.h:329
SmallMap< int, QueryString * >
Window::OnPlaceMouseUp
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
The user has dragged over the map when the tile highlight mode has been set.
Definition: window_gui.h:787
Window::ProcessScheduledInvalidations
void ProcessScheduledInvalidations()
Process all scheduled invalidations.
Definition: window.cpp:3274
WindowDesc::default_width_trad
int16 default_width_trad
Preferred initial width of the window (pixels at 1x zoom).
Definition: window_gui.h:194
WindowDesc::default_pos
WindowPosition default_pos
Preferred position of the window.
Definition: window_gui.h:174
WindowDesc
High level window description.
Definition: window_gui.h:166
SetFocusedWindow
void SetFocusedWindow(Window *w)
Set the window that has the focus.
Definition: window.cpp:434
Window::SetStringParameters
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
Definition: window_gui.h:592
WF_SIZING_LEFT
@ WF_SIZING_LEFT
Window is being resized towards the left.
Definition: window_gui.h:236
Window::SetShaded
void SetShaded(bool make_shaded)
Set the shaded state of the window to make_shaded.
Definition: window.cpp:1031
Window::GetWidget
const NWID * GetWidget(uint widnum) const
Get the nested widget with number widnum from the nested widget tree.
Definition: window_gui.h:845
Window::OnFocusLost
virtual void OnFocusLost()
Called when window loses focus.
Definition: window.cpp:524
Viewport
Data structure for viewport, display of a part of the world.
Definition: viewport_type.h:22
_mouse_hovering
bool _mouse_hovering
The mouse is hovering over the same point.
Definition: window.cpp:78
Window::UnfocusFocusedWidget
void UnfocusFocusedWidget()
Makes no widget on this window have focus.
Definition: window.cpp:479
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:154
WindowDesc::ini_key
const char * ini_key
Key to store window defaults in openttd.cfg. nullptr if nothing shall be stored.
Definition: window_gui.h:177
WD_RESIZEBOX_RIGHT
@ WD_RESIZEBOX_RIGHT
Right offset of resize sprite.
Definition: window_gui.h:112
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:323
WSM_PRESIZE
@ WSM_PRESIZE
Presizing mode (docks, tunnels).
Definition: window_gui.h:911
WD_SHADEBOX_RIGHT
@ WD_SHADEBOX_RIGHT
Right offset of shade sprite.
Definition: window_gui.h:84
Window::EnableWidget
void EnableWidget(byte widget_index)
Sets a widget to Enabled.
Definition: window_gui.h:412
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1861
Window::ProcessHighlightedInvalidations
void ProcessHighlightedInvalidations()
Process all invalidation of highlighted widgets.
Definition: window.cpp:3286
WD_CLOSEBOX_TOP
@ WD_CLOSEBOX_TOP
Top offset of closebox string.
Definition: window_gui.h:120
Window::height
int height
Height of the window (number of pixels down in y direction)
Definition: window_gui.h:321
WF_CENTERED
@ WF_CENTERED
Window is centered and shall stay centered after ReInit.
Definition: window_gui.h:242
WF_WHITE_BORDER
@ WF_WHITE_BORDER
Window white border counter bit mask.
Definition: window_gui.h:240
SpecialMouseMode
SpecialMouseMode
Mouse modes.
Definition: window_gui.h:907
WD_INSET_RIGHT
@ WD_INSET_RIGHT
Right offset of string.
Definition: window_gui.h:45
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:984
GetToolbarAlignedWindowPosition
Point GetToolbarAlignedWindowPosition(int window_width)
Computer the position of the top-left corner of a window to be opened right under the toolbar.
Definition: window.cpp:1736
WD_FRAMERECT_LEFT
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:60
Window::OnFocus
virtual void OnFocus()
Called when window gains focus.
Definition: window.cpp:516
WD_PAR_VSEP_NORMAL
@ WD_PAR_VSEP_NORMAL
Normal amount of vertical space between two paragraphs of text.
Definition: window_gui.h:137
WD_FRAMERECT_RIGHT
@ WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:61
ZeroedMemoryAllocator
Base class that provides memory initialization on dynamically created objects.
Definition: alloc_type.hpp:85
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition: window_type.h:719
WD_FRAMERECT_BOTTOM
@ WD_FRAMERECT_BOTTOM
Offset at bottom to draw the frame rectangular area.
Definition: window_gui.h:63
WD_DEFSIZEBOX_RIGHT
@ WD_DEFSIZEBOX_RIGHT
Right offset of defsize sprite.
Definition: window_gui.h:105
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:124
WD_FRAMETEXT_BOTTOM
@ WD_FRAMETEXT_BOTTOM
Bottom offset of the text of the frame.
Definition: window_gui.h:73
Window::OnVehicleSelect
virtual bool OnVehicleSelect(const struct Vehicle *v)
The user clicked on a vehicle while HT_VEHICLE has been set.
Definition: window_gui.h:761
Window::HandleEditBoxKey
EventState HandleEditBoxKey(int wid, WChar key, uint16 keycode)
Process keypress for editbox widget.
Definition: window.cpp:2608
Window::DisableAllWidgetHighlight
void DisableAllWidgetHighlight()
Disable the highlighted status of all widgets.
Definition: window.cpp:212
Window::OnPlaceObject
virtual void OnPlaceObject(Point pt, TileIndex tile)
The user clicked some place on the map when a tile highlight mode has been set.
Definition: window_gui.h:754
Window::OnDropdownSelect
virtual void OnDropdownSelect(int widget, int index)
A dropdown option associated to this window has been selected.
Definition: window_gui.h:723
Window::GetQueryString
const QueryString * GetQueryString(uint widnum) const
Return the querystring associated to a editbox.
Definition: window.cpp:329
WindowDesc::GetDefaultWidth
int16 GetDefaultWidth() const
Determine default width of window.
Definition: window.cpp:123
Window::SetWidgetDisabledState
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Definition: window_gui.h:393
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:338
WD_STICKYBOX_RIGHT
@ WD_STICKYBOX_RIGHT
Right offset of sticky sprite.
Definition: window_gui.h:91
Window::IsWidgetGloballyFocused
bool IsWidgetGloballyFocused(byte widget_index) const
Check if given widget has user input focus.
Definition: window_gui.h:444
Window::left
int left
x position of left edge of the window
Definition: window_gui.h:318
Window::OnDragDrop
virtual void OnDragDrop(Point pt, int widget)
A dragged 'object' has been released.
Definition: window_gui.h:661
Window::flags
WindowFlags flags
Window flags.
Definition: window_gui.h:311
DrawFrameRect
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
Draw frame rectangle.
Definition: widget.cpp:175
WF_TIMEOUT
@ WF_TIMEOUT
Window timeout counter.
Definition: window_gui.h:232
WD_INSET_LEFT
@ WD_INSET_LEFT
Left offset of string.
Definition: window_gui.h:44
WindowClass
WindowClass
Window classes.
Definition: window_type.h:37
Window::ShowNewGRFInspectWindow
virtual void ShowNewGRFInspectWindow() const
Show the NewGRF inspection window.
Definition: window_gui.h:812
WindowDesc::default_height_trad
int16 default_height_trad
Preferred initial height of the window (pixels at 1x zoom).
Definition: window_gui.h:195
GetWidgetFromPos
int GetWidgetFromPos(const Window *w, int x, int y)
Returns the index for the widget located at the given position relative to the window.
Definition: widget.cpp:160
WD_DEBUGBOX_RIGHT
@ WD_DEBUGBOX_RIGHT
Right offset of debug sprite.
Definition: window_gui.h:98
WDF_MODAL
@ WDF_MODAL
The window is a modal child of some other window, meaning the parent is 'inactive'.
Definition: window_gui.h:209
WindowDesc::GetDefaultHeight
int16 GetDefaultHeight() const
Determine default height of window.
Definition: window.cpp:133
TIMEOUT_DURATION
static const int TIMEOUT_DURATION
The initial timeout value for WF_TIMEOUT.
Definition: window_gui.h:246
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
WF_HIGHLIGHTED
@ WF_HIGHLIGHTED
Window has a widget that has a highlight.
Definition: window_gui.h:241
WindowDesc::nwid_parts
const NWidgetPart * nwid_parts
Nested widget parts describing the window.
Definition: window_gui.h:179
WindowDefaultFlag
WindowDefaultFlag
Window default widget/window handling flags.
Definition: window_gui.h:207
ViewportData::dest_scrollpos_y
int32 dest_scrollpos_y
Current destination y coordinate to display (virtual screen coordinate of topleft corner of the viewp...
Definition: window_gui.h:261
Window::IsWidgetFocused
bool IsWidgetFocused(byte widget_index) const
Check if given widget is focused within this window.
Definition: window_gui.h:433
WSM_DRAGDROP
@ WSM_DRAGDROP
Drag&drop an object.
Definition: window_gui.h:909
Window::OnInit
virtual void OnInit()
Notification that the nested widget tree gets initialized.
Definition: window_gui.h:542
WSM_SIZING
@ WSM_SIZING
Sizing mode.
Definition: window_gui.h:910
Window::unshaded_size
Dimension unshaded_size
Last known unshaded size (only valid while shaded).
Definition: window_gui.h:334
WindowDesc::SaveToConfig
static void SaveToConfig()
Save all WindowDesc settings to _windows_file.
Definition: window.cpp:164
string_type.h
WD_FRAMETEXT_RIGHT
@ WD_FRAMETEXT_RIGHT
Right offset of the text of the frame.
Definition: window_gui.h:71
Window::SetFocusedWidget
bool SetFocusedWidget(int widget_index)
Set focus within this window to the given widget.
Definition: window.cpp:495
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:313
WD_DROPDOWNTEXT_RIGHT
@ WD_DROPDOWNTEXT_RIGHT
Right offset of the dropdown widget string.
Definition: window_gui.h:133
WD_SCROLLBAR_LEFT
@ WD_SCROLLBAR_LEFT
Left offset of scrollbar.
Definition: window_gui.h:48
ResizeInfo::step_height
uint step_height
Step-size of height resize changes.
Definition: window_gui.h:218
WindowDesc::WindowDesc
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.
Definition: window.cpp:92
WindowFlags
WindowFlags
Window flags.
Definition: window_gui.h:231
Window::InvalidateData
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
Definition: window.cpp:3261
Window::mouse_capture_widget
int mouse_capture_widget
Widgetindex of current mouse capture widget (e.g. dragged scrollbar). -1 if no widget has mouse captu...
Definition: window_gui.h:336
NWidgetStacked
Stacked widgets, widgets all occupying the same space in the window.
Definition: widget_type.h:414
Window::nested_array
NWidgetBase ** nested_array
Array of pointers into the tree. Do not access directly, use Window::GetWidget() instead.
Definition: window_gui.h:331
Window::OnPlacePresize
virtual void OnPlacePresize(Point pt, TileIndex tile)
The user moves over the map when a tile highlight mode has been set when the special mouse mode has b...
Definition: window_gui.h:796
WD_SHADEBOX_TOP
@ WD_SHADEBOX_TOP
Top offset of shade sprite.
Definition: window_gui.h:85
WD_SCROLLBAR_BOTTOM
@ WD_SCROLLBAR_BOTTOM
Bottom offset of scrollbar.
Definition: window_gui.h:51
WD_DROPDOWNTEXT_TOP
@ WD_DROPDOWNTEXT_TOP
Top offset of the dropdown widget string.
Definition: window_gui.h:134
WD_SHADEBOX_LEFT
@ WD_SHADEBOX_LEFT
Left offset of shade sprite.
Definition: window_gui.h:83
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
Window::OnClick
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Definition: window_gui.h:623
SBS_DOWN
@ SBS_DOWN
Sort ascending.
Definition: window_gui.h:224
ViewportData::scrollpos_x
int32 scrollpos_x
Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
Definition: window_gui.h:258
vehicle_type.h
Window::OnMouseLoop
virtual void OnMouseLoop()
Called for every mouse loop run, which is at least once per (game) tick.
Definition: window_gui.h:687
WD_DROPDOWN_HEIGHT
@ WD_DROPDOWN_HEIGHT
Height of a drop down widget.
Definition: window_gui.h:131
WindowDesc::nwid_length
int16 nwid_length
Length of the nwid_parts array.
Definition: window_gui.h:180
ResizeInfo::step_width
uint step_width
Step-size of width resize changes.
Definition: window_gui.h:217
Window::OnMouseWheel
virtual void OnMouseWheel(int wheel)
The mouse wheel has been turned.
Definition: window_gui.h:681
WindowDesc::flags
uint32 flags
Flags.
Definition: window_gui.h:178
Window::IsShaded
bool IsShaded() const
Is window shaded currently?
Definition: window_gui.h:525
Window::OnPlaceObjectAbort
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
Definition: window_gui.h:766
ResizeInfo
Data structure for resizing a window.
Definition: window_gui.h:216
WD_CLOSEBOX_WIDTH
@ WD_CLOSEBOX_WIDTH
Width of a close box widget.
Definition: window_gui.h:117
GuiShowTooltips
void GuiShowTooltips(Window *parent, StringID str, uint paramcount=0, const uint64 params[]=nullptr, TooltipCloseCondition close_tooltip=TCC_HOVER)
Shows a tooltip.
Definition: misc_gui.cpp:791
WD_BEVEL_RIGHT
@ WD_BEVEL_RIGHT
Width of right bevel border.
Definition: window_gui.h:55
tile_type.h
Window::SetWidgetsLoweredState
void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets,...)
Sets the lowered/raised status of a list of widgets.
Definition: window.cpp:555
WD_CAPTIONTEXT_TOP
@ WD_CAPTIONTEXT_TOP
Offset of the caption text at the top.
Definition: window_gui.h:127
Window::OnTooltip
virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond)
Event to display a custom tooltip.
Definition: window_gui.h:647
WD_DEFSIZEBOX_WIDTH
@ WD_DEFSIZEBOX_WIDTH
Width of a standard defsize box widget.
Definition: window_gui.h:103
WD_SHADEBOX_WIDTH
@ WD_SHADEBOX_WIDTH
Width of a standard shade box widget.
Definition: window_gui.h:82
WD_DEBUGBOX_WIDTH
@ WD_DEBUGBOX_WIDTH
Width of a standard debug box widget.
Definition: window_gui.h:96
Window::GetTextBoundingRect
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.
Definition: window.cpp:406
WD_DEBUGBOX_BOTTOM
@ WD_DEBUGBOX_BOTTOM
Bottom offset of debug sprite.
Definition: window_gui.h:100
WD_SCROLLBAR_TOP
@ WD_SCROLLBAR_TOP
Top offset of scrollbar.
Definition: window_gui.h:50
Window::OnPaint
virtual void OnPaint()
The window must be repainted.
Definition: window_gui.h:559
Window::SetWidgetsDisabledState
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
Definition: window.cpp:536
Window::IsWidgetLowered
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:494
Window::OnMouseOver
virtual void OnMouseOver(Point pt, int widget)
The mouse is currently moving over the window or has just moved outside of the window.
Definition: window_gui.h:675
EventState
EventState
State of handling an event.
Definition: window_type.h:717
WindowDesc::pref_sticky
bool pref_sticky
Preferred stickyness.
Definition: window_gui.h:183
WF_DRAGGING
@ WF_DRAGGING
Window is being dragged.
Definition: window_gui.h:234
Window::UpdateWidgetSize
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Definition: window_gui.h:584
WD_IMGBTN_TOP
@ WD_IMGBTN_TOP
Top offset of image in the button.
Definition: window_gui.h:40
WD_RESIZEBOX_WIDTH
@ WD_RESIZEBOX_WIDTH
Width of a resize box widget.
Definition: window_gui.h:110
WSM_DRAGGING
@ WSM_DRAGGING
Dragging mode (trees).
Definition: window_gui.h:912
Window::window_class
WindowClass window_class
Window class.
Definition: window_gui.h:312
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1848
WD_STICKYBOX_BOTTOM
@ WD_STICKYBOX_BOTTOM
Bottom offset of sticky sprite.
Definition: window_gui.h:93
PickerWindowBase
Base class for windows opened from a toolbar.
Definition: window_gui.h:854
_special_mouse_mode
SpecialMouseMode _special_mouse_mode
Mode of the mouse.
Definition: window.cpp:80
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:319
Window::DrawViewport
void DrawViewport() const
Draw the viewport of this window.
Definition: viewport.cpp:1810
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
VehicleID
uint32 VehicleID
The type all our vehicle IDs have.
Definition: vehicle_type.h:16
WHITE_BORDER_DURATION
static const int WHITE_BORDER_DURATION
The initial timeout value for WF_WHITE_BORDER.
Definition: window_gui.h:247
WD_BEVEL_TOP
@ WD_BEVEL_TOP
Height of top bevel border.
Definition: window_gui.h:56
Window::OnMouseDrag
virtual void OnMouseDrag(Point pt, int widget)
An 'object' is being dragged at the provided position, highlight the target if possible.
Definition: window_gui.h:654
WD_BEVEL_LEFT
@ WD_BEVEL_LEFT
Width of left bevel border.
Definition: window_gui.h:54
ViewportData::follow_vehicle
VehicleID follow_vehicle
VehicleID to follow if following a vehicle, INVALID_VEHICLE otherwise.
Definition: window_gui.h:257
WD_MATRIX_BOTTOM
@ WD_MATRIX_BOTTOM
Offset at bottom of a matrix cell.
Definition: window_gui.h:79
Window::OnInitialPosition
virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
Compute the initial position of the window.
Definition: window.cpp:1820
Window::ToggleWidgetLoweredState
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
Definition: window_gui.h:464
Window::width
int width
width of the window (number of pixels to the right in x direction)
Definition: window_gui.h:320
WindowDesc::LoadFromConfig
static void LoadFromConfig()
Load all WindowDesc settings from _windows_file.
Definition: window.cpp:141
RelocateAllWindows
void RelocateAllWindows(int neww, int newh)
Relocate all windows to fit the new size of the game application screen.
Definition: window.cpp:3569
ViewportData::dest_scrollpos_x
int32 dest_scrollpos_x
Current destination x coordinate to display (virtual screen coordinate of topleft corner of the viewp...
Definition: window_gui.h:260
WD_CAPTIONTEXT_BOTTOM
@ WD_CAPTIONTEXT_BOTTOM
Offset of the caption text at the bottom.
Definition: window_gui.h:128
WDP_MANUAL
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
Definition: window_gui.h:153
Window::SortButtonWidth
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
Definition: widget.cpp:656
FR_DARKENED
@ FR_DARKENED
If set the background is darker, allows for lowered frames with normal background colour when used wi...
Definition: window_gui.h:30
WD_RESIZEBOX_TOP
@ WD_RESIZEBOX_TOP
Top offset of resize sprite.
Definition: window_gui.h:113
Window::InsertTextString
virtual void InsertTextString(int 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.
Definition: window.cpp:2752
Window::window_desc
WindowDesc * window_desc
Window description.
Definition: window_gui.h:310
Window::OnPlaceDrag
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
The user is dragging over the map when the tile highlight mode has been set.
Definition: window_gui.h:776
Window::OnRealtimeTick
virtual void OnRealtimeTick(uint delta_ms)
Called periodically.
Definition: window_gui.h:704
WD_DEBUGBOX_TOP
@ WD_DEBUGBOX_TOP
Top offset of debug sprite.
Definition: window_gui.h:99
WD_CAPTION_HEIGHT
@ WD_CAPTION_HEIGHT
Height of a title bar.
Definition: window_gui.h:124
WD_DROPDOWNTEXT_BOTTOM
@ WD_DROPDOWNTEXT_BOTTOM
Bottom offset of the dropdown widget string.
Definition: window_gui.h:135
Window::z_front
Window * z_front
The window in front of us in z-order.
Definition: window_gui.h:339
WindowDesc::parent_cls
WindowClass parent_cls
Class of the parent window.
Definition: window_gui.h:176
Window
Data structure for an opened window.
Definition: window_gui.h:277
WD_CAPTIONTEXT_LEFT
@ WD_CAPTIONTEXT_LEFT
Offset of the caption text at the left.
Definition: window_gui.h:125
Window::RaiseWidget
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Definition: window_gui.h:484
WD_MATRIX_LEFT
@ WD_MATRIX_LEFT
Offset at left of a matrix cell.
Definition: window_gui.h:76
viewport_type.h
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:602
FindWindowFromPt
Window * FindWindowFromPt(int x, int y)
Do a search for a window at specific coordinates.
Definition: window.cpp:1882
Window::OnRightClick
virtual bool OnRightClick(Point pt, int widget)
A click with the right mouse button has been made on the window.
Definition: window_gui.h:632
Window::OnQueryTextFinished
virtual void OnQueryTextFinished(char *str)
The query window opened from this window has closed.
Definition: window_gui.h:739
Window::OnScroll
virtual void OnScroll(Point delta)
Handle the request for (viewport) scrolling.
Definition: window_gui.h:667
WD_DROPDOWNTEXT_LEFT
@ WD_DROPDOWNTEXT_LEFT
Left offset of the dropdown widget string.
Definition: window_gui.h:132
SBS_UP
@ SBS_UP
Sort descending.
Definition: window_gui.h:225
WD_IMGBTN_LEFT
@ WD_IMGBTN_LEFT
Left offset of the image in the button.
Definition: window_gui.h:38
SBS_OFF
@ SBS_OFF
Do not sort (with this button).
Definition: window_gui.h:223
Window::nested_array_size
uint nested_array_size
Size of the nested array.
Definition: window_gui.h:332
NWidgetCore::index
int index
Index of the nested widget in the widget array of the window (-1 means 'not used').
Definition: widget_type.h:313
Window::IsWidgetDisabled
bool IsWidgetDisabled(byte widget_index) const
Gets the enabled/disabled status of a widget.
Definition: window_gui.h:422
NWidgetCore
Base class for a 'real' widget.
Definition: widget_type.h:292
Window::SetWidgetDirty
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Definition: window.cpp:597
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:47
Window::LowerWidget
void LowerWidget(byte widget_index)
Marks a widget as lowered.
Definition: window_gui.h:475
WD_CLOSEBOX_BOTTOM
@ WD_CLOSEBOX_BOTTOM
Bottom offset of closebox string.
Definition: window_gui.h:121
Window::GetMarkedText
virtual const char * GetMarkedText(size_t *length) const
Get the range of the currently marked input text.
Definition: window.cpp:377
Window::GetRowFromWidget
int GetRowFromWidget(int clickpos, int widget, int padding, int line_height=-1) const
Compute the row of a widget that a user clicked in.
Definition: window.cpp:201
Window::OnResize
virtual void OnResize()
Called after the window got resized.
Definition: window_gui.h:716
Window::DisableWidget
void DisableWidget(byte widget_index)
Sets a widget to disabled.
Definition: window_gui.h:403
WD_BEVEL_BOTTOM
@ WD_BEVEL_BOTTOM
Height of bottom bevel border.
Definition: window_gui.h:57
WindowDesc::hotkeys
HotkeyList * hotkeys
Hotkeys for the window.
Definition: window_gui.h:181
NWidgetStacked::shown_plane
int shown_plane
Plane being displayed (for NWID_SELECTION only).
Definition: widget_type.h:429
WD_PAR_VSEP_WIDE
@ WD_PAR_VSEP_WIDE
Large amount of vertical space between two paragraphs of text.
Definition: window_gui.h:138
WindowPosition
WindowPosition
How do we the window to be placed?
Definition: window_gui.h:152
WD_IMGBTN_RIGHT
@ WD_IMGBTN_RIGHT
Right offset of the image in the button.
Definition: window_gui.h:39
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition: window_gui.h:155
Window::SetWidgetLoweredState
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:454
company_type.h
WindowDesc::pref_height
int16 pref_height
User-preferred height of the window. Zero if unset.
Definition: window_gui.h:185
DrawCaption
void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str)
Draw a caption bar.
Definition: widget.cpp:538
WD_CLOSEBOX_LEFT
@ WD_CLOSEBOX_LEFT
Left offset of closebox string.
Definition: window_gui.h:118
Window::white_border_timer
uint8 white_border_timer
Timer value of the WF_WHITE_BORDER for flags.
Definition: window_gui.h:316
WD_TEXTPANEL_BOTTOM
@ WD_TEXTPANEL_BOTTOM
Offset at bottom to draw below the text.
Definition: window_gui.h:67
WD_RESIZEBOX_LEFT
@ WD_RESIZEBOX_LEFT
Left offset of resize sprite.
Definition: window_gui.h:111
WSM_NONE
@ WSM_NONE
No special mouse mode.
Definition: window_gui.h:908
WD_STICKYBOX_LEFT
@ WD_STICKYBOX_LEFT
Left offset of sticky sprite.
Definition: window_gui.h:90
WindowDesc::pref_width
int16 pref_width
User-preferred width of the window. Zero if unset.
Definition: window_gui.h:184
Window::InitializeData
void InitializeData(WindowNumber window_number)
Initializes the data (except the position and initial size) of a new Window.
Definition: window.cpp:1466
FR_BORDERONLY
@ FR_BORDERONLY
Draw border only, no background.
Definition: window_gui.h:28
Window::GetFocusedText
virtual const char * GetFocusedText() const
Get the current input text if an edit box has the focus.
Definition: window.cpp:350
WD_CAPTIONTEXT_RIGHT
@ WD_CAPTIONTEXT_RIGHT
Offset of the caption text at the right.
Definition: window_gui.h:126
_z_front_window
Window * _z_front_window
List of windows opened at the screen sorted from the front.
Definition: window.cpp:57
WD_TEXTPANEL_TOP
@ WD_TEXTPANEL_TOP
Offset at top to draw above the text.
Definition: window_gui.h:66
Window::FindWindowPlacementAndResize
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
Resize window towards the default size.
Definition: window.cpp:1526
WD_DEFSIZEBOX_TOP
@ WD_DEFSIZEBOX_TOP
Top offset of defsize sprite.
Definition: window_gui.h:106
Window::OnKeyPress
virtual EventState OnKeyPress(WChar key, uint16 keycode)
A key has been pressed.
Definition: window_gui.h:605
BringWindowToFrontById
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
Definition: window.cpp:1262