OpenTTD Source: src/widget_type.h Source File

OpenTTD Source 13.2.1

widget_type.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 WIDGET_TYPE_H
11 #define WIDGET_TYPE_H
12
13 #include "core/alloc_type.hpp"
14 #include "core/bitmath_func.hpp"
15 #include "core/math_func.hpp"
16 #include "strings_type.h"
17 #include "gfx_type.h"
18 #include "window_type.h"
19
20 static const int WIDGET_LIST_END = -1;
21
23 enum MatrixWidgetValues {
24 /* Number of column bits of the WWT_MATRIX widget data. */
25 MAT_COL_START = 0,
26 MAT_COL_BITS = 8,
27
28 /* Number of row bits of the WWT_MATRIX widget data. */
29 MAT_ROW_START = 8,
30 MAT_ROW_BITS = 8,
31 };
32
34 enum ArrowWidgetValues {
35 AWV_DECREASE,
36 AWV_INCREASE,
37 AWV_LEFT,
38 AWV_RIGHT,
39 };
40
44 enum WidgetType {
45 /* Window widget types. */
46 WWT_EMPTY,
47
48 WWT_PANEL,
49 WWT_INSET,
50 WWT_IMGBTN,
51 WWT_IMGBTN_2,
52 WWT_ARROWBTN,
53 WWT_TEXTBTN,
54 WWT_TEXTBTN_2,
55 WWT_LABEL,
56 WWT_TEXT,
57 WWT_MATRIX,
58 WWT_FRAME,
59 WWT_CAPTION,
60
61 WWT_DEBUGBOX,
62 WWT_SHADEBOX,
63 WWT_DEFSIZEBOX,
64 WWT_STICKYBOX,
65
66 WWT_RESIZEBOX,
67 WWT_CLOSEBOX,
68 WWT_DROPDOWN,
69 WWT_EDITBOX,
70 WWT_LAST,
71
72 /* Nested widget types. */
73 NWID_HORIZONTAL,
74 NWID_HORIZONTAL_LTR,
75 NWID_VERTICAL,
76 NWID_MATRIX,
77 NWID_SPACER,
78 NWID_SELECTION,
79 NWID_VIEWPORT,
80 NWID_BUTTON_DROPDOWN,
81 NWID_HSCROLLBAR,
82 NWID_VSCROLLBAR,
83
84 /* Nested widget part types. */
85 WPT_RESIZE,
86 WPT_MINSIZE,
87 WPT_MINTEXTLINES,
88 WPT_FILL,
89 WPT_DATATIP,
90 WPT_PADDING,
91 WPT_PIPSPACE,
92 WPT_TEXTCOLOUR,
93 WPT_ALIGNMENT,
94 WPT_ENDCONTAINER,
95 WPT_FUNCTION,
96 WPT_SCROLLBAR,
97
98 /* Pushable window widget types. */
99 WWT_MASK = 0x7F,
100
101 WWB_PUSHBUTTON = 1 << 7,
102
103 WWT_PUSHBTN = WWT_PANEL | WWB_PUSHBUTTON,
104 WWT_PUSHTXTBTN = WWT_TEXTBTN | WWB_PUSHBUTTON,
105 WWT_PUSHIMGBTN = WWT_IMGBTN | WWB_PUSHBUTTON,
106 WWT_PUSHARROWBTN = WWT_ARROWBTN | WWB_PUSHBUTTON,
107 NWID_PUSHBUTTON_DROPDOWN = NWID_BUTTON_DROPDOWN | WWB_PUSHBUTTON,
108 };
109
111 enum SizingType {
112 ST_SMALLEST,
113 ST_RESIZE,
114 };
115
116 /* Forward declarations. */
117 class NWidgetCore;
118 class Scrollbar;
119
126 class NWidgetBase : public ZeroedMemoryAllocator {
127 public:
128 NWidgetBase(WidgetType tp);
129
130 virtual void AdjustPaddingForZoom();
131 virtual void SetupSmallestSize(Window *w, bool init_array) = 0;
132 virtual void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) = 0;
133
134 virtual void FillNestedArray(NWidgetBase **array, uint length) = 0;
135
136 virtual NWidgetCore *GetWidgetFromPos(int x, int y) = 0;
137 virtual NWidgetBase *GetWidgetOfType(WidgetType tp);
138
139 virtual bool IsHighlighted() const { return false; }
140 virtual TextColour GetHighlightColour() const { return TC_INVALID; }
141 virtual void SetHighlighted(TextColour highlight_colour) {}
142
150 inline void SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
151 {
152 this->uz_padding.top = top;
153 this->uz_padding.right = right;
154 this->uz_padding.bottom = bottom;
155 this->uz_padding.left = left;
156 this->AdjustPaddingForZoom();
157 }
158
163 inline void SetPadding(const RectPadding &padding)
164 {
165 this->uz_padding = padding;
166 this->AdjustPaddingForZoom();
167 }
168
169 inline uint GetHorizontalStepSize(SizingType sizing) const;
170 inline uint GetVerticalStepSize(SizingType sizing) const;
171
172 virtual void Draw(const Window *w) = 0;
173 virtual void SetDirty(const Window *w) const;
174
175 Rect GetCurrentRect() const
176 {
177 Rect r;
178 r.left = this->pos_x;
179 r.top = this->pos_y;
180 r.right = this->pos_x + this->current_x - 1;
181 r.bottom = this->pos_y + this->current_y - 1;
182 return r;
183 }
184
185 WidgetType type;
186 uint fill_x;
187 uint fill_y;
188 uint resize_x;
189 uint resize_y;
190 /* Size of the widget in the smallest window possible.
191 * Computed by #SetupSmallestSize() followed by #AssignSizePosition().
192 */
193 uint smallest_x;
194 uint smallest_y;
195 /* Current widget size (that is, after resizing). */
196 uint current_x;
197 uint current_y;
198
199 int pos_x;
200 int pos_y;
201
202 NWidgetBase *next;
203 NWidgetBase *prev;
204
205 RectPadding padding;
206 RectPadding uz_padding;
207
208 protected:
209 inline void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height);
210 };
211
216 inline uint NWidgetBase::GetHorizontalStepSize(SizingType sizing) const
217 {
218 return (sizing == ST_RESIZE) ? this->resize_x : this->fill_x;
219 }
220
225 inline uint NWidgetBase::GetVerticalStepSize(SizingType sizing) const
226 {
227 return (sizing == ST_RESIZE) ? this->resize_y : this->fill_y;
228 }
229
238 inline void NWidgetBase::StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height)
239 {
240 this->pos_x = x;
241 this->pos_y = y;
242 if (sizing == ST_SMALLEST) {
243 this->smallest_x = given_width;
244 this->smallest_y = given_height;
245 }
246 this->current_x = given_width;
247 this->current_y = given_height;
248 }
249
250
255 class NWidgetResizeBase : public NWidgetBase {
256 public:
257 NWidgetResizeBase(WidgetType tp, uint fill_x, uint fill_y);
258
259 void AdjustPaddingForZoom() override;
260 void SetMinimalSize(uint min_x, uint min_y);
261 void SetMinimalSizeAbsolute(uint min_x, uint min_y);
262 void SetMinimalTextLines(uint8 min_lines, uint8 spacing, FontSize size);
263 void SetFill(uint fill_x, uint fill_y);
264 void SetResize(uint resize_x, uint resize_y);
265
266 void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
267
268 uint min_x;
269 uint min_y;
270
271 bool absolute;
272 uint uz_min_x;
273 uint uz_min_y;
274
275 uint8 uz_text_lines;
276 uint8 uz_text_spacing;
277 FontSize uz_text_size;
278 };
279
281 enum NWidgetDisplay {
282 /* Generic. */
283 NDB_LOWERED = 0,
284 NDB_DISABLED = 1,
285 /* Viewport widget. */
286 NDB_NO_TRANSPARENCY = 2,
287 NDB_SHADE_GREY = 3,
288 NDB_SHADE_DIMMED = 4,
289 /* Button dropdown widget. */
290 NDB_DROPDOWN_ACTIVE = 5,
291 /* Scrollbar widget. */
292 NDB_SCROLLBAR_UP = 6,
293 NDB_SCROLLBAR_DOWN = 7,
294 /* Generic. */
295 NDB_HIGHLIGHT = 8,
296 NDB_DROPDOWN_CLOSED = 9,
297
298 ND_LOWERED = 1 << NDB_LOWERED,
299 ND_DISABLED = 1 << NDB_DISABLED,
300 ND_HIGHLIGHT = 1 << NDB_HIGHLIGHT,
301 ND_NO_TRANSPARENCY = 1 << NDB_NO_TRANSPARENCY,
302 ND_SHADE_GREY = 1 << NDB_SHADE_GREY,
303 ND_SHADE_DIMMED = 1 << NDB_SHADE_DIMMED,
304 ND_DROPDOWN_ACTIVE = 1 << NDB_DROPDOWN_ACTIVE,
305 ND_SCROLLBAR_UP = 1 << NDB_SCROLLBAR_UP,
306 ND_SCROLLBAR_DOWN = 1 << NDB_SCROLLBAR_DOWN,
307 ND_SCROLLBAR_BTN = ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN,
308 ND_DROPDOWN_CLOSED = 1 << NDB_DROPDOWN_CLOSED,
309 };
310 DECLARE_ENUM_AS_BIT_SET(NWidgetDisplay)
311
312
316 class NWidgetCore : public NWidgetResizeBase {
317 public:
318 NWidgetCore(WidgetType tp, Colours colour, uint fill_x, uint fill_y, uint32 widget_data, StringID tool_tip);
319
320 void SetIndex(int index);
321 void SetDataTip(uint32 widget_data, StringID tool_tip);
322 void SetToolTip(StringID tool_tip);
323 void SetTextColour(TextColour colour);
324 void SetAlignment(StringAlignment align);
325
326 inline void SetLowered(bool lowered);
327 inline bool IsLowered() const;
328 inline void SetDisabled(bool disabled);
329 inline bool IsDisabled() const;
330
331 void FillNestedArray(NWidgetBase **array, uint length) override;
332 NWidgetCore *GetWidgetFromPos(int x, int y) override;
333 bool IsHighlighted() const override;
334 TextColour GetHighlightColour() const override;
335 void SetHighlighted(TextColour highlight_colour) override;
336
337 NWidgetDisplay disp_flags;
338 Colours colour;
339 int index;
340 uint32 widget_data;
341 StringID tool_tip;
342 int scrollbar_index;
343 TextColour highlight_colour;
344 TextColour text_colour;
345 StringAlignment align;
346 };
347
352 inline void NWidgetCore::SetHighlighted(TextColour highlight_colour)
353 {
354 this->disp_flags = highlight_colour != TC_INVALID ? SETBITS(this->disp_flags, ND_HIGHLIGHT) : CLRBITS(this->disp_flags, ND_HIGHLIGHT);
355 this->highlight_colour = highlight_colour;
356 }
357
359 inline bool NWidgetCore::IsHighlighted() const
360 {
361 return HasBit(this->disp_flags, NDB_HIGHLIGHT);
362 }
363
365 inline TextColour NWidgetCore::GetHighlightColour() const
366 {
367 return this->highlight_colour;
368 }
369
374 inline void NWidgetCore::SetLowered(bool lowered)
375 {
376 this->disp_flags = lowered ? SETBITS(this->disp_flags, ND_LOWERED) : CLRBITS(this->disp_flags, ND_LOWERED);
377 }
378
380 inline bool NWidgetCore::IsLowered() const
381 {
382 return HasBit(this->disp_flags, NDB_LOWERED);
383 }
384
389 inline void NWidgetCore::SetDisabled(bool disabled)
390 {
391 this->disp_flags = disabled ? SETBITS(this->disp_flags, ND_DISABLED) : CLRBITS(this->disp_flags, ND_DISABLED);
392 }
393
395 inline bool NWidgetCore::IsDisabled() const
396 {
397 return HasBit(this->disp_flags, NDB_DISABLED);
398 }
399
400
405 class NWidgetContainer : public NWidgetBase {
406 public:
407 NWidgetContainer(WidgetType tp);
408 ~NWidgetContainer();
409
410 void AdjustPaddingForZoom() override;
411 void Add(NWidgetBase *wid);
412 void FillNestedArray(NWidgetBase **array, uint length) override;
413
415 inline bool IsEmpty() { return head == nullptr; }
416
417 NWidgetBase *GetWidgetOfType(WidgetType tp) override;
418
419 protected:
420 NWidgetBase *head;
421 NWidgetBase *tail;
422 };
423
425 enum StackedZeroSizePlanes {
426 SZSP_VERTICAL = INT_MAX / 2,
427 SZSP_HORIZONTAL,
428 SZSP_NONE,
429
430 SZSP_BEGIN = SZSP_VERTICAL,
431 };
432
443 class NWidgetStacked : public NWidgetContainer {
444 public:
445 NWidgetStacked();
446
447 void SetIndex(int index);
448
449 void AdjustPaddingForZoom() override;
450 void SetupSmallestSize(Window *w, bool init_array) override;
451 void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
452 void FillNestedArray(NWidgetBase **array, uint length) override;
453
454 void Draw(const Window *w) override;
455 NWidgetCore *GetWidgetFromPos(int x, int y) override;
456
457 void SetDisplayedPlane(int plane);
458
459 int shown_plane;
460 int index;
461 };
462
464 enum NWidContainerFlags {
465 NCB_EQUALSIZE = 0,
466 NCB_BIGFIRST = 1,
467
468 NC_NONE = 0,
469 NC_EQUALSIZE = 1 << NCB_EQUALSIZE,
470 NC_BIGFIRST = 1 << NCB_BIGFIRST,
471 };
472 DECLARE_ENUM_AS_BIT_SET(NWidContainerFlags)
473
474
475 class NWidgetPIPContainer : public NWidgetContainer {
476 public:
477 NWidgetPIPContainer(WidgetType tp, NWidContainerFlags flags = NC_NONE);
478
479 void AdjustPaddingForZoom() override;
480 void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post);
481
482 void Draw(const Window *w) override;
483 NWidgetCore *GetWidgetFromPos(int x, int y) override;
484
485 protected:
486 NWidContainerFlags flags;
487 uint8 pip_pre;
488 uint8 pip_inter;
489 uint8 pip_post;
490
491 uint8 uz_pip_pre;
492 uint8 uz_pip_inter;
493 uint8 uz_pip_post;
494 };
495
500 class NWidgetHorizontal : public NWidgetPIPContainer {
501 public:
502 NWidgetHorizontal(NWidContainerFlags flags = NC_NONE);
503
504 void SetupSmallestSize(Window *w, bool init_array) override;
505 void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
506 };
507
512 class NWidgetHorizontalLTR : public NWidgetHorizontal {
513 public:
514 NWidgetHorizontalLTR(NWidContainerFlags flags = NC_NONE);
515
516 void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
517 };
518
523 class NWidgetVertical : public NWidgetPIPContainer {
524 public:
525 NWidgetVertical(NWidContainerFlags flags = NC_NONE);
526
527 void SetupSmallestSize(Window *w, bool init_array) override;
528 void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
529 };
530
539 class NWidgetMatrix : public NWidgetPIPContainer {
540 public:
541 NWidgetMatrix();
542
543 void SetIndex(int index);
544 void SetColour(Colours colour);
545 void SetClicked(int clicked);
546 void SetCount(int count);
547 void SetScrollbar(Scrollbar *sb);
548
549 void SetupSmallestSize(Window *w, bool init_array) override;
550 void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
551 void FillNestedArray(NWidgetBase **array, uint length) override;
552
553 NWidgetCore *GetWidgetFromPos(int x, int y) override;
554 void Draw(const Window *w) override;
555 protected:
556 int index;
557 Colours colour;
558 int clicked;
559 int count;
560 Scrollbar *sb;
561 private:
562 int widget_w;
563 int widget_h;
564 int widgets_x;
565 int widgets_y;
566
567 void GetScrollOffsets(int &start_x, int &start_y, int &base_offs_x, int &base_offs_y);
568 };
569
570
575 class NWidgetSpacer : public NWidgetResizeBase {
576 public:
577 NWidgetSpacer(int width, int height);
578
579 void SetupSmallestSize(Window *w, bool init_array) override;
580 void FillNestedArray(NWidgetBase **array, uint length) override;
581
582 void Draw(const Window *w) override;
583 void SetDirty(const Window *w) const override;
584 NWidgetCore *GetWidgetFromPos(int x, int y) override;
585 };
586
591 class NWidgetBackground : public NWidgetCore {
592 public:
593 NWidgetBackground(WidgetType tp, Colours colour, int index, NWidgetPIPContainer *child = nullptr);
594 ~NWidgetBackground();
595
596 void Add(NWidgetBase *nwid);
597 void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post);
598
599 void AdjustPaddingForZoom() override;
600 void SetupSmallestSize(Window *w, bool init_array) override;
601 void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
602
603 void FillNestedArray(NWidgetBase **array, uint length) override;
604
605 void Draw(const Window *w) override;
606 NWidgetCore *GetWidgetFromPos(int x, int y) override;
607 NWidgetBase *GetWidgetOfType(WidgetType tp) override;
608
609 private:
610 NWidgetPIPContainer *child;
611 };
612
622 class NWidgetViewport : public NWidgetCore {
623 public:
624 NWidgetViewport(int index);
625
626 void SetupSmallestSize(Window *w, bool init_array) override;
627 void Draw(const Window *w) override;
628
629 void InitializeViewport(Window *w, uint32 follow_flags, ZoomLevel zoom);
630 void UpdateViewportCoordinates(Window *w);
631 };
632
636 class Scrollbar {
637 private:
638 const bool is_vertical;
639 uint16 count;
640 uint16 cap;
641 uint16 pos;
642 uint16 stepsize;
643
644 public:
646 enum ScrollbarStepping {
647 SS_RAW,
648 SS_SMALL,
649 SS_BIG,
650 };
651
652 Scrollbar(bool is_vertical) : is_vertical(is_vertical), stepsize(1)
653 {
654 }
655
660 inline uint16 GetCount() const
661 {
662 return this->count;
663 }
664
669 inline uint16 GetCapacity() const
670 {
671 return this->cap;
672 }
673
678 inline uint16 GetPosition() const
679 {
680 return this->pos;
681 }
682
688 inline bool IsVisible(uint16 item) const
689 {
690 return IsInsideBS(item, this->GetPosition(), this->GetCapacity());
691 }
692
697 inline bool IsVertical() const
698 {
699 return this->is_vertical;
700 }
701
706 void SetStepSize(uint16 stepsize)
707 {
708 assert(stepsize > 0);
709 this->stepsize = stepsize;
710 }
711
717 void SetCount(int num)
718 {
719 assert(num >= 0);
720 assert(num <= MAX_UVALUE(uint16));
721
722 this->count = num;
723 num -= this->cap;
724 if (num < 0) num = 0;
725 if (num < this->pos) this->pos = num;
726 }
727
733 void SetCapacity(int capacity)
734 {
735 assert(capacity > 0);
736 assert(capacity <= MAX_UVALUE(uint16));
737
738 this->cap = capacity;
739 if (this->cap + this->pos > this->count) this->pos = std::max(0, this->count - this->cap);
740 }
741
742 void SetCapacityFromWidget(Window *w, int widget, int padding = 0);
743
749 bool SetPosition(int position)
750 {
751 uint16 old_pos = this->pos;
752 this->pos = Clamp(position, 0, std::max(this->count - this->cap, 0));
753 return this->pos != old_pos;
754 }
755
763 bool UpdatePosition(int difference, ScrollbarStepping unit = SS_SMALL)
764 {
765 if (difference == 0) return false;
766 switch (unit) {
767 case SS_SMALL: difference *= this->stepsize; break;
768 case SS_BIG: difference *= this->cap; break;
769 default: break;
770 }
771 return this->SetPosition(this->pos + difference);
772 }
773
780 void ScrollTowards(int position)
781 {
782 if (position < this->GetPosition()) {
783 /* scroll up to the item */
784 this->SetPosition(position);
785 } else if (position >= this->GetPosition() + this->GetCapacity()) {
786 /* scroll down so that the item is at the bottom */
787 this->SetPosition(position - this->GetCapacity() + 1);
788 }
789 }
790
791 int GetScrolledRowFromWidget(int clickpos, const Window * const w, int widget, int padding = 0) const;
792 EventState UpdateListPositionOnKeyPress(int &list_position, uint16 keycode) const;
793 };
794
800 class NWidgetScrollbar : public NWidgetCore, public Scrollbar {
801 public:
802 NWidgetScrollbar(WidgetType tp, Colours colour, int index);
803
804 void SetupSmallestSize(Window *w, bool init_array) override;
805 void Draw(const Window *w) override;
806
807 static void InvalidateDimensionCache();
808 static Dimension GetVerticalDimension();
809 static Dimension GetHorizontalDimension();
810
811 private:
812 static Dimension vertical_dimension;
813 static Dimension horizontal_dimension;
814 };
815
820 class NWidgetLeaf : public NWidgetCore {
821 public:
822 NWidgetLeaf(WidgetType tp, Colours colour, int index, uint32 data, StringID tip);
823
824 void SetupSmallestSize(Window *w, bool init_array) override;
825 void Draw(const Window *w) override;
826
827 bool ButtonHit(const Point &pt);
828
829 static void InvalidateDimensionCache();
830
831 static Dimension dropdown_dimension;
832 static Dimension resizebox_dimension;
833 static Dimension closebox_dimension;
834 private:
835 static Dimension shadebox_dimension;
836 static Dimension debugbox_dimension;
837 static Dimension defsizebox_dimension;
838 static Dimension stickybox_dimension;
839 };
840
848 static inline uint ComputeMaxSize(uint base, uint max_space, uint step)
849 {
850 if (base >= max_space || step == 0) return base;
851 if (step == 1) return max_space;
852 uint increment = max_space - base;
853 increment -= increment % step;
854 return base + increment;
855 }
856
908 struct NWidgetPartDataTip {
909 uint32 data;
910 StringID tooltip;
911 };
912
917 struct NWidgetPartWidget {
918 Colours colour;
919 int16 index;
920 };
921
926 struct NWidgetPartPaddings : RectPadding {
927 };
928
933 struct NWidgetPartPIP {
934 uint8 pre, inter, post;
935 };
936
941 struct NWidgetPartTextLines {
942 uint8 lines;
943 uint8 spacing;
944 FontSize size;
945 };
946
951 struct NWidgetPartTextColour {
952 TextColour colour;
953 };
954
959 struct NWidgetPartAlignment {
960 StringAlignment align;
961 };
962
969 typedef NWidgetBase *NWidgetFunctionType(int *biggest_index);
970
975 struct NWidgetPart {
976 WidgetType type;
977 union {
978 Point xy;
979 NWidgetPartDataTip data_tip;
980 NWidgetPartWidget widget;
981 NWidgetPartPaddings padding;
982 NWidgetPartPIP pip;
983 NWidgetPartTextLines text_lines;
984 NWidgetPartTextColour colour;
985 NWidgetPartAlignment align;
986 NWidgetFunctionType *func_ptr;
987 NWidContainerFlags cont_flags;
988 } u;
989 };
990
997 static inline NWidgetPart SetResize(int16 dx, int16 dy)
998 {
999 NWidgetPart part;
1000
1001 part.type = WPT_RESIZE;
1002 part.u.xy.x = dx;
1003 part.u.xy.y = dy;
1004
1005 return part;
1006 }
1007
1014 static inline NWidgetPart SetMinimalSize(int16 x, int16 y)
1015 {
1016 NWidgetPart part;
1017
1018 part.type = WPT_MINSIZE;
1019 part.u.xy.x = x;
1020 part.u.xy.y = y;
1021
1022 return part;
1023 }
1024
1032 static inline NWidgetPart SetMinimalTextLines(uint8 lines, uint8 spacing, FontSize size = FS_NORMAL)
1033 {
1034 NWidgetPart part;
1035
1036 part.type = WPT_MINTEXTLINES;
1037 part.u.text_lines.lines = lines;
1038 part.u.text_lines.spacing = spacing;
1039 part.u.text_lines.size = size;
1040
1041 return part;
1042 }
1043
1049 static inline NWidgetPart SetTextColour(TextColour colour)
1050 {
1051 NWidgetPart part;
1052
1053 part.type = WPT_TEXTCOLOUR;
1054 part.u.colour.colour = colour;
1055
1056 return part;
1057 }
1058
1064 static inline NWidgetPart SetAlignment(StringAlignment align)
1065 {
1066 NWidgetPart part;
1067
1068 part.type = WPT_ALIGNMENT;
1069 part.u.align.align = align;
1070
1071 return part;
1072 }
1073
1080 static inline NWidgetPart SetFill(uint fill_x, uint fill_y)
1081 {
1082 NWidgetPart part;
1083
1084 part.type = WPT_FILL;
1085 part.u.xy.x = fill_x;
1086 part.u.xy.y = fill_y;
1087
1088 return part;
1089 }
1090
1096 static inline NWidgetPart EndContainer()
1097 {
1098 NWidgetPart part;
1099
1100 part.type = WPT_ENDCONTAINER;
1101
1102 return part;
1103 }
1104
1111 static inline NWidgetPart SetDataTip(uint32 data, StringID tip)
1112 {
1113 NWidgetPart part;
1114
1115 part.type = WPT_DATATIP;
1116 part.u.data_tip.data = data;
1117 part.u.data_tip.tooltip = tip;
1118
1119 return part;
1120 }
1121
1129 static inline NWidgetPart SetMatrixDataTip(uint8 cols, uint8 rows, StringID tip)
1130 {
1131 return SetDataTip((rows << MAT_ROW_START) | (cols << MAT_COL_START), tip);
1132 }
1133
1143 static inline NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
1144 {
1145 NWidgetPart part;
1146
1147 part.type = WPT_PADDING;
1148 part.u.padding.top = top;
1149 part.u.padding.right = right;
1150 part.u.padding.bottom = bottom;
1151 part.u.padding.left = left;
1152
1153 return part;
1154 }
1155
1161 static inline NWidgetPart SetPadding(const RectPadding &padding)
1162 {
1163 NWidgetPart part;
1164
1165 part.type = WPT_PADDING;
1166 part.u.padding.left = padding.left;
1167 part.u.padding.top = padding.top;
1168 part.u.padding.right = padding.right;
1169 part.u.padding.bottom = padding.bottom;
1170
1171 return part;
1172 }
1173
1179 static inline NWidgetPart SetPadding(uint8 padding)
1180 {
1181 return SetPadding(padding, padding, padding, padding);
1182 }
1183
1191 static inline NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
1192 {
1193 NWidgetPart part;
1194
1195 part.type = WPT_PIPSPACE;
1196 part.u.pip.pre = pre;
1197 part.u.pip.inter = inter;
1198 part.u.pip.post = post;
1199
1200 return part;
1201 }
1202
1210 static inline NWidgetPart SetScrollbar(int index)
1211 {
1212 NWidgetPart part;
1213
1214 part.type = WPT_SCROLLBAR;
1215 part.u.widget.index = index;
1216
1217 return part;
1218 }
1219
1229 static inline NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx = -1)
1230 {
1231 NWidgetPart part;
1232
1233 part.type = tp;
1234 part.u.widget.colour = col;
1235 part.u.widget.index = idx;
1236
1237 return part;
1238 }
1239
1246 static inline NWidgetPart NWidget(WidgetType tp, NWidContainerFlags cont_flags = NC_NONE)
1247 {
1248 NWidgetPart part;
1249
1250 part.type = tp;
1251 part.u.cont_flags = cont_flags;
1252
1253 return part;
1254 }
1255
1261 static inline NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
1262 {
1263 NWidgetPart part;
1264
1265 part.type = WPT_FUNCTION;
1266 part.u.func_ptr = func_ptr;
1267
1268 return part;
1269 }
1270
1271 NWidgetContainer *MakeNWidgets(const NWidgetPart *parts, int count, int *biggest_index, NWidgetContainer *container);
1272 NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *parts, int count, int *biggest_index, NWidgetStacked **shade_select);
1273
1274 NWidgetBase *MakeCompanyButtonRows(int *biggest_index, int widget_first, int widget_last, Colours button_colour, int max_length, StringID button_tooltip);
1275
1276 void SetupWidgetDimensions();
1277
1278 #endif /* WIDGET_TYPE_H */
SZSP_NONE
@ SZSP_NONE
Display plane with zero size in both directions (none filling and resizing).
Definition: widget_type.h:428
NWidgetBackground::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:2141
NWidgetSpacer::NWidgetSpacer
NWidgetSpacer(int width, int height)
Generic spacer widget.
Definition: widget.cpp:1815
NWidgetResizeBase
Base class for a resizable nested widget.
Definition: widget_type.h:255
NWidgetPartTextLines::lines
uint8 lines
Number of text lines.
Definition: widget_type.h:942
NWidgetMatrix::clicked
int clicked
The currently clicked widget.
Definition: widget_type.h:558
NWidgetScrollbar::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:2465
NWidgetStacked::AssignSizePosition
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
Definition: widget.cpp:1350
NWidgetMatrix::widgets_y
int widgets_y
The number of visible widgets in vertical direction.
Definition: widget_type.h:565
NDB_LOWERED
@ NDB_LOWERED
Widget is lowered (pressed down) bit.
Definition: widget_type.h:283
NWidgetStacked::NWidgetStacked
NWidgetStacked()
Widgets stacked on top of each other.
Definition: widget.cpp:1288
NWidgetResizeBase::uz_min_x
uint uz_min_x
Unscaled Minimal horizontal size of only this widget.
Definition: widget_type.h:272
NWidgetPart::colour
NWidgetPartTextColour colour
Part with text colour data.
Definition: widget_type.h:984
NWidgetCore::IsDisabled
bool IsDisabled() const
Return whether the widget is disabled.
Definition: widget_type.h:395
WWT_IMGBTN_2
@ WWT_IMGBTN_2
(Toggle) Button with diff image when clicked
Definition: widget_type.h:51
WPT_DATATIP
@ WPT_DATATIP
Widget part for specifying data and tooltip.
Definition: widget_type.h:89
NWidgetFunction
static NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
Obtain a nested widget (sub)tree from an external source.
Definition: widget_type.h:1261
ComputeMaxSize
static uint ComputeMaxSize(uint base, uint max_space, uint step)
Return the biggest possible size of a nested widget.
Definition: widget_type.h:848
NWidgetCore::GetHighlightColour
TextColour GetHighlightColour() const override
Return the colour of the highlight.
Definition: widget_type.h:365
NWidgetCore::IsHighlighted
bool IsHighlighted() const override
Return whether the widget is highlighted.
Definition: widget_type.h:359
NWidgetPart::pip
NWidgetPartPIP pip
Part with pre/inter/post spaces.
Definition: widget_type.h:982
NWidgetSpacer::GetWidgetFromPos
NWidgetCore * GetWidgetFromPos(int x, int y) override
Definition: widget.cpp:1841
Scrollbar::SS_SMALL
@ SS_SMALL
Step in stepsize units.
Definition: widget_type.h:648
NWidgetPartPIP::post
uint8 post
Amount of space before/between/after child widgets.
Definition: widget_type.h:934
SetScrollbar
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1210
NWidgetPIPContainer::pip_inter
uint8 pip_inter
Amount of space between widgets.
Definition: widget_type.h:488
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
NWidgetPart::align
NWidgetPartAlignment align
Part with internal alignment.
Definition: widget_type.h:985
Scrollbar::GetCapacity
uint16 GetCapacity() const
Gets the number of visible elements of the scrollbar.
Definition: widget_type.h:669
NWidgetStacked::index
int index
If non-negative, index in the Window::nested_array.
Definition: widget_type.h:460
NWidgetLeaf::resizebox_dimension
static Dimension resizebox_dimension
Cached size of a resizebox widget.
Definition: widget_type.h:832
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:64
SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1143
Scrollbar::is_vertical
const bool is_vertical
Scrollbar has vertical orientation.
Definition: widget_type.h:638
NWidgetCore::SetHighlighted
void SetHighlighted(TextColour highlight_colour) override
Highlight the widget or not.
Definition: widget_type.h:352
SZSP_BEGIN
@ SZSP_BEGIN
First zero-size plane.
Definition: widget_type.h:430
NWidgetBase::GetVerticalStepSize
uint GetVerticalStepSize(SizingType sizing) const
Get the vertical sizing step.
Definition: widget_type.h:225
NWidgetContainer::Add
void Add(NWidgetBase *wid)
Append widget wid to container.
Definition: widget.cpp:1261
ND_SCROLLBAR_DOWN
@ ND_SCROLLBAR_DOWN
Bit value of the 'scrollbar down' flag.
Definition: widget_type.h:306
NWID_HSCROLLBAR
@ NWID_HSCROLLBAR
Horizontal scrollbar.
Definition: widget_type.h:81
Scrollbar::ScrollbarStepping
ScrollbarStepping
Stepping sizes when scrolling.
Definition: widget_type.h:646
NWidgetViewport
Nested widget to display a viewport in a window.
Definition: widget_type.h:622
Scrollbar::ScrollTowards
void ScrollTowards(int position)
Scroll towards the given position; if the item is visible nothing happens, otherwise it will be shown...
Definition: widget_type.h:780
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
Scrollbar::pos
uint16 pos
Index of first visible item of the list.
Definition: widget_type.h:641
NWidgetPartPaddings
Widget part for storing padding.
Definition: widget_type.h:926
NWidgetMatrix
Matrix container with implicitly equal sized (virtual) sub-widgets.
Definition: widget_type.h:539
WWT_IMGBTN
@ WWT_IMGBTN
(Toggle) Button with image
Definition: widget_type.h:50
NWidgetBase::GetHorizontalStepSize
uint GetHorizontalStepSize(SizingType sizing) const
Get the horizontal sizing step.
Definition: widget_type.h:216
NDB_DROPDOWN_CLOSED
@ NDB_DROPDOWN_CLOSED
Dropdown menu of the dropdown widget has closed.
Definition: widget_type.h:296
NWidgetPIPContainer::uz_pip_post
uint8 uz_pip_post
Unscaled space after last widget.
Definition: widget_type.h:493
ND_SHADE_DIMMED
@ ND_SHADE_DIMMED
Bit value of the 'dimmed colours' flag.
Definition: widget_type.h:303
WWT_LABEL
@ WWT_LABEL
Centered label.
Definition: widget_type.h:55
math_func.hpp
NWidgetBase::uz_padding
RectPadding uz_padding
Unscaled padding, for resize calculation.
Definition: widget_type.h:206
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition: widget_type.h:63
NWidgetResizeBase::SetMinimalTextLines
void SetMinimalTextLines(uint8 min_lines, uint8 spacing, FontSize size)
Set minimal text lines for the widget.
Definition: widget.cpp:1106
NWidgetStacked::Draw
void Draw(const Window *w) override
Definition: widget.cpp:1376
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
NWidgetMatrix::Draw
void Draw(const Window *w) override
Definition: widget.cpp:2003
NWidgetLeaf::stickybox_dimension
static Dimension stickybox_dimension
Cached size of a stickybox widget.
Definition: widget_type.h:838
NDB_SCROLLBAR_DOWN
@ NDB_SCROLLBAR_DOWN
Down-button is lowered bit.
Definition: widget_type.h:293
NDB_SHADE_DIMMED
@ NDB_SHADE_DIMMED
Display dimmed colours in the viewport.
Definition: widget_type.h:288
window_type.h
WWT_MATRIX
@ WWT_MATRIX
Grid of rows and columns.
Definition: widget_type.h:57
ArrowWidgetValues
ArrowWidgetValues
Values for an arrow widget.
Definition: widget_type.h:34
NWID_HORIZONTAL_LTR
@ NWID_HORIZONTAL_LTR
Horizontal container that doesn't change the order of the widgets for RTL languages.
Definition: widget_type.h:74
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103
NWidgetSpacer
Spacer widget.
Definition: widget_type.h:575
WWT_ARROWBTN
@ WWT_ARROWBTN
(Toggle) Button with an arrow
Definition: widget_type.h:52
NWidgetBase::NWidgetBase
NWidgetBase(WidgetType tp)
Base class constructor.
Definition: widget.cpp:970
NWidgetResizeBase::uz_min_y
uint uz_min_y
Unscaled Minimal vertical size of only this widget.
Definition: widget_type.h:273
Scrollbar::SetCount
void SetCount(int num)
Sets the number of elements in the list.
Definition: widget_type.h:717
MAT_ROW_START
@ MAT_ROW_START
Lowest bit of the number of rows.
Definition: widget_type.h:29
TextColour
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
Definition: gfx_type.h:253
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:997
NWidgetLeaf
Leaf widget.
Definition: widget_type.h:820
ZoomLevel
ZoomLevel
All zoom levels we know.
Definition: zoom_type.h:19
NWidgetMatrix::SetScrollbar
void SetScrollbar(Scrollbar *sb)
Assign a scrollbar to this matrix.
Definition: widget.cpp:1905
StringAlignment
StringAlignment
How to align the to-be drawn text.
Definition: gfx_type.h:333
NWidgetMatrix::count
int count
Amount of valid widgets.
Definition: widget_type.h:559
NWidgetPart::xy
Point xy
Part with an x/y size.
Definition: widget_type.h:978
NWidgetSpacer::FillNestedArray
void FillNestedArray(NWidgetBase **array, uint length) override
Definition: widget.cpp:1827
SZSP_HORIZONTAL
@ SZSP_HORIZONTAL
Display plane with zero size vertically, and filling and resizing horizontally.
Definition: widget_type.h:427
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:46
WWT_PUSHARROWBTN
@ WWT_PUSHARROWBTN
Normal push-button (no toggle button) with arrow caption.
Definition: widget_type.h:106
NWidgetBase::FillNestedArray
virtual void FillNestedArray(NWidgetBase **array, uint length)=0
NWidgetCore::tool_tip
StringID tool_tip
Tooltip of the widget.
Definition: widget_type.h:341
NWidgetContainer::GetWidgetOfType
NWidgetBase * GetWidgetOfType(WidgetType tp) override
Retrieve a widget by its type.
Definition: widget.cpp:1239
NWidgetCore::SetLowered
void SetLowered(bool lowered)
Lower or raise the widget.
Definition: widget_type.h:374
strings_type.h
Scrollbar::GetScrolledRowFromWidget
int GetScrolledRowFromWidget(int clickpos, const Window *const w, int widget, int padding=0) const
Compute the row of a scrolled widget that a user clicked in.
Definition: widget.cpp:2353
NWidgetLeaf::shadebox_dimension
static Dimension shadebox_dimension
Cached size of a shadebox widget.
Definition: widget_type.h:835
NWidgetBase::SetPadding
void SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Set additional space (padding) around the widget.
Definition: widget_type.h:150
NWID_MATRIX
@ NWID_MATRIX
Matrix container.
Definition: widget_type.h:76
NWidgetBase::smallest_y
uint smallest_y
Smallest vertical size of the widget in a filled window.
Definition: widget_type.h:194
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:636
NCB_BIGFIRST
@ NCB_BIGFIRST
Allocate space to biggest resize first.
Definition: widget_type.h:466
MakeNWidgets
NWidgetContainer * MakeNWidgets(const NWidgetPart *parts, int count, int *biggest_index, NWidgetContainer *container)
Construct a nested widget tree from an array of parts.
Definition: widget.cpp:3250
NWidgetMatrix::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:1910
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:975
NWidgetVertical::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:1655
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1111
NWidgetPIPContainer::uz_pip_inter
uint8 uz_pip_inter
Unscaled space between widgets.
Definition: widget_type.h:492
NWidgetMatrix::sb
Scrollbar * sb
The scrollbar we're associated with.
Definition: widget_type.h:560
MAT_COL_START
@ MAT_COL_START
Lowest bit of the number of columns.
Definition: widget_type.h:25
NWidgetCore::widget_data
uint32 widget_data
Data of the widget.
Definition: widget_type.h:340
SETBITS
#define SETBITS(x, y)
Sets several bits in a variable.
Definition: bitmath_func.hpp:136
alloc_type.hpp
NWidgetBase::Draw
virtual void Draw(const Window *w)=0
NWidgetMatrix::SetCount
void SetCount(int count)
Set the number of elements in this matrix.
Definition: widget.cpp:1881
NWidgetBase::prev
NWidgetBase * prev
Pointer to previous widget in container. Managed by parent container widget.
Definition: widget_type.h:203
NWidgetStacked::FillNestedArray
void FillNestedArray(NWidgetBase **array, uint length) override
Definition: widget.cpp:1370
NWidgetLeaf::InvalidateDimensionCache
static void InvalidateDimensionCache()
Reset the cached dimensions.
Definition: widget.cpp:2544
NWidgetResizeBase::NWidgetResizeBase
NWidgetResizeBase(WidgetType tp, uint fill_x, uint fill_y)
Constructor for resizable nested widgets.
Definition: widget.cpp:1060
RectPadding
Padding dimensions to apply to each side of a Rect.
Definition: geometry_type.hpp:47
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:469
ND_DROPDOWN_ACTIVE
@ ND_DROPDOWN_ACTIVE
Bit value of the 'dropdown active' flag.
Definition: widget_type.h:304
Scrollbar::UpdatePosition
bool UpdatePosition(int difference, ScrollbarStepping unit=SS_SMALL)
Updates the position of the first visible element by the given amount.
Definition: widget_type.h:763
bitmath_func.hpp
AWV_LEFT
@ AWV_LEFT
Force the arrow to the left.
Definition: widget_type.h:37
NWidgetResizeBase::AssignSizePosition
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
Definition: widget.cpp:1136
WPT_FILL
@ WPT_FILL
Widget part for specifying fill.
Definition: widget_type.h:88
NDB_HIGHLIGHT
@ NDB_HIGHLIGHT
Highlight of widget is on.
Definition: widget_type.h:295
NWidgetLeaf::NWidgetLeaf
NWidgetLeaf(WidgetType tp, Colours colour, int index, uint32 data, StringID tip)
Nested leaf widget.
Definition: widget.cpp:2571
NWidgetBackground::AssignSizePosition
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
Definition: widget.cpp:2208
WWT_PUSHBTN
@ WWT_PUSHBTN
Normal push-button (no toggle button) with custom drawing.
Definition: widget_type.h:103
NWidgetLeaf::dropdown_dimension
static Dimension dropdown_dimension
Cached size of a dropdown widget.
Definition: widget_type.h:831
ST_SMALLEST
@ ST_SMALLEST
Initialize nested widget tree to smallest size. Also updates current_x and current_y.
Definition: widget_type.h:112
NWidgetPartPIP
Widget part for storing pre/inter/post spaces.
Definition: widget_type.h:933
ND_HIGHLIGHT
@ ND_HIGHLIGHT
Bit value of the highlight flag.
Definition: widget_type.h:300
NWidgetViewport::UpdateViewportCoordinates
void UpdateViewportCoordinates(Window *w)
Update the position and size of the viewport (after eg a resize).
Definition: widget.cpp:2331
Scrollbar::GetCount
uint16 GetCount() const
Gets the number of elements in the list.
Definition: widget_type.h:660
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition: gfx_type.h:203
NWidgetContainer::tail
NWidgetBase * tail
Pointer to last widget in container.
Definition: widget_type.h:421
NWID_VIEWPORT
@ NWID_VIEWPORT
Nested widget containing a viewport.
Definition: widget_type.h:79
NWidgetViewport::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:2286
WWT_EDITBOX
@ WWT_EDITBOX
a textbox for typing
Definition: widget_type.h:69
NWidgetBase::type
WidgetType type
Type of the widget / nested widget.
Definition: widget_type.h:185
NWidgetResizeBase::SetResize
void SetResize(uint resize_x, uint resize_y)
Set resize step of the widget.
Definition: widget.cpp:1130
NWidgetBase::smallest_x
uint smallest_x
Smallest horizontal size of the widget in a filled window.
Definition: widget_type.h:193
NWidgetBase::AssignSizePosition
virtual void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)=0
NWidgetLeaf::debugbox_dimension
static Dimension debugbox_dimension
Cached size of a debugbox widget.
Definition: widget_type.h:836
IsInsideBS
static bool IsInsideBS(const T x, const size_t base, const size_t size)
Checks if a value is between a window started at some base point.
Definition: math_func.hpp:214
NWidgetBase::GetWidgetOfType
virtual NWidgetBase * GetWidgetOfType(WidgetType tp)
Retrieve a widget by its type.
Definition: widget.cpp:1044
WPT_PIPSPACE
@ WPT_PIPSPACE
Widget part for specifying pre/inter/post space for containers.
Definition: widget_type.h:91
ZeroedMemoryAllocator
Base class that provides memory initialization on dynamically created objects.
Definition: alloc_type.hpp:85
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:126
NWidgetBackground::GetWidgetOfType
NWidgetBase * GetWidgetOfType(WidgetType tp) override
Retrieve a widget by its type.
Definition: widget.cpp:2273
Scrollbar::IsVertical
bool IsVertical() const
Is the scrollbar vertical or not?
Definition: widget_type.h:697
NWidgetMatrix::GetWidgetFromPos
NWidgetCore * GetWidgetFromPos(int x, int y) override
Definition: widget.cpp:1971
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
SetMatrixDataTip
static NWidgetPart SetMatrixDataTip(uint8 cols, uint8 rows, StringID tip)
Widget part function for setting the data and tooltip of WWT_MATRIX widgets.
Definition: widget_type.h:1129
Scrollbar::UpdateListPositionOnKeyPress
EventState UpdateListPositionOnKeyPress(int &list_position, uint16 keycode) const
Update the given list position as if it were on this scroll bar when the given keycode was pressed.
Definition: widget.cpp:2374
NWidgetPart::widget
NWidgetPartWidget widget
Part with a start of a widget.
Definition: widget_type.h:980
NWidgetPartWidget::index
int16 index
Widget index in the widget array.
Definition: widget_type.h:919
WPT_SCROLLBAR
@ WPT_SCROLLBAR
Widget part for attaching a scrollbar.
Definition: widget_type.h:96
MAT_COL_BITS
@ MAT_COL_BITS
Number of bits for the number of columns in the matrix.
Definition: widget_type.h:26
NWidgetPIPContainer::pip_pre
uint8 pip_pre
Amount of space before first widget.
Definition: widget_type.h:487
NWidgetResizeBase::uz_text_size
FontSize uz_text_size
'Unscaled' font size, stored for resize calculation.
Definition: widget_type.h:277
NWidgetDisplay
NWidgetDisplay
Nested widget flags that affect display and interaction with 'real' widgets.
Definition: widget_type.h:281
NWidgetBackground::SetPIP
void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post)
Set additional pre/inter/post space for the background widget.
Definition: widget.cpp:2127
NWidgetLeaf::defsizebox_dimension
static Dimension defsizebox_dimension
Cached size of a defsizebox widget.
Definition: widget_type.h:837
ND_LOWERED
@ ND_LOWERED
Bit value of the lowered flag.
Definition: widget_type.h:298
NWidgetPartTextLines
Widget part for storing minimal text line data.
Definition: widget_type.h:941
WWT_LAST
@ WWT_LAST
Last Item. use WIDGETS_END to fill up padding!!
Definition: widget_type.h:70
WPT_ALIGNMENT
@ WPT_ALIGNMENT
Widget part for specifying text/image alignment.
Definition: widget_type.h:93
NWidgetContainer::NWidgetContainer
NWidgetContainer(WidgetType tp)
Constructor container baseclass.
Definition: widget.cpp:1223
ND_DISABLED
@ ND_DISABLED
Bit value of the disabled flag.
Definition: widget_type.h:299
Scrollbar::SS_RAW
@ SS_RAW
Step in single units.
Definition: widget_type.h:647
NWidgetPart::func_ptr
NWidgetFunctionType * func_ptr
Part with a function call.
Definition: widget_type.h:986
NDB_SCROLLBAR_UP
@ NDB_SCROLLBAR_UP
Up-button is lowered bit.
Definition: widget_type.h:292
Scrollbar::count
uint16 count
Number of elements in the list.
Definition: widget_type.h:639
NWidgetPart::padding
NWidgetPartPaddings padding
Part with paddings.
Definition: widget_type.h:981
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
WPT_MINSIZE
@ WPT_MINSIZE
Widget part for specifying minimal size.
Definition: widget_type.h:86
NWidgetCore::IsLowered
bool IsLowered() const
Return whether the widget is lowered.
Definition: widget_type.h:380
NWidgetPartWidget
Widget part for storing basic widget information.
Definition: widget_type.h:917
NWidgetHorizontal::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:1470
NWidgetPartTextLines::spacing
uint8 spacing
Extra spacing around lines.
Definition: widget_type.h:943
NDB_NO_TRANSPARENCY
@ NDB_NO_TRANSPARENCY
Viewport is never transparent.
Definition: widget_type.h:286
WWT_FRAME
@ WWT_FRAME
Frame.
Definition: widget_type.h:58
NWidgetStacked::GetWidgetFromPos
NWidgetCore * GetWidgetFromPos(int x, int y) override
Definition: widget.cpp:1391
NWidgetContainer::head
NWidgetBase * head
Pointer to first widget in container.
Definition: widget_type.h:420
NWidgetMatrix::index
int index
If non-negative, index in the Window::nested_array.
Definition: widget_type.h:556
NWidgetPartDataTip
Widget part for storing data and tooltip information.
Definition: widget_type.h:908
NWidgetHorizontal::AssignSizePosition
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
Definition: widget.cpp:1537
NWidgetStacked::SetDisplayedPlane
void SetDisplayedPlane(int plane)
Select which plane to show (for NWID_SELECTION only).
Definition: widget.cpp:1409
NWidgetPIPContainer::uz_pip_pre
uint8 uz_pip_pre
Unscaled space before first widget.
Definition: widget_type.h:491
NWidgetBase::current_y
uint current_y
Current vertical size (after resizing).
Definition: widget_type.h:197
NWidgetStacked
Stacked widgets, widgets all occupying the same space in the window.
Definition: widget_type.h:443
NWidgetScrollbar::vertical_dimension
static Dimension vertical_dimension
Cached size of vertical scrollbar button.
Definition: widget_type.h:812
NWidgetBase::next
NWidgetBase * next
Pointer to next widget in container. Managed by parent container widget.
Definition: widget_type.h:202
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
WidgetType
WidgetType
Window widget types, nested widget types, and nested widget part types.
Definition: widget_type.h:44
NWidgetResizeBase::SetFill
void SetFill(uint fill_x, uint fill_y)
Set the filling of the widget from initial size.
Definition: widget.cpp:1119
WWT_TEXTBTN_2
@ WWT_TEXTBTN_2
(Toggle) Button with diff text when clicked
Definition: widget_type.h:54
NWidgetSpacer::SetDirty
void SetDirty(const Window *w) const override
Mark the widget as 'dirty' (in need of repaint).
Definition: widget.cpp:1836
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:67
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:66
WPT_MINTEXTLINES
@ WPT_MINTEXTLINES
Widget part for specifying minimal number of lines of text.
Definition: widget_type.h:87
NWidgetContainer::IsEmpty
bool IsEmpty()
Return whether the container is empty.
Definition: widget_type.h:415
Scrollbar::cap
uint16 cap
Number of visible elements of the scroll bar.
Definition: widget_type.h:640
NWidgetBase::GetWidgetFromPos
virtual NWidgetCore * GetWidgetFromPos(int x, int y)=0
Scrollbar::SetCapacity
void SetCapacity(int capacity)
Set the capacity of visible elements.
Definition: widget_type.h:733
NWidgetSpacer::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:1821
NWidgetBase::SetPadding
void SetPadding(const RectPadding &padding)
Set additional space (padding) around the widget.
Definition: widget_type.h:163
NWidgetBackground::GetWidgetFromPos
NWidgetCore * GetWidgetFromPos(int x, int y) override
Definition: widget.cpp:2263
NWidgetMatrix::GetScrollOffsets
void GetScrollOffsets(int &start_x, int &start_y, int &base_offs_x, int &base_offs_y)
Get the different offsets that are influenced by scrolling.
Definition: widget.cpp:2058
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
NWidgetSpacer::Draw
void Draw(const Window *w) override
Definition: widget.cpp:1831
WWT_PUSHIMGBTN
@ WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition: widget_type.h:105
NWidgetBase::fill_y
uint fill_y
Vertical fill stepsize (from initial size, 0 means not resizable).
Definition: widget_type.h:187
NWidgetPart::cont_flags
NWidContainerFlags cont_flags
Part with container flags.
Definition: widget_type.h:987
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1096
Clamp
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition: math_func.hpp:77
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:82
ND_DROPDOWN_CLOSED
@ ND_DROPDOWN_CLOSED
Bit value of the 'dropdown closed' flag.
Definition: widget_type.h:308
NWidgetCore::disp_flags
NWidgetDisplay disp_flags
Flags that affect display and interaction with the widget.
Definition: widget_type.h:337
NWidgetBase::pos_x
int pos_x
Horizontal position of top-left corner of the widget in the window.
Definition: widget_type.h:199
NWidgetHorizontal
Horizontal container.
Definition: widget_type.h:500
ST_RESIZE
@ ST_RESIZE
Resize the nested widget tree.
Definition: widget_type.h:113
NWidgetBackground::NWidgetBackground
NWidgetBackground(WidgetType tp, Colours colour, int index, NWidgetPIPContainer *child=nullptr)
Constructor parent nested widgets.
Definition: widget.cpp:2089
WIDGET_LIST_END
static const int WIDGET_LIST_END
indicate the end of widgets' list for vararg functions
Definition: widget_type.h:20
NWidgetMatrix::FillNestedArray
void FillNestedArray(NWidgetBase **array, uint length) override
Definition: widget.cpp:1965
NWidgetResizeBase::uz_text_spacing
uint8 uz_text_spacing
'Unscaled' text padding, stored for resize calculation.
Definition: widget_type.h:276
WWT_TEXT
@ WWT_TEXT
Pure simple text.
Definition: widget_type.h:56
NWidgetPIPContainer
Container with pre/inter/post child space.
Definition: widget_type.h:475
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1229
NWidgetBase::fill_x
uint fill_x
Horizontal fill stepsize (from initial size, 0 means not resizable).
Definition: widget_type.h:186
NWidgetScrollbar
Nested widget to display and control a scrollbar in a window.
Definition: widget_type.h:800
Scrollbar::IsVisible
bool IsVisible(uint16 item) const
Checks whether given current item is visible in the list.
Definition: widget_type.h:688
NWidgetBackground::Draw
void Draw(const Window *w) override
Definition: widget.cpp:2226
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1014
WPT_RESIZE
@ WPT_RESIZE
Widget part for specifying resizing.
Definition: widget_type.h:85
NWidgetViewport::InitializeViewport
void InitializeViewport(Window *w, uint32 follow_flags, ZoomLevel zoom)
Initialize the viewport of the window.
Definition: widget.cpp:2322
NWidgetPIPContainer::flags
NWidContainerFlags flags
Flags of the container.
Definition: widget_type.h:486
NWidgetPartTextColour::colour
TextColour colour
TextColour for DrawString.
Definition: widget_type.h:952
NDB_SHADE_GREY
@ NDB_SHADE_GREY
Shade viewport to grey-scale.
Definition: widget_type.h:287
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
NWidgetPIPContainer::pip_post
uint8 pip_post
Amount of space after last widget.
Definition: widget_type.h:489
NWidgetStacked::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:1306
NWidgetBase::resize_y
uint resize_y
Vertical resize step (0 means not resizable).
Definition: widget_type.h:189
WPT_TEXTCOLOUR
@ WPT_TEXTCOLOUR
Widget part for specifying text colour.
Definition: widget_type.h:92
NWidgetBase::StoreSizePosition
void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height)
Store size and position.
Definition: widget_type.h:238
NWidgetPartAlignment
Widget part for setting text/image alignment within a widget.
Definition: widget_type.h:959
EventState
EventState
State of handling an event.
Definition: window_type.h:719
NWidgetVertical
Vertical container.
Definition: widget_type.h:523
NWidgetBackground::child
NWidgetPIPContainer * child
Child widget.
Definition: widget_type.h:610
Scrollbar::GetPosition
uint16 GetPosition() const
Gets the position of the first visible element in the list.
Definition: widget_type.h:678
NWidgetPart::data_tip
NWidgetPartDataTip data_tip
Part with a data/tooltip.
Definition: widget_type.h:979
NWidgetContainer::FillNestedArray
void FillNestedArray(NWidgetBase **array, uint length) override
Definition: widget.cpp:1278
MAX_UVALUE
#define MAX_UVALUE(type)
The largest value that can be entered in a variable.
Definition: stdafx.h:479
NWidgetCore::colour
Colours colour
Colour of this widget.
Definition: widget_type.h:338
NWidgetMatrix::widget_h
int widget_h
The height of the child widget including inter spacing.
Definition: widget_type.h:563
NWidgetCore::highlight_colour
TextColour highlight_colour
Colour of highlight.
Definition: widget_type.h:343
NCB_EQUALSIZE
@ NCB_EQUALSIZE
Containers should keep all their (resizing) children equally large.
Definition: widget_type.h:465
NWidgetResizeBase::uz_text_lines
uint8 uz_text_lines
'Unscaled' text lines, stored for resize calculation.
Definition: widget_type.h:275
Scrollbar::stepsize
uint16 stepsize
Distance to scroll, when pressing the buttons or using the wheel.
Definition: widget_type.h:642
NWID_SPACER
@ NWID_SPACER
Invisible widget that takes some space.
Definition: widget_type.h:77
WWT_INSET
@ WWT_INSET
Pressed (inset) panel, most commonly used as combo box text area.
Definition: widget_type.h:49
SetAlignment
static NWidgetPart SetAlignment(StringAlignment align)
Widget part function for setting the alignment of text/images.
Definition: widget_type.h:1064
NWidgetContainer
Baseclass for container widgets.
Definition: widget_type.h:405
NC_NONE
@ NC_NONE
All flags cleared.
Definition: widget_type.h:468
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
NWidgetCore::scrollbar_index
int scrollbar_index
Index of an attached scrollbar.
Definition: widget_type.h:342
NWidgetBase::SetDirty
virtual void SetDirty(const Window *w) const
Mark the widget as 'dirty' (in need of repaint).
Definition: widget.cpp:1024
Scrollbar::SetCapacityFromWidget
void SetCapacityFromWidget(Window *w, int widget, int padding=0)
Set capacity of visible elements from the size and resize properties of a widget.
Definition: widget.cpp:2427
StackedZeroSizePlanes
StackedZeroSizePlanes
Display planes with zero size for NWidgetStacked.
Definition: widget_type.h:425
NWidgetHorizontalLTR::NWidgetHorizontalLTR
NWidgetHorizontalLTR(NWidContainerFlags flags=NC_NONE)
Horizontal left-to-right container widget.
Definition: widget.cpp:1640
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1191
NWidgetPartTextColour
Widget part for storing text colour.
Definition: widget_type.h:951
NWidgetHorizontalLTR::AssignSizePosition
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
Definition: widget.cpp:1645
NWidgetResizeBase::min_x
uint min_x
Minimal horizontal size of only this widget.
Definition: widget_type.h:268
NWidgetBase::pos_y
int pos_y
Vertical position of top-left corner of the widget in the window.
Definition: widget_type.h:200
ND_SCROLLBAR_UP
@ ND_SCROLLBAR_UP
Bit value of the 'scrollbar up' flag.
Definition: widget_type.h:305
NWidgetCore::align
StringAlignment align
Alignment of text/image within widget.
Definition: widget_type.h:345
Scrollbar::SS_BIG
@ SS_BIG
Step in cap units.
Definition: widget_type.h:649
Scrollbar::SetStepSize
void SetStepSize(uint16 stepsize)
Set the distance to scroll when using the buttons or the wheel.
Definition: widget_type.h:706
NWidgetScrollbar::NWidgetScrollbar
NWidgetScrollbar(WidgetType tp, Colours colour, int index)
Scrollbar widget.
Definition: widget.cpp:2443
ND_SHADE_GREY
@ ND_SHADE_GREY
Bit value of the 'shade to grey' flag.
Definition: widget_type.h:302
WPT_PADDING
@ WPT_PADDING
Widget part for specifying a padding.
Definition: widget_type.h:90
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1080
NWidgetCore::text_colour
TextColour text_colour
Colour of text within widget.
Definition: widget_type.h:344
NWidgetPart::type
WidgetType type
Type of the part.
Definition: widget_type.h:976
NWidgetResizeBase::min_y
uint min_y
Minimal vertical size of only this widget.
Definition: widget_type.h:269
NWidgetHorizontalLTR
Horizontal container that doesn't change the direction of the widgets for RTL languages.
Definition: widget_type.h:512
FontSize
FontSize
Available font sizes.
Definition: gfx_type.h:202
NWidgetMatrix::widget_w
int widget_w
The width of the child widget including inter spacing.
Definition: widget_type.h:562
NWidgetBackground::Add
void Add(NWidgetBase *nwid)
Add a child to the parent.
Definition: widget.cpp:2109
SetTextColour
static NWidgetPart SetTextColour(TextColour colour)
Widget part function for setting the text colour.
Definition: widget_type.h:1049
MAT_ROW_BITS
@ MAT_ROW_BITS
Number of bits for the number of rows in the matrix.
Definition: widget_type.h:30
Window
Data structure for an opened window.
Definition: window_gui.h:213
SizingType
SizingType
Different forms of sizing nested widgets, using NWidgetBase::AssignSizePosition()
Definition: widget_type.h:111
NWidContainerFlags
NWidContainerFlags
Nested widget container flags,.
Definition: widget_type.h:464
SZSP_VERTICAL
@ SZSP_VERTICAL
Display plane with zero size horizontally, and filling and resizing vertically.
Definition: widget_type.h:426
NWidgetResizeBase::absolute
bool absolute
Set if minimum size is fixed and should not be resized.
Definition: widget_type.h:271
MatrixWidgetValues
MatrixWidgetValues
Bits of the WWT_MATRIX widget data.
Definition: widget_type.h:23
NWidgetBackground
Nested widget with a child.
Definition: widget_type.h:591
NDB_DISABLED
@ NDB_DISABLED
Widget is disabled (greyed out) bit.
Definition: widget_type.h:284
NWidgetVertical::NWidgetVertical
NWidgetVertical(NWidContainerFlags flags=NC_NONE)
Vertical container widget.
Definition: widget.cpp:1651
NWidgetViewport::Draw
void Draw(const Window *w) override
Definition: widget.cpp:2296
NWID_SELECTION
@ NWID_SELECTION
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition: widget_type.h:78
NWidgetCore::index
int index
Index of the nested widget in the widget array of the window (-1 means 'not used').
Definition: widget_type.h:339
NWidgetMatrix::colour
Colours colour
Colour of this widget.
Definition: widget_type.h:557
NWidgetCore
Base class for a 'real' widget.
Definition: widget_type.h:316
SetupWidgetDimensions
void SetupWidgetDimensions()
Set up pre-scaled versions of Widget Dimensions.
Definition: widget.cpp:199
NWidgetLeaf::closebox_dimension
static Dimension closebox_dimension
Cached size of a closebox widget.
Definition: widget_type.h:833
AWV_RIGHT
@ AWV_RIGHT
Force the arrow to the right.
Definition: widget_type.h:38
WWT_DEBUGBOX
@ WWT_DEBUGBOX
NewGRF debug box (at top-right of a window, between WWT_CAPTION and WWT_SHADEBOX)
Definition: widget_type.h:61
gfx_type.h
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:69
NWidgetPartDataTip::tooltip
StringID tooltip
Tooltip of the widget.
Definition: widget_type.h:910
WPT_FUNCTION
@ WPT_FUNCTION
Widget part for calling a user function.
Definition: widget_type.h:95
NWidgetLeaf::Draw
void Draw(const Window *w) override
Definition: widget.cpp:2838
NWidgetVertical::AssignSizePosition
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
Definition: widget.cpp:1722
NWidgetBase::resize_x
uint resize_x
Horizontal resize step (0 means not resizable).
Definition: widget_type.h:188
AWV_INCREASE
@ AWV_INCREASE
Arrow to the right or in case of RTL to the left.
Definition: widget_type.h:36
NWidgetPartWidget::colour
Colours colour
Widget colour.
Definition: widget_type.h:918
NWidgetPartTextLines::size
FontSize size
Font size of text lines.
Definition: widget_type.h:944
CLRBITS
#define CLRBITS(x, y)
Clears several bits in a variable.
Definition: bitmath_func.hpp:166
NWidgetBase::current_x
uint current_x
Current horizontal size (after resizing).
Definition: widget_type.h:196
NWidgetStacked::shown_plane
int shown_plane
Plane being displayed (for NWID_SELECTION only).
Definition: widget_type.h:459
NWidgetMatrix::AssignSizePosition
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override
Definition: widget.cpp:1941
MakeCompanyButtonRows
NWidgetBase * MakeCompanyButtonRows(int *biggest_index, int widget_first, int widget_last, Colours button_colour, int max_length, StringID button_tooltip)
Make a number of rows with button-like graphics, for enabling/disabling each company.
Definition: widget.cpp:3323
NWidgetResizeBase::SetMinimalSize
void SetMinimalSize(uint min_x, uint min_y)
Set minimal size of the widget.
Definition: widget.cpp:1080
NWidgetScrollbar::horizontal_dimension
static Dimension horizontal_dimension
Cached size of horizontal scrollbar button.
Definition: widget_type.h:813
NWidgetLeaf::SetupSmallestSize
void SetupSmallestSize(Window *w, bool init_array) override
Definition: widget.cpp:2663
NWidgetResizeBase::SetMinimalSizeAbsolute
void SetMinimalSizeAbsolute(uint min_x, uint min_y)
Set absolute (post-scaling) minimal size of the widget.
Definition: widget.cpp:1093
NWidgetScrollbar::Draw
void Draw(const Window *w) override
Definition: widget.cpp:2490
NWidgetLeaf::ButtonHit
bool ButtonHit(const Point &pt)
For a NWID_BUTTON_DROPDOWN, test whether pt refers to the button or to the drop-down.
Definition: widget.cpp:2976
MakeWindowNWidgetTree
NWidgetContainer * MakeWindowNWidgetTree(const NWidgetPart *parts, int count, int *biggest_index, NWidgetStacked **shade_select)
Make a nested widget tree for a window from a parts array.
Definition: widget.cpp:3272
NWidgetHorizontal::NWidgetHorizontal
NWidgetHorizontal(NWidContainerFlags flags=NC_NONE)
Horizontal container widget.
Definition: widget.cpp:1466
NWidgetBackground::FillNestedArray
void FillNestedArray(NWidgetBase **array, uint length) override
Definition: widget.cpp:2220
NWidgetCore::SetDisabled
void SetDisabled(bool disabled)
Disable (grey-out) or enable the widget.
Definition: widget_type.h:389
NWidgetBase::padding
RectPadding padding
Padding added to the widget. Managed by parent container widget. (parent container may swap left and ...
Definition: widget_type.h:205
ND_SCROLLBAR_BTN
@ ND_SCROLLBAR_BTN
Bit value of the 'scrollbar up' or 'scrollbar down' flag.
Definition: widget_type.h:307
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:53
NWID_BUTTON_DROPDOWN
@ NWID_BUTTON_DROPDOWN
Button with a drop-down.
Definition: widget_type.h:80
Scrollbar::SetPosition
bool SetPosition(int position)
Sets the position of the first visible element.
Definition: widget_type.h:749
NWidgetPartDataTip::data
uint32 data
Data value of the widget.
Definition: widget_type.h:909
NWidgetMatrix::widgets_x
int widgets_x
The number of visible widgets in horizontal direction.
Definition: widget_type.h:564
AWV_DECREASE
@ AWV_DECREASE
Arrow to the left or in case of RTL to the right.
Definition: widget_type.h:35
SetMinimalTextLines
static NWidgetPart SetMinimalTextLines(uint8 lines, uint8 spacing, FontSize size=FS_NORMAL)
Widget part function for setting the minimal text lines.
Definition: widget_type.h:1032
WWT_DROPDOWN
@ WWT_DROPDOWN
Drop down list.
Definition: widget_type.h:68
ND_NO_TRANSPARENCY
@ ND_NO_TRANSPARENCY
Bit value of the 'no transparency' flag.
Definition: widget_type.h:301
NC_BIGFIRST
@ NC_BIGFIRST
Value of the NCB_BIGFIRST flag.
Definition: widget_type.h:470
NWidgetPart::text_lines
NWidgetPartTextLines text_lines
Part with text line data.
Definition: widget_type.h:983
NDB_DROPDOWN_ACTIVE
@ NDB_DROPDOWN_ACTIVE
Dropdown menu of the button dropdown widget is active.
Definition: widget_type.h:290
NWidgetPartAlignment::align
StringAlignment align
Alignment of text/image.
Definition: widget_type.h:960
NWidgetBase::SetupSmallestSize
virtual void SetupSmallestSize(Window *w, bool init_array)=0
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:62
NWidgetFunctionType
NWidgetBase * NWidgetFunctionType(int *biggest_index)
Pointer to function returning a nested widget.
Definition: widget_type.h:969
NWidgetMatrix::SetClicked
void SetClicked(int clicked)
Sets the clicked widget in the matrix.
Definition: widget.cpp:1864
WPT_ENDCONTAINER
@ WPT_ENDCONTAINER
Widget part to denote end of a container.
Definition: widget_type.h:94