OpenTTD Source: src/window_gui.h Source File

OpenTTD Source 13.1

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 #include <algorithm>
15 #include <functional>
16
17 #include "vehiclelist.h"
18 #include "vehicle_type.h"
19 #include "viewport_type.h"
20 #include "company_type.h"
21 #include "tile_type.h"
22 #include "widget_type.h"
23 #include "core/smallvec_type.hpp"
24 #include "core/smallmap_type.hpp"
25 #include "string_type.h"
26
30 enum FrameFlags {
31 FR_NONE = 0,
32 FR_TRANSPARENT = 1 << 0,
33 FR_BORDERONLY = 1 << 4,
34 FR_LOWERED = 1 << 5,
35 FR_DARKENED = 1 << 6,
36 };
37
38 DECLARE_ENUM_AS_BIT_SET(FrameFlags)
39
40 struct WidgetDimensions {
41 RectPadding imgbtn;
42 RectPadding inset;
43 RectPadding vscrollbar;
44 RectPadding hscrollbar;
45 RectPadding bevel;
46 RectPadding fullbevel;
47 RectPadding framerect;
48 RectPadding frametext;
49 RectPadding matrix;
50 RectPadding shadebox;
51 RectPadding stickybox;
52 RectPadding debugbox;
53 RectPadding defsizebox;
54 RectPadding resizebox;
55 RectPadding closebox;
56 RectPadding captiontext;
57 RectPadding dropdowntext;
58 RectPadding modalpopup;
59
60 int pressed;
61 int vsep_normal;
62 int vsep_wide;
63 int hsep_normal;
64 int hsep_wide;
65 int hsep_indent;
66
67 static const WidgetDimensions unscaled;
68 static WidgetDimensions scaled;
69 };
70
71 /* widget.cpp */
72 void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags);
73
74 static inline void DrawFrameRect(const Rect &r, Colours colour, FrameFlags flags)
75 {
76 DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, flags);
77 }
78
79 void DrawCaption(const Rect &r, Colours colour, Owner owner, TextColour text_colour, StringID str, StringAlignment align);
80
81 /* window.cpp */
82 using WindowList = std::list<Window *>;
83 extern WindowList _z_windows;
84 extern Window *_focused_window;
85
86
88 enum WindowPosition {
89 WDP_MANUAL,
90 WDP_AUTO,
91 WDP_CENTER,
92 WDP_ALIGN_TOOLBAR,
93 };
94
95 Point GetToolbarAlignedWindowPosition(int window_width);
96
97 struct HotkeyList;
98
102 struct WindowDesc : ZeroedMemoryAllocator {
103
104 WindowDesc(WindowPosition default_pos, const char *ini_key, int16 def_width_trad, int16 def_height_trad,
105 WindowClass window_class, WindowClass parent_class, uint32 flags,
106 const NWidgetPart *nwid_parts, int16 nwid_length, HotkeyList *hotkeys = nullptr);
107
108 ~WindowDesc();
109
110 WindowPosition default_pos;
111 WindowClass cls;
112 WindowClass parent_cls;
113 const char *ini_key;
114 uint32 flags;
115 const NWidgetPart *nwid_parts;
116 int16 nwid_length;
117 HotkeyList *hotkeys;
118
119 bool pref_sticky;
120 int16 pref_width;
121 int16 pref_height;
122
123 int16 GetDefaultWidth() const;
124 int16 GetDefaultHeight() const;
125
126 static void LoadFromConfig();
127 static void SaveToConfig();
128
129 private:
130 int16 default_width_trad;
131 int16 default_height_trad;
132
137 WindowDesc(const WindowDesc &other);
138 };
139
143 enum WindowDefaultFlag {
144 WDF_CONSTRUCTION = 1 << 0,
145 WDF_MODAL = 1 << 1,
146 WDF_NO_FOCUS = 1 << 2,
147 };
148
152 struct ResizeInfo {
153 uint step_width;
154 uint step_height;
155 };
156
158 enum SortButtonState {
159 SBS_OFF,
160 SBS_DOWN,
161 SBS_UP,
162 };
163
167 enum WindowFlags {
168 WF_TIMEOUT = 1 << 0,
169
170 WF_DRAGGING = 1 << 3,
171 WF_SIZING_RIGHT = 1 << 4,
172 WF_SIZING_LEFT = 1 << 5,
173 WF_SIZING = WF_SIZING_RIGHT | WF_SIZING_LEFT,
174 WF_STICKY = 1 << 6,
175 WF_DISABLE_VP_SCROLL = 1 << 7,
176 WF_WHITE_BORDER = 1 << 8,
177 WF_HIGHLIGHTED = 1 << 9,
178 WF_CENTERED = 1 << 10,
179 };
180 DECLARE_ENUM_AS_BIT_SET(WindowFlags)
181
182 static const int TIMEOUT_DURATION = 7;
183 static const int WHITE_BORDER_DURATION = 3;
184
192 struct ViewportData : Viewport {
193 VehicleID follow_vehicle;
194 int32 scrollpos_x;
195 int32 scrollpos_y;
196 int32 dest_scrollpos_x;
197 int32 dest_scrollpos_y;
198 };
199
200 struct QueryString;
201
202 /* misc_gui.cpp */
203 enum TooltipCloseCondition {
204 TCC_RIGHT_CLICK,
205 TCC_HOVER,
206 TCC_NONE,
207 TCC_EXIT_VIEWPORT,
208 };
209
213 struct Window : ZeroedMemoryAllocator {
214 private:
215 static std::vector<Window *> closed_windows;
216
217 protected:
218 void InitializeData(WindowNumber window_number);
219 void InitializePositionSize(int x, int y, int min_width, int min_height);
220 virtual void FindWindowPlacementAndResize(int def_width, int def_height);
221
222 std::vector<int> scheduled_invalidation_data;
223
224 /* Protected to prevent deletion anywhere outside Window::DeleteClosedWindows(). */
225 virtual ~Window();
226
227 public:
228 Window(WindowDesc *desc);
229
236 inline void *operator new[](size_t size) = delete;
237
238 WindowDesc *window_desc;
239 WindowFlags flags;
240 WindowClass window_class;
241 WindowNumber window_number;
242
243 uint8 timeout_timer;
244 uint8 white_border_timer;
245
246 int left;
247 int top;
248 int width;
249 int height;
250
251 ResizeInfo resize;
252
253 Owner owner;
254
255 ViewportData *viewport;
256 const NWidgetCore *nested_focus;
257 SmallMap<int, QueryString*> querystrings;
258 NWidgetBase *nested_root;
259 NWidgetBase **nested_array;
260 uint nested_array_size;
261 NWidgetStacked *shade_select;
262 Dimension unshaded_size;
263
264 int mouse_capture_widget;
265
266 Window *parent;
267 WindowList::iterator z_position;
268
269 template <class NWID>
270 inline const NWID *GetWidget(uint widnum) const;
271 template <class NWID>
272 inline NWID *GetWidget(uint widnum);
273
274 const Scrollbar *GetScrollbar(uint widnum) const;
275 Scrollbar *GetScrollbar(uint widnum);
276
277 const QueryString *GetQueryString(uint widnum) const;
278 QueryString *GetQueryString(uint widnum);
279 void UpdateQueryStringSize();
280
281 virtual const char *GetFocusedText() const;
282 virtual const char *GetCaret() const;
283 virtual const char *GetMarkedText(size_t *length) const;
284 virtual Point GetCaretPosition() const;
285 virtual Rect GetTextBoundingRect(const char *from, const char *to) const;
286 virtual const char *GetTextCharacterAtPosition(const Point &pt) const;
287
288 void InitNested(WindowNumber number = 0);
289 void CreateNestedTree(bool fill_nested = true);
290 void FinishInitNested(WindowNumber window_number = 0);
291
295 inline void SetTimeout()
296 {
297 this->flags |= WF_TIMEOUT;
298 this->timeout_timer = TIMEOUT_DURATION;
299 }
300
304 inline void SetWhiteBorder()
305 {
306 this->flags |= WF_WHITE_BORDER;
307 this->white_border_timer = WHITE_BORDER_DURATION;
308 }
309
310 void DisableAllWidgetHighlight();
311 void SetWidgetHighlight(byte widget_index, TextColour highlighted_colour);
312 bool IsWidgetHighlighted(byte widget_index) const;
313
321 inline void SetWidgetDisabledState(byte widget_index, bool disab_stat)
322 {
323 assert(widget_index < this->nested_array_size);
324 if (this->nested_array[widget_index] != nullptr) this->GetWidget<NWidgetCore>(widget_index)->SetDisabled(disab_stat);
325 }
326
331 inline void DisableWidget(byte widget_index)
332 {
333 SetWidgetDisabledState(widget_index, true);
334 }
335
340 inline void EnableWidget(byte widget_index)
341 {
342 SetWidgetDisabledState(widget_index, false);
343 }
344
350 inline bool IsWidgetDisabled(byte widget_index) const
351 {
352 assert(widget_index < this->nested_array_size);
353 return this->GetWidget<NWidgetCore>(widget_index)->IsDisabled();
354 }
355
361 inline bool IsWidgetFocused(byte widget_index) const
362 {
363 return this->nested_focus != nullptr && this->nested_focus->index == widget_index;
364 }
365
372 inline bool IsWidgetGloballyFocused(byte widget_index) const
373 {
374 return _focused_window == this && IsWidgetFocused(widget_index);
375 }
376
382 inline void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
383 {
384 assert(widget_index < this->nested_array_size);
385 this->GetWidget<NWidgetCore>(widget_index)->SetLowered(lowered_stat);
386 }
387
392 inline void ToggleWidgetLoweredState(byte widget_index)
393 {
394 assert(widget_index < this->nested_array_size);
395 bool lowered_state = this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
396 this->GetWidget<NWidgetCore>(widget_index)->SetLowered(!lowered_state);
397 }
398
403 inline void LowerWidget(byte widget_index)
404 {
405 SetWidgetLoweredState(widget_index, true);
406 }
407
412 inline void RaiseWidget(byte widget_index)
413 {
414 SetWidgetLoweredState(widget_index, false);
415 }
416
422 inline bool IsWidgetLowered(byte widget_index) const
423 {
424 assert(widget_index < this->nested_array_size);
425 return this->GetWidget<NWidgetCore>(widget_index)->IsLowered();
426 }
427
428 void UnfocusFocusedWidget();
429 bool SetFocusedWidget(int widget_index);
430
431 EventState HandleEditBoxKey(int wid, WChar key, uint16 keycode);
432 virtual void InsertTextString(int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end);
433
434 void HandleButtonClick(byte widget);
435 int GetRowFromWidget(int clickpos, int widget, int padding, int line_height = -1) const;
436
437 void RaiseButtons(bool autoraise = false);
438 void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...);
439 void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
440 void SetWidgetDirty(byte widget_index) const;
441
442 void DrawWidgets() const;
443 void DrawViewport() const;
444 void DrawSortButtonState(int widget, SortButtonState state) const;
445 static int SortButtonWidth();
446
447 void CloseChildWindows(WindowClass wc = WC_INVALID) const;
448 virtual void Close();
449 static void DeleteClosedWindows();
450
451 void SetDirty() const;
452 void ReInit(int rx = 0, int ry = 0);
453
455 inline bool IsShaded() const
456 {
457 return this->shade_select != nullptr && this->shade_select->shown_plane == SZSP_HORIZONTAL;
458 }
459
460 void SetShaded(bool make_shaded);
461
462 void InvalidateData(int data = 0, bool gui_scope = true);
463 void ProcessScheduledInvalidations();
464 void ProcessHighlightedInvalidations();
465
466 /*** Event handling ***/
467
472 virtual void OnInit() { }
473
474 virtual void ApplyDefaults();
475
483 virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number);
484
489 virtual void OnPaint()
490 {
491 this->DrawWidgets();
492 }
493
500 virtual void DrawWidget(const Rect &r, int widget) const {}
501
514 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) {}
515
522 virtual void SetStringParameters(int widget) const {}
523
524 virtual void OnFocus();
525
526 virtual void OnFocusLost();
527
535 virtual EventState OnKeyPress(WChar key, uint16 keycode) { return ES_NOT_HANDLED; }
536
537 virtual EventState OnHotkey(int hotkey);
538
544 virtual EventState OnCTRLStateChange() { return ES_NOT_HANDLED; }
545
546
553 virtual void OnClick(Point pt, int widget, int click_count) {}
554
562 virtual bool OnRightClick(Point pt, int widget) { return false; }
563
569 virtual void OnHover(Point pt, int widget) {}
570
577 virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) { return false; }
578
584 virtual void OnMouseDrag(Point pt, int widget) {}
585
591 virtual void OnDragDrop(Point pt, int widget) {}
592
597 virtual void OnScroll(Point delta) {}
598
605 virtual void OnMouseOver(Point pt, int widget) {}
606
611 virtual void OnMouseWheel(int wheel) {}
612
613
617 virtual void OnMouseLoop() {}
618
622 virtual void OnGameTick() {}
623
629 virtual void OnHundredthTick() {}
630
634 virtual void OnRealtimeTick(uint delta_ms) {}
635
639 virtual void OnTimeout() {}
640
641
646 virtual void OnResize() {}
647
653 virtual void OnDropdownSelect(int widget, int index) {}
654
655 virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close);
656
661 virtual void OnEditboxChanged(int widget) {}
662
669 virtual void OnQueryTextFinished(char *str) {}
670
676 virtual void OnInvalidateData(int data = 0, bool gui_scope = true) {}
677
684 virtual void OnPlaceObject(Point pt, TileIndex tile) {}
685
692 virtual bool OnVehicleSelect(const struct Vehicle *v) { return false; }
693
700 virtual bool OnVehicleSelect(VehicleList::const_iterator begin, VehicleList::const_iterator end) { return false; }
701
705 virtual void OnPlaceObjectAbort() {}
706
707
715 virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) {}
716
726 virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) {}
727
735 virtual void OnPlacePresize(Point pt, TileIndex tile) {}
736
737 /*** End of the event handling ***/
738
743 virtual bool IsNewGRFInspectable() const { return false; }
744
751 virtual void ShowNewGRFInspectWindow() const { NOT_REACHED(); }
752
757 template <bool TtoBack>
758 struct WindowIterator {
759 typedef Window *value_type;
760 typedef value_type *pointer;
761 typedef value_type &reference;
762 typedef size_t difference_type;
763 typedef std::forward_iterator_tag iterator_category;
764
765 explicit WindowIterator(WindowList::iterator start) : it(start)
766 {
767 this->Validate();
768 }
769 explicit WindowIterator(const Window *w) : it(w->z_position) {}
770
771 bool operator==(const WindowIterator &other) const { return this->it == other.it; }
772 bool operator!=(const WindowIterator &other) const { return !(*this == other); }
773 Window * operator*() const { return *this->it; }
774 WindowIterator & operator++() { this->Next(); this->Validate(); return *this; }
775
776 bool IsEnd() const { return this->it == _z_windows.end(); }
777
778 private:
779 WindowList::iterator it;
780 void Validate()
781 {
782 while (!this->IsEnd() && *this->it == nullptr) this->Next();
783 }
784 void Next()
785 {
786 if constexpr (!TtoBack) {
787 ++this->it;
788 } else if (this->it == _z_windows.begin()) {
789 this->it = _z_windows.end();
790 } else {
791 --this->it;
792 }
793 }
794 };
795 using IteratorToFront = WindowIterator<false>;
796 using IteratorToBack = WindowIterator<true>;
797
802 template <bool Tfront>
803 struct AllWindows {
804 AllWindows() {}
805 WindowIterator<Tfront> begin()
806 {
807 if constexpr (Tfront) {
808 auto back = _z_windows.end();
809 if (back != _z_windows.begin()) --back;
810 return WindowIterator<Tfront>(back);
811 } else {
812 return WindowIterator<Tfront>(_z_windows.begin());
813 }
814 }
815 WindowIterator<Tfront> end() { return WindowIterator<Tfront>(_z_windows.end()); }
816 };
817 using Iterate = AllWindows<false>;
818 using IterateFromBack = AllWindows<false>;
819 using IterateFromFront = AllWindows<true>;
820 };
821
829 template <class It, class Pred>
830 inline bool AllEqual(It begin, It end, Pred pred)
831 {
832 return std::adjacent_find(begin, end, std::not_fn(pred)) == end;
833 }
834
841 template <class NWID>
842 inline NWID *Window::GetWidget(uint widnum)
843 {
844 if (widnum >= this->nested_array_size || this->nested_array[widnum] == nullptr) return nullptr;
845 NWID *nwid = dynamic_cast<NWID *>(this->nested_array[widnum]);
846 assert(nwid != nullptr);
847 return nwid;
848 }
849
851 template <>
852 inline const NWidgetBase *Window::GetWidget<NWidgetBase>(uint widnum) const
853 {
854 if (widnum >= this->nested_array_size) return nullptr;
855 return this->nested_array[widnum];
856 }
857
864 template <class NWID>
865 inline const NWID *Window::GetWidget(uint widnum) const
866 {
867 return const_cast<Window *>(this)->GetWidget<NWID>(widnum);
868 }
869
870
874 class PickerWindowBase : public Window {
875
876 public:
877 PickerWindowBase(WindowDesc *desc, Window *parent) : Window(desc)
878 {
879 this->parent = parent;
880 }
881
882 void Close() override;
883 };
884
885 Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
886 Window *FindWindowFromPt(int x, int y);
887
896 template <typename Wcls>
897 Wcls *AllocateWindowDescFront(WindowDesc *desc, int window_number, bool return_existing = false)
898 {
899 Wcls *w = static_cast<Wcls *>(BringWindowToFrontById(desc->cls, window_number));
900 if (w != nullptr) return return_existing ? w : nullptr;
901 return new Wcls(desc, window_number);
902 }
903
904 void RelocateAllWindows(int neww, int newh);
905
906 void GuiShowTooltips(Window *parent, StringID str, uint paramcount = 0, const uint64 params[] = nullptr, TooltipCloseCondition close_tooltip = TCC_HOVER);
907
908 /* widget.cpp */
909 int GetWidgetFromPos(const Window *w, int x, int y);
910
911 extern Point _cursorpos_drag_start;
912
913 extern int _scrollbar_start_pos;
914 extern int _scrollbar_size;
915 extern byte _scroller_click_timeout;
916
917 extern bool _scrolling_viewport;
918 extern bool _mouse_hovering;
919
921 enum SpecialMouseMode {
922 WSM_NONE,
923 WSM_DRAGDROP,
924 WSM_SIZING,
925 WSM_PRESIZE,
926 WSM_DRAGGING,
927 };
928 extern SpecialMouseMode _special_mouse_mode;
929
930 void SetFocusedWindow(Window *w);
931
932 void ScrollbarClickHandler(Window *w, NWidgetCore *nw, int x, int y);
933
934 #endif /* WINDOW_GUI_H */
Window::WindowIterator
Iterator to iterate all valid Windows.
Definition: window_gui.h:758
ViewportData
Data structure for a window viewport.
Definition: window_gui.h:192
PickerWindowBase::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:3561
Window::SetTimeout
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
Definition: window_gui.h:295
WC_INVALID
@ WC_INVALID
Invalid window.
Definition: window_type.h:700
Window::timeout_timer
uint8 timeout_timer
Timer value of the WF_TIMEOUT for flags.
Definition: window_gui.h:243
Window::OnHundredthTick
virtual void OnHundredthTick()
Called once every 100 (game) ticks, or once every 3s, whichever comes last.
Definition: window_gui.h:629
WChar
char32_t WChar
Type for wide characters, i.e.
Definition: string_type.h:36
WF_SIZING
@ WF_SIZING
Window is being resized.
Definition: window_gui.h:173
Window::OnEditboxChanged
virtual void OnEditboxChanged(int widget)
The text in an editbox has been edited.
Definition: window_gui.h:661
Window::SetWhiteBorder
void SetWhiteBorder()
Set the timeout flag of the window and initiate the timer.
Definition: window_gui.h:304
SortButtonState
SortButtonState
State of a sort direction button.
Definition: window_gui.h:158
HotkeyList
List of hotkeys for a window.
Definition: hotkeys.h:40
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:1140
AllocateWindowDescFront
Wcls * AllocateWindowDescFront(WindowDesc *desc, int window_number, bool return_existing=false)
Open a new window.
Definition: window_gui.h:897
Window::DrawSortButtonState
void DrawSortButtonState(int widget, SortButtonState state) const
Draw a sort button's up or down arrow symbol.
Definition: widget.cpp:890
Window::nested_root
NWidgetBase * nested_root
Root of the nested tree.
Definition: window_gui.h:258
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:144
_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:261
WF_SIZING_RIGHT
@ WF_SIZING_RIGHT
Window is being resized towards the right.
Definition: window_gui.h:171
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:569
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:1015
Window::DrawWidget
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Definition: window_gui.h:500
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition: window_gui.h:67
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:107
ScrollbarClickHandler
void ScrollbarClickHandler(Window *w, NWidgetCore *nw, int x, int y)
Special handling for the scrollbar widget type.
Definition: widget.cpp:375
WidgetDimensions::pressed
int pressed
Offset for contents of depressed widget.
Definition: window_gui.h:60
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:1450
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:175
Window::viewport
ViewportData * viewport
Pointer to viewport data, if present.
Definition: window_gui.h:255
vehiclelist.h
ViewportData::scrollpos_y
int32 scrollpos_y
Currently shown y coordinate (virtual screen coordinate of topleft corner of the viewport).
Definition: window_gui.h:195
FrameFlags
FrameFlags
Flags to describe the look of the frame.
Definition: window_gui.h:30
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:1771
WDP_ALIGN_TOOLBAR
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Definition: window_gui.h:92
Window::OnGameTick
virtual void OnGameTick()
Called once per (game) tick.
Definition: window_gui.h:622
Window::IsNewGRFInspectable
virtual bool IsNewGRFInspectable() const
Is the data related to this window NewGRF inspectable?
Definition: window_gui.h:743
WF_STICKY
@ WF_STICKY
Window is made sticky by user.
Definition: window_gui.h:174
TileIndex
The index/ID of a Tile.
Definition: tile_type.h:85
WDF_NO_FOCUS
@ WDF_NO_FOCUS
This window won't get focus/make any other window lose focus when click.
Definition: window_gui.h:146
TextColour
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
Definition: gfx_type.h:257
Window::OnInvalidateData
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
Definition: window_gui.h:676
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:595
StringAlignment
StringAlignment
How to align the to-be drawn text.
Definition: gfx_type.h:334
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:111
SZSP_HORIZONTAL
@ SZSP_HORIZONTAL
Display plane with zero size vertically, and filling and resizing horizontally.
Definition: widget_type.h:425
Window::OnTimeout
virtual void OnTimeout()
Called when this window's timeout has been reached.
Definition: window_gui.h:639
Window::owner
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
Definition: window_gui.h:253
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:713
FR_LOWERED
@ FR_LOWERED
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
Definition: window_gui.h:34
smallmap_type.hpp
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:224
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:88
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:657
Window::GetCaretPosition
virtual Point GetCaretPosition() const
Get the current caret position if an edit box has the focus.
Definition: window.cpp:412
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:634
FR_TRANSPARENT
@ FR_TRANSPARENT
Makes the background transparent if set.
Definition: window_gui.h:32
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:632
Window::Window
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1810
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:973
WidgetDimensions::modalpopup
RectPadding modalpopup
Padding for a modal popup.
Definition: window_gui.h:58
Window::nested_focus
const NWidgetCore * nested_focus
Currently focused nested widget, or nullptr if no nested widget has focus.
Definition: window_gui.h:256
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:222
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:385
Window::OnCTRLStateChange
virtual EventState OnCTRLStateChange()
The state of the control key has changed.
Definition: window_gui.h:544
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:443
Window::querystrings
SmallMap< int, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
Definition: window_gui.h:257
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:726
Window::ProcessScheduledInvalidations
void ProcessScheduledInvalidations()
Process all scheduled invalidations.
Definition: window.cpp:3205
WindowDesc::default_width_trad
int16 default_width_trad
Preferred initial width of the window (pixels at 1x zoom).
Definition: window_gui.h:130
WindowDesc::default_pos
WindowPosition default_pos
Preferred position of the window.
Definition: window_gui.h:110
WindowDesc
High level window description.
Definition: window_gui.h:102
SetFocusedWindow
void SetFocusedWindow(Window *w)
Set the window that has the focus.
Definition: window.cpp:456
Window::SetStringParameters
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
Definition: window_gui.h:522
WF_SIZING_LEFT
@ WF_SIZING_LEFT
Window is being resized towards the left.
Definition: window_gui.h:172
Window::SetShaded
void SetShaded(bool make_shaded)
Set the shaded state of the window to make_shaded.
Definition: window.cpp:1051
RectPadding
Padding dimensions to apply to each side of a Rect.
Definition: geometry_type.hpp:47
Window::GetWidget
const NWID * GetWidget(uint widnum) const
Get the nested widget with number widnum from the nested widget tree.
Definition: window_gui.h:865
DrawCaption
void DrawCaption(const Rect &r, Colours colour, Owner owner, TextColour text_colour, StringID str, StringAlignment align)
Draw a caption bar.
Definition: widget.cpp:804
Window::OnFocusLost
virtual void OnFocusLost()
Called when window loses focus.
Definition: window.cpp:546
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:501
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:90
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:113
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:251
WSM_PRESIZE
@ WSM_PRESIZE
Presizing mode (docks, tunnels).
Definition: window_gui.h:925
Window::OnVehicleSelect
virtual bool OnVehicleSelect(VehicleList::const_iterator begin, VehicleList::const_iterator end)
The user clicked on a vehicle while HT_VEHICLE has been set.
Definition: window_gui.h:700
Window::EnableWidget
void EnableWidget(byte widget_index)
Sets a widget to Enabled.
Definition: window_gui.h:340
WidgetDimensions::hsep_normal
int hsep_normal
Normal horizontal spacing.
Definition: window_gui.h:63
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1800
Window::ProcessHighlightedInvalidations
void ProcessHighlightedInvalidations()
Process all invalidation of highlighted widgets.
Definition: window.cpp:3217
Window::height
int height
Height of the window (number of pixels down in y direction)
Definition: window_gui.h:249
WF_CENTERED
@ WF_CENTERED
Window is centered and shall stay centered after ReInit.
Definition: window_gui.h:178
WF_WHITE_BORDER
@ WF_WHITE_BORDER
Window white border counter bit mask.
Definition: window_gui.h:176
SpecialMouseMode
SpecialMouseMode
Mouse modes.
Definition: window_gui.h:921
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:1004
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:1675
WidgetDimensions::matrix
RectPadding matrix
Offsets within a matrix cell.
Definition: window_gui.h:49
Window::OnFocus
virtual void OnFocus()
Called when window gains focus.
Definition: window.cpp:538
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:721
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:126
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:692
WidgetDimensions::hsep_wide
int hsep_wide
Wide horizontal spacing.
Definition: window_gui.h:64
Window::HandleEditBoxKey
EventState HandleEditBoxKey(int wid, WChar key, uint16 keycode)
Process keypress for editbox widget.
Definition: window.cpp:2536
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:684
Window::OnDropdownSelect
virtual void OnDropdownSelect(int widget, int index)
A dropdown option associated to this window has been selected.
Definition: window_gui.h:653
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:321
Window::DeleteClosedWindows
static void DeleteClosedWindows()
Delete all closed windows.
Definition: window.cpp:65
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:266
Window::IsWidgetGloballyFocused
bool IsWidgetGloballyFocused(byte widget_index) const
Check if given widget has user input focus.
Definition: window_gui.h:372
Window::left
int left
x position of left edge of the window
Definition: window_gui.h:246
Window::OnDragDrop
virtual void OnDragDrop(Point pt, int widget)
A dragged 'object' has been released.
Definition: window_gui.h:591
Window::flags
WindowFlags flags
Window flags.
Definition: window_gui.h:239
DrawFrameRect
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
Draw frame rectangle.
Definition: widget.cpp:414
WF_TIMEOUT
@ WF_TIMEOUT
Window timeout counter.
Definition: window_gui.h:168
WidgetDimensions::captiontext
RectPadding captiontext
Offsets of text within a caption.
Definition: window_gui.h:56
WindowClass
WindowClass
Window classes.
Definition: window_type.h:37
Window::ShowNewGRFInspectWindow
virtual void ShowNewGRFInspectWindow() const
Show the NewGRF inspection window.
Definition: window_gui.h:751
WindowDesc::default_height_trad
int16 default_height_trad
Preferred initial height of the window (pixels at 1x zoom).
Definition: window_gui.h:131
WidgetDimensions::dropdowntext
RectPadding dropdowntext
Offsets of text within a dropdown widget.
Definition: window_gui.h:57
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:399
WDF_MODAL
@ WDF_MODAL
The window is a modal child of some other window, meaning the parent is 'inactive'.
Definition: window_gui.h:145
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:182
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:177
WindowDesc::nwid_parts
const NWidgetPart * nwid_parts
Nested widget parts describing the window.
Definition: window_gui.h:115
WindowDefaultFlag
WindowDefaultFlag
Window default widget/window handling flags.
Definition: window_gui.h:143
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:197
Window::IsWidgetFocused
bool IsWidgetFocused(byte widget_index) const
Check if given widget is focused within this window.
Definition: window_gui.h:361
WSM_DRAGDROP
@ WSM_DRAGDROP
Drag&drop an object.
Definition: window_gui.h:923
Window::OnInit
virtual void OnInit()
Notification that the nested widget tree gets initialized.
Definition: window_gui.h:472
WSM_SIZING
@ WSM_SIZING
Sizing mode.
Definition: window_gui.h:924
Window::unshaded_size
Dimension unshaded_size
Last known unshaded size (only valid while shaded).
Definition: window_gui.h:262
WindowDesc::SaveToConfig
static void SaveToConfig()
Save all WindowDesc settings to _windows_file.
Definition: window.cpp:176
string_type.h
Window::SetFocusedWidget
bool SetFocusedWidget(int widget_index)
Set focus within this window to the given widget.
Definition: window.cpp:517
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:241
ResizeInfo::step_height
uint step_height
Step-size of height resize changes.
Definition: window_gui.h:154
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:167
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:3192
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:264
NWidgetStacked
Stacked widgets, widgets all occupying the same space in the window.
Definition: widget_type.h:441
Window::AllWindows
Iterable ensemble of all valid Windows.
Definition: window_gui.h:803
Window::nested_array
NWidgetBase ** nested_array
Array of pointers into the tree. Do not access directly, use Window::GetWidget() instead.
Definition: window_gui.h:259
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:735
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:553
SBS_DOWN
@ SBS_DOWN
Sort ascending.
Definition: window_gui.h:160
ViewportData::scrollpos_x
int32 scrollpos_x
Currently shown x coordinate (virtual screen coordinate of topleft corner of the viewport).
Definition: window_gui.h:194
vehicle_type.h
WidgetDimensions
Definition: window_gui.h:40
Window::OnMouseLoop
virtual void OnMouseLoop()
Called for every mouse loop run, which is at least once per (game) tick.
Definition: window_gui.h:617
WindowDesc::nwid_length
int16 nwid_length
Length of the nwid_parts array.
Definition: window_gui.h:116
ResizeInfo::step_width
uint step_width
Step-size of width resize changes.
Definition: window_gui.h:153
Window::OnMouseWheel
virtual void OnMouseWheel(int wheel)
The mouse wheel has been turned.
Definition: window_gui.h:611
WindowDesc::flags
uint32 flags
Flags.
Definition: window_gui.h:114
Window::IsShaded
bool IsShaded() const
Is window shaded currently?
Definition: window_gui.h:455
Window::OnPlaceObjectAbort
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
Definition: window_gui.h:705
ResizeInfo
Data structure for resizing a window.
Definition: window_gui.h:152
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:773
Window::closed_windows
static std::vector< Window * > closed_windows
List of closed windows to delete.
Definition: window_gui.h:215
Window::CloseChildWindows
void CloseChildWindows(WindowClass wc=WC_INVALID) const
Close all children a window might have in a head-recursive manner.
Definition: window.cpp:1091
tile_type.h
WidgetDimensions::hsep_indent
int hsep_indent
Width of identation for tree layouts.
Definition: window_gui.h:65
Window::SetWidgetsLoweredState
void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets,...)
Sets the lowered/raised status of a list of widgets.
Definition: window.cpp:577
Window::OnTooltip
virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond)
Event to display a custom tooltip.
Definition: window_gui.h:577
WidgetDimensions::fullbevel
RectPadding fullbevel
Always-scaled bevel border.
Definition: window_gui.h:46
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:428
Window::OnPaint
virtual void OnPaint()
The window must be repainted.
Definition: window_gui.h:489
Window::SetWidgetsDisabledState
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
Definition: window.cpp:558
Window::IsWidgetLowered
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:422
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:605
EventState
EventState
State of handling an event.
Definition: window_type.h:719
WindowDesc::pref_sticky
bool pref_sticky
Preferred stickyness.
Definition: window_gui.h:119
WF_DRAGGING
@ WF_DRAGGING
Window is being dragged.
Definition: window_gui.h:170
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:514
WidgetDimensions::bevel
RectPadding bevel
Widths of bevel border.
Definition: window_gui.h:45
WSM_DRAGGING
@ WSM_DRAGGING
Dragging mode (trees).
Definition: window_gui.h:926
Window::window_class
WindowClass window_class
Window class.
Definition: window_gui.h:240
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1787
PickerWindowBase
Base class for windows opened from a toolbar.
Definition: window_gui.h:874
_special_mouse_mode
SpecialMouseMode _special_mouse_mode
Mode of the mouse.
Definition: window.cpp:93
Window::UpdateQueryStringSize
void UpdateQueryStringSize()
Update size of all QueryStrings of this window.
Definition: window.cpp:360
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:247
Window::DrawViewport
void DrawViewport() const
Draw the viewport of this window.
Definition: viewport.cpp:1825
WidgetDimensions::framerect
RectPadding framerect
Offsets within frame area.
Definition: window_gui.h:47
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:183
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:584
ViewportData::follow_vehicle
VehicleID follow_vehicle
VehicleID to follow if following a vehicle, INVALID_VEHICLE otherwise.
Definition: window_gui.h:193
Window::OnInitialPosition
virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
Compute the initial position of the window.
Definition: window.cpp:1759
Window::ToggleWidgetLoweredState
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
Definition: window_gui.h:392
Window::width
int width
width of the window (number of pixels to the right in x direction)
Definition: window_gui.h:248
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:3492
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:196
WDP_MANUAL
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
Definition: window_gui.h:89
Window::SortButtonWidth
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
Definition: widget.cpp:907
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:35
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:2694
Window::window_desc
WindowDesc * window_desc
Window description.
Definition: window_gui.h:238
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:715
Window::OnRealtimeTick
virtual void OnRealtimeTick(uint delta_ms)
Called periodically.
Definition: window_gui.h:634
WindowDesc::parent_cls
WindowClass parent_cls
Class of the parent window.
Definition: window_gui.h:112
Window
Data structure for an opened window.
Definition: window_gui.h:213
Window::RaiseWidget
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Definition: window_gui.h:412
viewport_type.h
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:858
FindWindowFromPt
Window * FindWindowFromPt(int x, int y)
Do a search for a window at specific coordinates.
Definition: window.cpp:1822
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:562
AllEqual
bool AllEqual(It begin, It end, Pred pred)
Generic helper function that checks if all elements of the range are equal with respect to the given ...
Definition: window_gui.h:830
Window::OnQueryTextFinished
virtual void OnQueryTextFinished(char *str)
The query window opened from this window has closed.
Definition: window_gui.h:669
WidgetDimensions::frametext
RectPadding frametext
Offsets within a text frame area.
Definition: window_gui.h:48
Window::OnScroll
virtual void OnScroll(Point delta)
Handle the request for (viewport) scrolling.
Definition: window_gui.h:597
SBS_UP
@ SBS_UP
Sort descending.
Definition: window_gui.h:161
SBS_OFF
@ SBS_OFF
Do not sort (with this button).
Definition: window_gui.h:159
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition: window_gui.h:68
Window::nested_array_size
uint nested_array_size
Size of the nested array.
Definition: window_gui.h:260
NWidgetCore::index
int index
Index of the nested widget in the widget array of the window (-1 means 'not used').
Definition: widget_type.h:337
Window::IsWidgetDisabled
bool IsWidgetDisabled(byte widget_index) const
Gets the enabled/disabled status of a widget.
Definition: window_gui.h:350
NWidgetCore
Base class for a 'real' widget.
Definition: widget_type.h:314
Window::SetWidgetDirty
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Definition: window.cpp:619
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:69
Window::LowerWidget
void LowerWidget(byte widget_index)
Marks a widget as lowered.
Definition: window_gui.h:403
Window::GetMarkedText
virtual const char * GetMarkedText(size_t *length) const
Get the range of the currently marked input text.
Definition: window.cpp:399
WidgetDimensions::vsep_wide
int vsep_wide
Wide vertical spacing.
Definition: window_gui.h:62
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:646
Window::DisableWidget
void DisableWidget(byte widget_index)
Sets a widget to disabled.
Definition: window_gui.h:331
WindowDesc::hotkeys
HotkeyList * hotkeys
Hotkeys for the window.
Definition: window_gui.h:117
NWidgetStacked::shown_plane
int shown_plane
Plane being displayed (for NWID_SELECTION only).
Definition: widget_type.h:457
WindowPosition
WindowPosition
How do we the window to be placed?
Definition: window_gui.h:88
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition: window_gui.h:91
Window::SetWidgetLoweredState
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:382
company_type.h
WindowDesc::pref_height
int16 pref_height
User-preferred height of the window. Zero if unset.
Definition: window_gui.h:121
Window::white_border_timer
uint8 white_border_timer
Timer value of the WF_WHITE_BORDER for flags.
Definition: window_gui.h:244
WSM_NONE
@ WSM_NONE
No special mouse mode.
Definition: window_gui.h:922
WindowDesc::pref_width
int16 pref_width
User-preferred width of the window. Zero if unset.
Definition: window_gui.h:120
Window::InitializeData
void InitializeData(WindowNumber window_number)
Initializes the data (except the position and initial size) of a new Window.
Definition: window.cpp:1408
FR_BORDERONLY
@ FR_BORDERONLY
Draw border only, no background.
Definition: window_gui.h:33
Window::GetFocusedText
virtual const char * GetFocusedText() const
Get the current input text if an edit box has the focus.
Definition: window.cpp:372
Window::FindWindowPlacementAndResize
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
Resize window towards the default size.
Definition: window.cpp:1468
Window::OnKeyPress
virtual EventState OnKeyPress(WChar key, uint16 keycode)
A key has been pressed.
Definition: window_gui.h:535
Window::Close
virtual void Close()
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:1103
BringWindowToFrontById
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
Definition: window.cpp:1270
WidgetDimensions::vsep_normal
int vsep_normal
Normal vertical spacing.
Definition: window_gui.h:61