OpenTTD Source  12.0-beta2
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 <list>
14 
15 #include "vehicle_type.h"
16 #include "viewport_type.h"
17 #include "company_type.h"
18 #include "tile_type.h"
19 #include "widget_type.h"
20 #include "core/smallvec_type.hpp"
21 #include "core/smallmap_type.hpp"
22 #include "string_type.h"
23 
27 enum FrameFlags {
28  FR_NONE = 0,
29  FR_TRANSPARENT = 1 << 0,
30  FR_BORDERONLY = 1 << 4,
31  FR_LOWERED = 1 << 5,
32  FR_DARKENED = 1 << 6,
33 };
34 
36 
37 
39  /* WWT_IMGBTN(_2) */
44 
45  /* WWT_INSET */
49 
54 
55  /* Size of the pure frame bevel without any padding. */
60 
61  /* FrameRect widgets, all text buttons, panel, editbox */
66 
67  /* Extra space at top/bottom of text panels */
70 
71  /* WWT_FRAME */
76 
77  /* WWT_MATRIX */
82 
83  /* WWT_SHADEBOX */
89 
90  /* WWT_STICKYBOX */
96 
97  /* WWT_DEBUGBOX */
103 
104  /* WWT_DEFSIZEBOX */
110 
111  /* WWT_RESIZEBOX */
117 
118  /* WWT_CLOSEBOX */
124 
125  /* WWT_CAPTION */
131 
132  /* Dropdown widget. */
138 
141 };
142 
143 /* widget.cpp */
144 void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags);
145 void DrawCaption(const Rect &r, Colours colour, Owner owner, TextColour text_colour, StringID str, StringAlignment align);
146 
147 /* window.cpp */
148 using WindowList = std::list<Window *>;
149 extern WindowList _z_windows;
150 extern Window *_focused_window;
151 
152 
159 };
160 
161 Point GetToolbarAlignedWindowPosition(int window_width);
162 
163 struct HotkeyList;
164 
169 
170  WindowDesc(WindowPosition default_pos, const char *ini_key, int16 def_width_trad, int16 def_height_trad,
171  WindowClass window_class, WindowClass parent_class, uint32 flags,
172  const NWidgetPart *nwid_parts, int16 nwid_length, HotkeyList *hotkeys = nullptr);
173 
174  ~WindowDesc();
175 
179  const char *ini_key;
180  uint32 flags;
182  int16 nwid_length;
184 
185  bool pref_sticky;
186  int16 pref_width;
187  int16 pref_height;
188 
189  int16 GetDefaultWidth() const;
190  int16 GetDefaultHeight() const;
191 
192  static void LoadFromConfig();
193  static void SaveToConfig();
194 
195 private:
198 
203  WindowDesc(const WindowDesc &other);
204 };
205 
210  WDF_CONSTRUCTION = 1 << 0,
211  WDF_MODAL = 1 << 1,
212  WDF_NO_FOCUS = 1 << 2,
213 };
214 
218 struct ResizeInfo {
219  uint step_width;
220  uint step_height;
221 };
222 
228 };
229 
234  WF_TIMEOUT = 1 << 0,
235 
236  WF_DRAGGING = 1 << 3,
237  WF_SIZING_RIGHT = 1 << 4,
238  WF_SIZING_LEFT = 1 << 5,
240  WF_STICKY = 1 << 6,
242  WF_WHITE_BORDER = 1 << 8,
243  WF_HIGHLIGHTED = 1 << 9,
244  WF_CENTERED = 1 << 10,
245 };
247 
248 static const int TIMEOUT_DURATION = 7;
249 static const int WHITE_BORDER_DURATION = 3;
250 
260  int32 scrollpos_x;
261  int32 scrollpos_y;
264 };
265 
266 struct QueryString;
267 
268 /* misc_gui.cpp */
269 enum TooltipCloseCondition {
270  TCC_RIGHT_CLICK,
271  TCC_HOVER,
272  TCC_NONE,
273  TCC_EXIT_VIEWPORT,
274 };
275 
280 private:
281  static std::vector<Window *> closed_windows;
282 
283 protected:
285  void InitializePositionSize(int x, int y, int min_width, int min_height);
286  virtual void FindWindowPlacementAndResize(int def_width, int def_height);
287 
288  std::vector<int> scheduled_invalidation_data;
289 
290  /* Protected to prevent deletion anywhere outside Window::DeleteClosedWindows(). */
291  virtual ~Window();
292 
293 public:
294  Window(WindowDesc *desc);
295 
302  inline void *operator new[](size_t size) = delete;
303 
308 
311 
312  int left;
313  int top;
314  int width;
315  int height;
316 
318 
320 
329 
331 
333  WindowList::iterator z_position;
334 
335  template <class NWID>
336  inline const NWID *GetWidget(uint widnum) const;
337  template <class NWID>
338  inline NWID *GetWidget(uint widnum);
339 
340  const Scrollbar *GetScrollbar(uint widnum) const;
341  Scrollbar *GetScrollbar(uint widnum);
342 
343  const QueryString *GetQueryString(uint widnum) const;
344  QueryString *GetQueryString(uint widnum);
345 
346  virtual const char *GetFocusedText() const;
347  virtual const char *GetCaret() const;
348  virtual const char *GetMarkedText(size_t *length) const;
349  virtual Point GetCaretPosition() const;
350  virtual Rect GetTextBoundingRect(const char *from, const char *to) const;
351  virtual const char *GetTextCharacterAtPosition(const Point &pt) const;
352 
353  void InitNested(WindowNumber number = 0);
354  void CreateNestedTree(bool fill_nested = true);
356 
360  inline void SetTimeout()
361  {
362  this->flags |= WF_TIMEOUT;
363  this->timeout_timer = TIMEOUT_DURATION;
364  }
365 
369  inline void SetWhiteBorder()
370  {
371  this->flags |= WF_WHITE_BORDER;
372  this->white_border_timer = WHITE_BORDER_DURATION;
373  }
374 
376  void SetWidgetHighlight(byte widget_index, TextColour highlighted_colour);
377  bool IsWidgetHighlighted(byte widget_index) const;
378 
386  inline void SetWidgetDisabledState(byte widget_index, bool disab_stat)
387  {
388  assert(widget_index < this->nested_array_size);
389  if (this->nested_array[widget_index] != nullptr) this->GetWidget<NWidgetCore>(widget_index)->SetDisabled(disab_stat);
390  }
391 
396  inline void DisableWidget(byte widget_index)
397  {
398  SetWidgetDisabledState(widget_index, true);
399  }
400 
405  inline void EnableWidget(byte widget_index)
406  {
407  SetWidgetDisabledState(widget_index, false);
408  }
409 
415  inline bool IsWidgetDisabled(byte widget_index) const
416  {
417  assert(widget_index < this->nested_array_size);
418  return this->GetWidget<NWidgetCore>(widget_index)->IsDisabled();
419  }
420 
426  inline bool IsWidgetFocused(byte widget_index) const
427  {
428  return this->nested_focus != nullptr && this->nested_focus->index == widget_index;
429  }
430 
437  inline bool IsWidgetGloballyFocused(byte widget_index) const
438  {
439  return _focused_window == this && IsWidgetFocused(widget_index);
440  }
441 
447  inline void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
448  {
449  assert(widget_index < this->nested_array_size);
450  this->GetWidget<NWidgetCore>(widget_index)->SetLowered(lowered_stat);
451  }
452 
457  inline void ToggleWidgetLoweredState(byte widget_index)
458  {
459  assert(widget_index < this->nested_array_size);
460  bool lowered_state = this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
461  this->GetWidget<NWidgetCore>(widget_index)->SetLowered(!lowered_state);
462  }
463 
468  inline void LowerWidget(byte widget_index)
469  {
470  SetWidgetLoweredState(widget_index, true);
471  }
472 
477  inline void RaiseWidget(byte widget_index)
478  {
479  SetWidgetLoweredState(widget_index, false);
480  }
481 
487  inline bool IsWidgetLowered(byte widget_index) const
488  {
489  assert(widget_index < this->nested_array_size);
490  return this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
491  }
492 
493  void UnfocusFocusedWidget();
494  bool SetFocusedWidget(int widget_index);
495 
496  EventState HandleEditBoxKey(int wid, WChar key, uint16 keycode);
497  virtual void InsertTextString(int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end);
498 
499  void HandleButtonClick(byte widget);
500  int GetRowFromWidget(int clickpos, int widget, int padding, int line_height = -1) const;
501 
502  void RaiseButtons(bool autoraise = false);
503  void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...);
504  void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
505  void SetWidgetDirty(byte widget_index) const;
506 
507  void DrawWidgets() const;
508  void DrawViewport() const;
509  void DrawSortButtonState(int widget, SortButtonState state) const;
510  static int SortButtonWidth();
511 
512  void CloseChildWindows(WindowClass wc = WC_INVALID) const;
513  virtual void Close();
514  static void DeleteClosedWindows();
515 
516  void SetDirty() const;
517  void ReInit(int rx = 0, int ry = 0);
518 
520  inline bool IsShaded() const
521  {
522  return this->shade_select != nullptr && this->shade_select->shown_plane == SZSP_HORIZONTAL;
523  }
524 
525  void SetShaded(bool make_shaded);
526 
527  void InvalidateData(int data = 0, bool gui_scope = true);
530 
531  /*** Event handling ***/
532 
537  virtual void OnInit() { }
538 
539  virtual void ApplyDefaults();
540 
548  virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number);
549 
554  virtual void OnPaint()
555  {
556  this->DrawWidgets();
557  }
558 
565  virtual void DrawWidget(const Rect &r, int widget) const {}
566 
579  virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) {}
580 
587  virtual void SetStringParameters(int widget) const {}
588 
589  virtual void OnFocus();
590 
591  virtual void OnFocusLost();
592 
600  virtual EventState OnKeyPress(WChar key, uint16 keycode) { return ES_NOT_HANDLED; }
601 
602  virtual EventState OnHotkey(int hotkey);
603 
610 
611 
618  virtual void OnClick(Point pt, int widget, int click_count) {}
619 
627  virtual bool OnRightClick(Point pt, int widget) { return false; }
628 
634  virtual void OnHover(Point pt, int widget) {}
635 
642  virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) { return false; }
643 
649  virtual void OnMouseDrag(Point pt, int widget) {}
650 
656  virtual void OnDragDrop(Point pt, int widget) {}
657 
662  virtual void OnScroll(Point delta) {}
663 
670  virtual void OnMouseOver(Point pt, int widget) {}
671 
676  virtual void OnMouseWheel(int wheel) {}
677 
678 
682  virtual void OnMouseLoop() {}
683 
687  virtual void OnGameTick() {}
688 
694  virtual void OnHundredthTick() {}
695 
699  virtual void OnRealtimeTick(uint delta_ms) {}
700 
704  virtual void OnTimeout() {}
705 
706 
711  virtual void OnResize() {}
712 
718  virtual void OnDropdownSelect(int widget, int index) {}
719 
720  virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close);
721 
726  virtual void OnEditboxChanged(int widget) {}
727 
734  virtual void OnQueryTextFinished(char *str) {}
735 
741  virtual void OnInvalidateData(int data = 0, bool gui_scope = true) {}
742 
749  virtual void OnPlaceObject(Point pt, TileIndex tile) {}
750 
756  virtual bool OnVehicleSelect(const struct Vehicle *v) { return false; }
757 
761  virtual void OnPlaceObjectAbort() {}
762 
763 
771  virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) {}
772 
782  virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) {}
783 
791  virtual void OnPlacePresize(Point pt, TileIndex tile) {}
792 
793  /*** End of the event handling ***/
794 
799  virtual bool IsNewGRFInspectable() const { return false; }
800 
807  virtual void ShowNewGRFInspectWindow() const { NOT_REACHED(); }
808 
813  template <bool TtoBack>
814  struct WindowIterator {
815  typedef Window *value_type;
816  typedef value_type *pointer;
817  typedef value_type &reference;
818  typedef size_t difference_type;
819  typedef std::forward_iterator_tag iterator_category;
820 
821  explicit WindowIterator(WindowList::iterator start) : it(start)
822  {
823  this->Validate();
824  }
825  explicit WindowIterator(const Window *w) : it(w->z_position) {}
826 
827  bool operator==(const WindowIterator &other) const { return this->it == other.it; }
828  bool operator!=(const WindowIterator &other) const { return !(*this == other); }
829  Window * operator*() const { return *this->it; }
830  WindowIterator & operator++() { this->Next(); this->Validate(); return *this; }
831 
832  bool IsEnd() const { return this->it == _z_windows.end(); }
833 
834  private:
835  WindowList::iterator it;
836  void Validate()
837  {
838  while (!this->IsEnd() && *this->it == nullptr) this->Next();
839  }
840  void Next()
841  {
842  if constexpr (!TtoBack) {
843  ++this->it;
844  } else if (this->it == _z_windows.begin()) {
845  this->it = _z_windows.end();
846  } else {
847  --this->it;
848  }
849  }
850  };
853 
858  template <bool Tfront>
859  struct AllWindows {
860  AllWindows() {}
861  WindowIterator<Tfront> begin()
862  {
863  if constexpr (Tfront) {
864  auto back = _z_windows.end();
865  if (back != _z_windows.begin()) --back;
866  return WindowIterator<Tfront>(back);
867  } else {
868  return WindowIterator<Tfront>(_z_windows.begin());
869  }
870  }
872  };
876 };
877 
884 template <class NWID>
885 inline NWID *Window::GetWidget(uint widnum)
886 {
887  if (widnum >= this->nested_array_size || this->nested_array[widnum] == nullptr) return nullptr;
888  NWID *nwid = dynamic_cast<NWID *>(this->nested_array[widnum]);
889  assert(nwid != nullptr);
890  return nwid;
891 }
892 
894 template <>
895 inline const NWidgetBase *Window::GetWidget<NWidgetBase>(uint widnum) const
896 {
897  if (widnum >= this->nested_array_size) return nullptr;
898  return this->nested_array[widnum];
899 }
900 
907 template <class NWID>
908 inline const NWID *Window::GetWidget(uint widnum) const
909 {
910  return const_cast<Window *>(this)->GetWidget<NWID>(widnum);
911 }
912 
913 
917 class PickerWindowBase : public Window {
918 
919 public:
921  {
922  this->parent = parent;
923  }
924 
925  void Close() override;
926 };
927 
929 Window *FindWindowFromPt(int x, int y);
930 
939 template <typename Wcls>
940 Wcls *AllocateWindowDescFront(WindowDesc *desc, int window_number, bool return_existing = false)
941 {
942  Wcls *w = static_cast<Wcls *>(BringWindowToFrontById(desc->cls, window_number));
943  if (w != nullptr) return return_existing ? w : nullptr;
944  return new Wcls(desc, window_number);
945 }
946 
947 void RelocateAllWindows(int neww, int newh);
948 
949 void GuiShowTooltips(Window *parent, StringID str, uint paramcount = 0, const uint64 params[] = nullptr, TooltipCloseCondition close_tooltip = TCC_HOVER);
950 
951 /* widget.cpp */
952 int GetWidgetFromPos(const Window *w, int x, int y);
953 
954 extern Point _cursorpos_drag_start;
955 
956 extern int _scrollbar_start_pos;
957 extern int _scrollbar_size;
958 extern byte _scroller_click_timeout;
959 
960 extern bool _scrolling_viewport;
961 extern bool _mouse_hovering;
962 
970 };
972 
973 void SetFocusedWindow(Window *w);
974 
975 void ScrollbarClickHandler(Window *w, NWidgetCore *nw, int x, int y);
976 
977 #endif /* WINDOW_GUI_H */
Window::WindowIterator
Iterator to iterate all valid Windows.
Definition: window_gui.h:814
ViewportData
Data structure for a window viewport.
Definition: window_gui.h:258
PickerWindowBase::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:3512
Window::SetTimeout
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
Definition: window_gui.h:360
WD_FRAMERECT_TOP
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
Definition: window_gui.h:64
WD_DEFSIZEBOX_LEFT
@ WD_DEFSIZEBOX_LEFT
Left offset of defsize sprite.
Definition: window_gui.h:106
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:83
WC_INVALID
@ WC_INVALID
Invalid window.
Definition: window_type.h:698
WD_RESIZEBOX_BOTTOM
@ WD_RESIZEBOX_BOTTOM
Bottom offset of resize sprite.
Definition: window_gui.h:116
Window::timeout_timer
uint8 timeout_timer
Timer value of the WF_TIMEOUT for flags.
Definition: window_gui.h:309
Window::OnHundredthTick
virtual void OnHundredthTick()
Called once every 100 (game) ticks, or once every 3s, whichever comes last.
Definition: window_gui.h:694
WD_MATRIX_RIGHT
@ WD_MATRIX_RIGHT
Offset at right of a matrix cell.
Definition: window_gui.h:79
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:239
Window::OnEditboxChanged
virtual void OnEditboxChanged(int widget)
The text in an editbox has been edited.
Definition: window_gui.h:726
Window::SetWhiteBorder
void SetWhiteBorder()
Set the timeout flag of the window and initiate the timer.
Definition: window_gui.h:369
SortButtonState
SortButtonState
State of a sort direction button.
Definition: window_gui.h:224
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:91
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:1129
AllocateWindowDescFront
Wcls * AllocateWindowDescFront(WindowDesc *desc, int window_number, bool return_existing=false)
Open a new window.
Definition: window_gui.h:940
Window::DrawSortButtonState
void DrawSortButtonState(int widget, SortButtonState state) const
Draw a sort button's up or down arrow symbol.
Definition: widget.cpp:670
Window::nested_root
NWidgetBase * nested_root
Root of the nested tree.
Definition: window_gui.h:324
Window::GetScrollbar
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Definition: window.cpp:320
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:210
_scrolling_viewport
bool _scrolling_viewport
A viewport is being scrolled with the mouse.
Definition: window.cpp:90
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:327
WD_SHADEBOX_BOTTOM
@ WD_SHADEBOX_BOTTOM
Bottom offset of shade sprite.
Definition: window_gui.h:88
WF_SIZING_RIGHT
@ WF_SIZING_RIGHT
Window is being resized towards the right.
Definition: window_gui.h:237
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:634
Window::ApplyDefaults
virtual void ApplyDefaults()
Read default values from WindowDesc configuration an apply them to the window.
Definition: window.cpp:193
Window::ReInit
void ReInit(int rx=0, int ry=0)
Re-initialize a window, and optionally change its size.
Definition: window.cpp:1004
Window::DrawWidget
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Definition: window_gui.h:565
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:80
ScrollbarClickHandler
void ScrollbarClickHandler(Window *w, NWidgetCore *nw, int x, int y)
Special handling for the scrollbar widget type.
Definition: widget.cpp:170
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:1439
widget_type.h
_z_windows
WindowList _z_windows
List of windows opened at the screen sorted from the front to back.
Definition: window.cpp:57
WF_DISABLE_VP_SCROLL
@ WF_DISABLE_VP_SCROLL
Window does not do autoscroll,.
Definition: window_gui.h:241
Window::viewport
ViewportData * viewport
Pointer to viewport data, if present.
Definition: window_gui.h:321
WD_STICKYBOX_TOP
@ WD_STICKYBOX_TOP
Top offset of sticky sprite.
Definition: window_gui.h:94
ViewportData::scrollpos_y
int32 scrollpos_y
Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
Definition: window_gui.h:261
FrameFlags
FrameFlags
Flags to describe the look of the frame.
Definition: window_gui.h:27
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:1760
WDP_ALIGN_TOOLBAR
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Definition: window_gui.h:158
Window::OnGameTick
virtual void OnGameTick()
Called once per (game) tick.
Definition: window_gui.h:687
WD_CLOSEBOX_RIGHT
@ WD_CLOSEBOX_RIGHT
Right offset of closebox string.
Definition: window_gui.h:121
Window::IsNewGRFInspectable
virtual bool IsNewGRFInspectable() const
Is the data related to this window NewGRF inspectable?
Definition: window_gui.h:799
WF_STICKY
@ WF_STICKY
Window is made sticky by user.
Definition: window_gui.h:240
WidgetDrawDistances
WidgetDrawDistances
Distances used in drawing widgets.
Definition: window_gui.h:38
WDF_NO_FOCUS
@ WDF_NO_FOCUS
This window won't get focus/make any other window lose focus when click.
Definition: window_gui.h:212
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:741
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:584
WD_FRAMETEXT_TOP
@ WD_FRAMETEXT_TOP
Top offset of the text of the frame.
Definition: window_gui.h:74
WD_SCROLLBAR_RIGHT
@ WD_SCROLLBAR_RIGHT
Right offset of scrollbar.
Definition: window_gui.h:51
StringAlignment
StringAlignment
How to align the to-be drawn text.
Definition: gfx_type.h:327
WD_DEFSIZEBOX_BOTTOM
@ WD_DEFSIZEBOX_BOTTOM
Bottom offset of defsize sprite.
Definition: window_gui.h:109
Window::SetWidgetHighlight
void SetWidgetHighlight(byte widget_index, TextColour highlighted_colour)
Sets the highlighted status of a widget.
Definition: window.cpp:243
WindowDesc::cls
WindowClass cls
Class of the window,.
Definition: window_gui.h:177
SZSP_HORIZONTAL
@ SZSP_HORIZONTAL
Display plane with zero size vertically, and filling and resizing horizontally.
Definition: widget_type.h:422
Window::OnTimeout
virtual void OnTimeout()
Called when this window's timeout has been reached.
Definition: window_gui.h:704
Window::owner
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
Definition: window_gui.h:319
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:293
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:31
smallmap_type.hpp
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:221
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:99
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:646
Window::GetCaretPosition
virtual Point GetCaretPosition() const
Get the current caret position if an edit box has the focus.
Definition: window.cpp:401
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:629
WD_FRAMETEXT_LEFT
@ WD_FRAMETEXT_LEFT
Left offset of the text of the frame.
Definition: window_gui.h:72
FR_TRANSPARENT
@ FR_TRANSPARENT
Makes the background transparent if set.
Definition: window_gui.h:29
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:621
Window::Window
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1799
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:971
Window::nested_focus
const NWidgetCore * nested_focus
Currently focused nested widget, or nullptr if no nested widget has focus.
Definition: window_gui.h:322
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:288
Window::IsWidgetHighlighted
bool IsWidgetHighlighted(byte widget_index) const
Gets the highlighted status of a widget.
Definition: window.cpp:276
Window::GetCaret
virtual const char * GetCaret() const
Get the string at the caret if an edit box has the focus.
Definition: window.cpp:374
WD_IMGBTN_BOTTOM
@ WD_IMGBTN_BOTTOM
Bottom offset of image in the button.
Definition: window_gui.h:43
WD_INSET_TOP
@ WD_INSET_TOP
Top offset of string.
Definition: window_gui.h:48
Window::OnCTRLStateChange
virtual EventState OnCTRLStateChange()
The state of the control key has changed.
Definition: window_gui.h:609
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:432
Window::querystrings
SmallMap< int, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
Definition: window_gui.h:323
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:782
Window::ProcessScheduledInvalidations
void ProcessScheduledInvalidations()
Process all scheduled invalidations.
Definition: window.cpp:3171
WindowDesc::default_width_trad
int16 default_width_trad
Preferred initial width of the window (pixels at 1x zoom).
Definition: window_gui.h:196
WindowDesc::default_pos
WindowPosition default_pos
Preferred position of the window.
Definition: window_gui.h:176
WindowDesc
High level window description.
Definition: window_gui.h:168
SetFocusedWindow
void SetFocusedWindow(Window *w)
Set the window that has the focus.
Definition: window.cpp:445
Window::SetStringParameters
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
Definition: window_gui.h:587
WF_SIZING_LEFT
@ WF_SIZING_LEFT
Window is being resized towards the left.
Definition: window_gui.h:238
Window::SetShaded
void SetShaded(bool make_shaded)
Set the shaded state of the window to make_shaded.
Definition: window.cpp:1040
Window::GetWidget
const NWID * GetWidget(uint widnum) const
Get the nested widget with number widnum from the nested widget tree.
Definition: window_gui.h:908
DrawCaption
void DrawCaption(const Rect &r, Colours colour, Owner owner, TextColour text_colour, StringID str, StringAlignment align)
Draw a caption bar.
Definition: widget.cpp:583
Window::OnFocusLost
virtual void OnFocusLost()
Called when window loses focus.
Definition: window.cpp:535
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:91
Window::UnfocusFocusedWidget
void UnfocusFocusedWidget()
Makes no widget on this window have focus.
Definition: window.cpp:490
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:156
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:179
WD_RESIZEBOX_RIGHT
@ WD_RESIZEBOX_RIGHT
Right offset of resize sprite.
Definition: window_gui.h:114
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:317
WSM_PRESIZE
@ WSM_PRESIZE
Presizing mode (docks, tunnels).
Definition: window_gui.h:968
WD_SHADEBOX_RIGHT
@ WD_SHADEBOX_RIGHT
Right offset of shade sprite.
Definition: window_gui.h:86
Window::EnableWidget
void EnableWidget(byte widget_index)
Sets a widget to Enabled.
Definition: window_gui.h:405
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1789
Window::ProcessHighlightedInvalidations
void ProcessHighlightedInvalidations()
Process all invalidation of highlighted widgets.
Definition: window.cpp:3183
WD_CLOSEBOX_TOP
@ WD_CLOSEBOX_TOP
Top offset of closebox string.
Definition: window_gui.h:122
Window::height
int height
Height of the window (number of pixels down in y direction)
Definition: window_gui.h:315
WF_CENTERED
@ WF_CENTERED
Window is centered and shall stay centered after ReInit.
Definition: window_gui.h:244
WF_WHITE_BORDER
@ WF_WHITE_BORDER
Window white border counter bit mask.
Definition: window_gui.h:242
SpecialMouseMode
SpecialMouseMode
Mouse modes.
Definition: window_gui.h:964
WD_INSET_RIGHT
@ WD_INSET_RIGHT
Right offset of string.
Definition: window_gui.h:47
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:993
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:1664
WD_FRAMERECT_LEFT
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:62
Window::OnFocus
virtual void OnFocus()
Called when window gains focus.
Definition: window.cpp:527
WD_PAR_VSEP_NORMAL
@ WD_PAR_VSEP_NORMAL
Normal amount of vertical space between two paragraphs of text.
Definition: window_gui.h:139
WD_FRAMERECT_RIGHT
@ WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:63
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:65
WD_DEFSIZEBOX_RIGHT
@ WD_DEFSIZEBOX_RIGHT
Right offset of defsize sprite.
Definition: window_gui.h:107
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:126
WD_FRAMETEXT_BOTTOM
@ WD_FRAMETEXT_BOTTOM
Bottom offset of the text of the frame.
Definition: window_gui.h:75
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:756
Window::HandleEditBoxKey
EventState HandleEditBoxKey(int wid, WChar key, uint16 keycode)
Process keypress for editbox widget.
Definition: window.cpp:2521
Window::DisableAllWidgetHighlight
void DisableAllWidgetHighlight()
Disable the highlighted status of all widgets.
Definition: window.cpp:223
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:749
Window::OnDropdownSelect
virtual void OnDropdownSelect(int widget, int index)
A dropdown option associated to this window has been selected.
Definition: window_gui.h:718
Window::GetQueryString
const QueryString * GetQueryString(uint widnum) const
Return the querystring associated to a editbox.
Definition: window.cpp:340
WindowDesc::GetDefaultWidth
int16 GetDefaultWidth() const
Determine default width of window.
Definition: window.cpp:136
Window::SetWidgetDisabledState
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Definition: window_gui.h:386
Window::DeleteClosedWindows
static void DeleteClosedWindows()
Delete all closed windows.
Definition: window.cpp:65
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:332
WD_STICKYBOX_RIGHT
@ WD_STICKYBOX_RIGHT
Right offset of sticky sprite.
Definition: window_gui.h:93
Window::IsWidgetGloballyFocused
bool IsWidgetGloballyFocused(byte widget_index) const
Check if given widget has user input focus.
Definition: window_gui.h:437
Window::left
int left
x position of left edge of the window
Definition: window_gui.h:312
Window::OnDragDrop
virtual void OnDragDrop(Point pt, int widget)
A dragged 'object' has been released.
Definition: window_gui.h:656
Window::flags
WindowFlags flags
Window flags.
Definition: window_gui.h:305
DrawFrameRect
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
Draw frame rectangle.
Definition: widget.cpp:209
WF_TIMEOUT
@ WF_TIMEOUT
Window timeout counter.
Definition: window_gui.h:234
WD_INSET_LEFT
@ WD_INSET_LEFT
Left offset of string.
Definition: window_gui.h:46
WindowClass
WindowClass
Window classes.
Definition: window_type.h:36
Window::ShowNewGRFInspectWindow
virtual void ShowNewGRFInspectWindow() const
Show the NewGRF inspection window.
Definition: window_gui.h:807
WindowDesc::default_height_trad
int16 default_height_trad
Preferred initial height of the window (pixels at 1x zoom).
Definition: window_gui.h:197
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:194
WD_DEBUGBOX_RIGHT
@ WD_DEBUGBOX_RIGHT
Right offset of debug sprite.
Definition: window_gui.h:100
WDF_MODAL
@ WDF_MODAL
The window is a modal child of some other window, meaning the parent is 'inactive'.
Definition: window_gui.h:211
WindowDesc::GetDefaultHeight
int16 GetDefaultHeight() const
Determine default height of window.
Definition: window.cpp:146
TIMEOUT_DURATION
static const int TIMEOUT_DURATION
The initial timeout value for WF_TIMEOUT.
Definition: window_gui.h:248
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:243
WindowDesc::nwid_parts
const NWidgetPart * nwid_parts
Nested widget parts describing the window.
Definition: window_gui.h:181
WindowDefaultFlag
WindowDefaultFlag
Window default widget/window handling flags.
Definition: window_gui.h:209
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:263
Window::IsWidgetFocused
bool IsWidgetFocused(byte widget_index) const
Check if given widget is focused within this window.
Definition: window_gui.h:426
WSM_DRAGDROP
@ WSM_DRAGDROP
Drag&drop an object.
Definition: window_gui.h:966
Window::OnInit
virtual void OnInit()
Notification that the nested widget tree gets initialized.
Definition: window_gui.h:537
WSM_SIZING
@ WSM_SIZING
Sizing mode.
Definition: window_gui.h:967
Window::unshaded_size
Dimension unshaded_size
Last known unshaded size (only valid while shaded).
Definition: window_gui.h:328
WindowDesc::SaveToConfig
static void SaveToConfig()
Save all WindowDesc settings to _windows_file.
Definition: window.cpp:176
string_type.h
WD_FRAMETEXT_RIGHT
@ WD_FRAMETEXT_RIGHT
Right offset of the text of the frame.
Definition: window_gui.h:73
Window::SetFocusedWidget
bool SetFocusedWidget(int widget_index)
Set focus within this window to the given widget.
Definition: window.cpp:506
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:307
WD_DROPDOWNTEXT_RIGHT
@ WD_DROPDOWNTEXT_RIGHT
Right offset of the dropdown widget string.
Definition: window_gui.h:135
WD_SCROLLBAR_LEFT
@ WD_SCROLLBAR_LEFT
Left offset of scrollbar.
Definition: window_gui.h:50
ResizeInfo::step_height
uint step_height
Step-size of height resize changes.
Definition: window_gui.h:220
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:105
WindowFlags
WindowFlags
Window flags.
Definition: window_gui.h:233
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:3158
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:330
NWidgetStacked
Stacked widgets, widgets all occupying the same space in the window.
Definition: widget_type.h:438
Window::AllWindows
Iterable ensemble of all valid Windows.
Definition: window_gui.h:859
Window::nested_array
NWidgetBase ** nested_array
Array of pointers into the tree. Do not access directly, use Window::GetWidget() instead.
Definition: window_gui.h:325
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:791
WD_SHADEBOX_TOP
@ WD_SHADEBOX_TOP
Top offset of shade sprite.
Definition: window_gui.h:87
WD_SCROLLBAR_BOTTOM
@ WD_SCROLLBAR_BOTTOM
Bottom offset of scrollbar.
Definition: window_gui.h:53
WD_DROPDOWNTEXT_TOP
@ WD_DROPDOWNTEXT_TOP
Top offset of the dropdown widget string.
Definition: window_gui.h:136
WD_SHADEBOX_LEFT
@ WD_SHADEBOX_LEFT
Left offset of shade sprite.
Definition: window_gui.h:85
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:618
SBS_DOWN
@ SBS_DOWN
Sort ascending.
Definition: window_gui.h:226
ViewportData::scrollpos_x
int32 scrollpos_x
Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
Definition: window_gui.h:260
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:682
WD_DROPDOWN_HEIGHT
@ WD_DROPDOWN_HEIGHT
Height of a drop down widget.
Definition: window_gui.h:133
WindowDesc::nwid_length
int16 nwid_length
Length of the nwid_parts array.
Definition: window_gui.h:182
ResizeInfo::step_width
uint step_width
Step-size of width resize changes.
Definition: window_gui.h:219
Window::OnMouseWheel
virtual void OnMouseWheel(int wheel)
The mouse wheel has been turned.
Definition: window_gui.h:676
WindowDesc::flags
uint32 flags
Flags.
Definition: window_gui.h:180
Window::IsShaded
bool IsShaded() const
Is window shaded currently?
Definition: window_gui.h:520
Window::OnPlaceObjectAbort
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
Definition: window_gui.h:761
ResizeInfo
Data structure for resizing a window.
Definition: window_gui.h:218
WD_CLOSEBOX_WIDTH
@ WD_CLOSEBOX_WIDTH
Width of a close box widget.
Definition: window_gui.h:119
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:767
Window::closed_windows
static std::vector< Window * > closed_windows
List of closed windows to delete.
Definition: window_gui.h:281
Window::CloseChildWindows
void CloseChildWindows(WindowClass wc=WC_INVALID) const
Close all children a window might have in a head-recursive manner.
Definition: window.cpp:1080
WD_BEVEL_RIGHT
@ WD_BEVEL_RIGHT
Width of right bevel border.
Definition: window_gui.h:57
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:566
WD_CAPTIONTEXT_TOP
@ WD_CAPTIONTEXT_TOP
Offset of the caption text at the top.
Definition: window_gui.h:129
Window::OnTooltip
virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond)
Event to display a custom tooltip.
Definition: window_gui.h:642
WD_DEFSIZEBOX_WIDTH
@ WD_DEFSIZEBOX_WIDTH
Width of a standard defsize box widget.
Definition: window_gui.h:105
WD_SHADEBOX_WIDTH
@ WD_SHADEBOX_WIDTH
Width of a standard shade box widget.
Definition: window_gui.h:84
WD_DEBUGBOX_WIDTH
@ WD_DEBUGBOX_WIDTH
Width of a standard debug box widget.
Definition: window_gui.h:98
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:417
WD_DEBUGBOX_BOTTOM
@ WD_DEBUGBOX_BOTTOM
Bottom offset of debug sprite.
Definition: window_gui.h:102
WD_SCROLLBAR_TOP
@ WD_SCROLLBAR_TOP
Top offset of scrollbar.
Definition: window_gui.h:52
Window::OnPaint
virtual void OnPaint()
The window must be repainted.
Definition: window_gui.h:554
Window::SetWidgetsDisabledState
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
Definition: window.cpp:547
Window::IsWidgetLowered
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:487
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:670
EventState
EventState
State of handling an event.
Definition: window_type.h:717
WindowDesc::pref_sticky
bool pref_sticky
Preferred stickyness.
Definition: window_gui.h:185
WF_DRAGGING
@ WF_DRAGGING
Window is being dragged.
Definition: window_gui.h:236
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:579
WD_IMGBTN_TOP
@ WD_IMGBTN_TOP
Top offset of image in the button.
Definition: window_gui.h:42
WD_RESIZEBOX_WIDTH
@ WD_RESIZEBOX_WIDTH
Width of a resize box widget.
Definition: window_gui.h:112
WSM_DRAGGING
@ WSM_DRAGGING
Dragging mode (trees).
Definition: window_gui.h:969
Window::window_class
WindowClass window_class
Window class.
Definition: window_gui.h:306
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1776
WD_STICKYBOX_BOTTOM
@ WD_STICKYBOX_BOTTOM
Bottom offset of sticky sprite.
Definition: window_gui.h:95
PickerWindowBase
Base class for windows opened from a toolbar.
Definition: window_gui.h:917
_special_mouse_mode
SpecialMouseMode _special_mouse_mode
Mode of the mouse.
Definition: window.cpp:93
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:313
Window::DrawViewport
void DrawViewport() const
Draw the viewport of this window.
Definition: viewport.cpp:1814
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:249
WD_BEVEL_TOP
@ WD_BEVEL_TOP
Height of top bevel border.
Definition: window_gui.h:58
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:649
WD_BEVEL_LEFT
@ WD_BEVEL_LEFT
Width of left bevel border.
Definition: window_gui.h:56
ViewportData::follow_vehicle
VehicleID follow_vehicle
VehicleID to follow if following a vehicle, INVALID_VEHICLE otherwise.
Definition: window_gui.h:259
WD_MATRIX_BOTTOM
@ WD_MATRIX_BOTTOM
Offset at bottom of a matrix cell.
Definition: window_gui.h:81
Window::OnInitialPosition
virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
Compute the initial position of the window.
Definition: window.cpp:1748
Window::ToggleWidgetLoweredState
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
Definition: window_gui.h:457
Window::width
int width
width of the window (number of pixels to the right in x direction)
Definition: window_gui.h:314
WindowDesc::LoadFromConfig
static void LoadFromConfig()
Load all WindowDesc settings from _windows_file.
Definition: window.cpp:154
RelocateAllWindows
void RelocateAllWindows(int neww, int newh)
Relocate all windows to fit the new size of the game application screen.
Definition: window.cpp:3443
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:262
WD_CAPTIONTEXT_BOTTOM
@ WD_CAPTIONTEXT_BOTTOM
Offset of the caption text at the bottom.
Definition: window_gui.h:130
WDP_MANUAL
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
Definition: window_gui.h:155
Window::SortButtonWidth
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
Definition: widget.cpp:690
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:32
WD_RESIZEBOX_TOP
@ WD_RESIZEBOX_TOP
Top offset of resize sprite.
Definition: window_gui.h:115
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:2663
Window::window_desc
WindowDesc * window_desc
Window description.
Definition: window_gui.h:304
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:771
Window::OnRealtimeTick
virtual void OnRealtimeTick(uint delta_ms)
Called periodically.
Definition: window_gui.h:699
WD_DEBUGBOX_TOP
@ WD_DEBUGBOX_TOP
Top offset of debug sprite.
Definition: window_gui.h:101
WD_CAPTION_HEIGHT
@ WD_CAPTION_HEIGHT
Height of a title bar.
Definition: window_gui.h:126
WD_DROPDOWNTEXT_BOTTOM
@ WD_DROPDOWNTEXT_BOTTOM
Bottom offset of the dropdown widget string.
Definition: window_gui.h:137
WindowDesc::parent_cls
WindowClass parent_cls
Class of the parent window.
Definition: window_gui.h:178
Window
Data structure for an opened window.
Definition: window_gui.h:279
WD_CAPTIONTEXT_LEFT
@ WD_CAPTIONTEXT_LEFT
Offset of the caption text at the left.
Definition: window_gui.h:127
Window::RaiseWidget
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Definition: window_gui.h:477
WD_MATRIX_LEFT
@ WD_MATRIX_LEFT
Offset at left of a matrix cell.
Definition: window_gui.h:78
viewport_type.h
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:636
FindWindowFromPt
Window * FindWindowFromPt(int x, int y)
Do a search for a window at specific coordinates.
Definition: window.cpp:1811
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:627
Window::OnQueryTextFinished
virtual void OnQueryTextFinished(char *str)
The query window opened from this window has closed.
Definition: window_gui.h:734
Window::OnScroll
virtual void OnScroll(Point delta)
Handle the request for (viewport) scrolling.
Definition: window_gui.h:662
WD_DROPDOWNTEXT_LEFT
@ WD_DROPDOWNTEXT_LEFT
Left offset of the dropdown widget string.
Definition: window_gui.h:134
SBS_UP
@ SBS_UP
Sort descending.
Definition: window_gui.h:227
WD_IMGBTN_LEFT
@ WD_IMGBTN_LEFT
Left offset of the image in the button.
Definition: window_gui.h:40
SBS_OFF
@ SBS_OFF
Do not sort (with this button).
Definition: window_gui.h:225
Window::nested_array_size
uint nested_array_size
Size of the nested array.
Definition: window_gui.h:326
NWidgetCore::index
int index
Index of the nested widget in the widget array of the window (-1 means 'not used').
Definition: widget_type.h:334
Window::IsWidgetDisabled
bool IsWidgetDisabled(byte widget_index) const
Gets the enabled/disabled status of a widget.
Definition: window_gui.h:415
NWidgetCore
Base class for a 'real' widget.
Definition: widget_type.h:311
Window::SetWidgetDirty
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Definition: window.cpp:608
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:468
WD_CLOSEBOX_BOTTOM
@ WD_CLOSEBOX_BOTTOM
Bottom offset of closebox string.
Definition: window_gui.h:123
Window::GetMarkedText
virtual const char * GetMarkedText(size_t *length) const
Get the range of the currently marked input text.
Definition: window.cpp:388
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:212
Window::OnResize
virtual void OnResize()
Called after the window got resized.
Definition: window_gui.h:711
Window::DisableWidget
void DisableWidget(byte widget_index)
Sets a widget to disabled.
Definition: window_gui.h:396
WD_BEVEL_BOTTOM
@ WD_BEVEL_BOTTOM
Height of bottom bevel border.
Definition: window_gui.h:59
WindowDesc::hotkeys
HotkeyList * hotkeys
Hotkeys for the window.
Definition: window_gui.h:183
NWidgetStacked::shown_plane
int shown_plane
Plane being displayed (for NWID_SELECTION only).
Definition: widget_type.h:454
WD_PAR_VSEP_WIDE
@ WD_PAR_VSEP_WIDE
Large amount of vertical space between two paragraphs of text.
Definition: window_gui.h:140
WindowPosition
WindowPosition
How do we the window to be placed?
Definition: window_gui.h:154
WD_IMGBTN_RIGHT
@ WD_IMGBTN_RIGHT
Right offset of the image in the button.
Definition: window_gui.h:41
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition: window_gui.h:157
Window::SetWidgetLoweredState
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:447
company_type.h
WindowDesc::pref_height
int16 pref_height
User-preferred height of the window. Zero if unset.
Definition: window_gui.h:187
WD_CLOSEBOX_LEFT
@ WD_CLOSEBOX_LEFT
Left offset of closebox string.
Definition: window_gui.h:120
Window::white_border_timer
uint8 white_border_timer
Timer value of the WF_WHITE_BORDER for flags.
Definition: window_gui.h:310
WD_TEXTPANEL_BOTTOM
@ WD_TEXTPANEL_BOTTOM
Offset at bottom to draw below the text.
Definition: window_gui.h:69
WD_RESIZEBOX_LEFT
@ WD_RESIZEBOX_LEFT
Left offset of resize sprite.
Definition: window_gui.h:113
WSM_NONE
@ WSM_NONE
No special mouse mode.
Definition: window_gui.h:965
WD_STICKYBOX_LEFT
@ WD_STICKYBOX_LEFT
Left offset of sticky sprite.
Definition: window_gui.h:92
WindowDesc::pref_width
int16 pref_width
User-preferred width of the window. Zero if unset.
Definition: window_gui.h:186
Window::InitializeData
void InitializeData(WindowNumber window_number)
Initializes the data (except the position and initial size) of a new Window.
Definition: window.cpp:1397
FR_BORDERONLY
@ FR_BORDERONLY
Draw border only, no background.
Definition: window_gui.h:30
Window::GetFocusedText
virtual const char * GetFocusedText() const
Get the current input text if an edit box has the focus.
Definition: window.cpp:361
WD_CAPTIONTEXT_RIGHT
@ WD_CAPTIONTEXT_RIGHT
Offset of the caption text at the right.
Definition: window_gui.h:128
WD_TEXTPANEL_TOP
@ WD_TEXTPANEL_TOP
Offset at top to draw above the text.
Definition: window_gui.h:68
Window::FindWindowPlacementAndResize
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
Resize window towards the default size.
Definition: window.cpp:1457
WD_DEFSIZEBOX_TOP
@ WD_DEFSIZEBOX_TOP
Top offset of defsize sprite.
Definition: window_gui.h:108
Window::OnKeyPress
virtual EventState OnKeyPress(WChar key, uint16 keycode)
A key has been pressed.
Definition: window_gui.h:600
Window::Close
virtual void Close()
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:1092
BringWindowToFrontById
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
Definition: window.cpp:1259