OpenTTD Source: src/signs_gui.cpp Source File

OpenTTD Source 15.0-RC2

signs_gui.cpp
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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#include "stdafx.h"
11#include "company_gui.h"
12#include "company_func.h"
13#include "signs_base.h"
14#include "signs_func.h"
15#include "debug.h"
16#include "command_func.h"
17#include "strings_func.h"
18#include "window_func.h"
19#include "map_func.h"
20#include "viewport_func.h"
21#include "querystring_gui.h"
22#include "sortlist_type.h"
23#include "tilehighlight_func.h"
24#include "stringfilter_type.h"
25#include "string_func.h"
26#include "core/geometry_func.hpp"
27#include "hotkeys.h"
28#include "transparency.h"
29#include "gui.h"
30#include "signs_cmd.h"
31#include "timer/timer.h"
32#include "timer/timer_window.h"
33
34#include "widgets/sign_widget.h"
35
36#include "table/strings.h"
37#include "table/sprites.h"
38
39#include "safeguards.h"
40
41 struct SignList {
45 typedef GUIList<const Sign *, std::nullptr_t, StringFilter &> GUISignList;
46
47 GUISignList signs;
48
49 StringFilter string_filter;
50 static bool match_case;
51 static std::string default_name;
52
56 SignList() : string_filter(&match_case)
57 {
58 }
59
60 void BuildSignsList()
61 {
62 if (!this->signs.NeedRebuild()) return;
63
64 Debug(misc, 3, "Building sign list");
65
66 this->signs.clear();
67 this->signs.reserve(Sign::GetNumItems());
68
69 for (const Sign *si : Sign::Iterate()) this->signs.push_back(si);
70
71 this->signs.SetFilterState(true);
72 this->FilterSignList();
73 this->signs.RebuildDone();
74 }
75
77 static bool SignNameSorter(const Sign * const &a, const Sign * const &b)
78 {
79 /* Signs are very very rarely using the default text, but there can also be
80 * a lot of them. Therefore a worthwhile performance gain can be made by
81 * directly comparing Sign::name instead of going through the string
82 * system for each comparison. */
83 const std::string &a_name = a->name.empty() ? SignList::default_name : a->name;
84 const std::string &b_name = b->name.empty() ? SignList::default_name : b->name;
85
86 int r = StrNaturalCompare(a_name, b_name); // Sort by name (natural sorting).
87
88 return r != 0 ? r < 0 : (a->index < b->index);
89 }
90
91 void SortSignsList()
92 {
93 if (!this->signs.Sort(&SignNameSorter)) return;
94 }
95
97 static bool SignNameFilter(const Sign * const *a, StringFilter &filter)
98 {
99 /* Same performance benefit as above for sorting. */
100 const std::string &a_name = (*a)->name.empty() ? SignList::default_name : (*a)->name;
101
102 filter.ResetState();
103 filter.AddLine(a_name);
104 return filter.GetState();
105 }
106
108 static bool OwnerDeityFilter(const Sign * const *a, StringFilter &)
109 {
110 /* You should never be able to edit signs of owner DEITY */
111 return (*a)->owner != OWNER_DEITY;
112 }
113
115 static bool OwnerVisibilityFilter(const Sign * const *a, StringFilter &)
116 {
117 assert(!HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS));
118 /* Hide sign if non-own signs are hidden in the viewport */
119 return (*a)->owner == _local_company || (*a)->owner == OWNER_DEITY;
120 }
121
123 void FilterSignList()
124 {
125 this->signs.Filter(&SignNameFilter, this->string_filter);
126 if (_game_mode != GM_EDITOR) this->signs.Filter(&OwnerDeityFilter, this->string_filter);
127 if (!HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS)) {
128 this->signs.Filter(&OwnerVisibilityFilter, this->string_filter);
129 }
130 }
131};
132
133bool SignList::match_case = false;
134std::string SignList::default_name;
135
136 struct SignListWindow : Window, SignList {
137 QueryString filter_editbox;
138 int text_offset = 0;
139 Scrollbar *vscroll = nullptr;
140
141 SignListWindow(WindowDesc &desc, WindowNumber window_number) : Window(desc), filter_editbox(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
142 {
143 this->CreateNestedTree();
144 this->vscroll = this->GetScrollbar(WID_SIL_SCROLLBAR);
145 this->FinishInitNested(window_number);
146 this->SetWidgetLoweredState(WID_SIL_FILTER_MATCH_CASE_BTN, SignList::match_case);
147
148 /* Initialize the text edit widget */
149 this->querystrings[WID_SIL_FILTER_TEXT] = &this->filter_editbox;
150 this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR;
151
152 /* Initialize the filtering variables */
153 this->SetFilterString("");
154
155 /* Create initial list. */
156 this->signs.ForceRebuild();
157 this->signs.ForceResort();
158 this->BuildSortSignList();
159 }
160
161 void OnInit() override
162 {
163 /* Default sign name, used if Sign::name is nullptr. */
164 SignList::default_name = GetString(STR_DEFAULT_SIGN_NAME);
165 this->signs.ForceResort();
166 this->SortSignsList();
167 this->SetDirty();
168 }
169
176 void SetFilterString(std::string_view new_filter_string)
177 {
178 /* check if there is a new filter string */
179 this->string_filter.SetFilterTerm(new_filter_string);
180
181 /* Rebuild the list of signs */
182 this->InvalidateData();
183 }
184
185 void OnPaint() override
186 {
187 if (!this->IsShaded() && this->signs.NeedRebuild()) this->BuildSortSignList();
188 this->DrawWidgets();
189 }
190
191 void DrawWidget(const Rect &r, WidgetID widget) const override
192 {
193 switch (widget) {
194 case WID_SIL_LIST: {
195 Rect tr = r.Shrink(WidgetDimensions::scaled.framerect);
196 uint text_offset_y = (this->resize.step_height - GetCharacterHeight(FS_NORMAL) + 1) / 2;
197 /* No signs? */
198 if (this->vscroll->GetCount() == 0) {
199 DrawString(tr.left, tr.right, tr.top + text_offset_y, STR_STATION_LIST_NONE);
200 return;
201 }
202
203 Dimension d = GetSpriteSize(SPR_COMPANY_ICON);
204 bool rtl = _current_text_dir == TD_RTL;
205 int sprite_offset_y = (this->resize.step_height - d.height + 1) / 2;
206 uint icon_left = rtl ? tr.right - this->text_offset : tr.left;
207 tr = tr.Indent(this->text_offset, rtl);
208
209 /* At least one sign available. */
210 auto [first, last] = this->vscroll->GetVisibleRangeIterators(this->signs);
211 for (auto it = first; it != last; ++it) {
212 const Sign *si = *it;
213
214 if (si->owner != OWNER_NONE) DrawCompanyIcon(si->owner, icon_left, tr.top + sprite_offset_y);
215
216 DrawString(tr.left, tr.right, tr.top + text_offset_y, GetString(STR_SIGN_NAME, si->index), TC_YELLOW);
217 tr.top += this->resize.step_height;
218 }
219 break;
220 }
221 }
222 }
223
224 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
225 {
226 if (widget == WID_SIL_CAPTION) return GetString(STR_SIGN_LIST_CAPTION, this->vscroll->GetCount());
227
228 return this->Window::GetWidgetString(widget, stringid);
229 }
230
231 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
232 {
233 switch (widget) {
234 case WID_SIL_LIST: {
235 auto it = this->vscroll->GetScrolledItemFromWidget(this->signs, pt.y, this, WID_SIL_LIST, WidgetDimensions::scaled.framerect.top);
236 if (it == this->signs.end()) return;
237
238 const Sign *si = *it;
239 ScrollMainWindowToTile(TileVirtXY(si->x, si->y));
240 break;
241 }
242
243 case WID_SIL_FILTER_MATCH_CASE_BTN:
244 SignList::match_case = !SignList::match_case; // Toggle match case
245 this->SetWidgetLoweredState(WID_SIL_FILTER_MATCH_CASE_BTN, SignList::match_case); // Toggle button pushed state
246 this->InvalidateData(); // Rebuild the list of signs
247 break;
248 }
249 }
250
251 void OnResize() override
252 {
253 this->vscroll->SetCapacityFromWidget(this, WID_SIL_LIST, WidgetDimensions::scaled.framerect.Vertical());
254 }
255
256 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
257 {
258 switch (widget) {
259 case WID_SIL_LIST: {
260 Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON);
261 this->text_offset = WidgetDimensions::scaled.frametext.left + spr_dim.width + 2; // 2 pixels space between icon and the sign text.
262 fill.height = resize.height = std::max<uint>(GetCharacterHeight(FS_NORMAL), spr_dim.height + 2);
263 Dimension d = {(uint)(this->text_offset + WidgetDimensions::scaled.frametext.right), padding.height + 5 * resize.height};
264 size = maxdim(size, d);
265 break;
266 }
267
268 case WID_SIL_CAPTION:
269 size = GetStringBoundingBox(GetString(STR_SIGN_LIST_CAPTION, GetParamMaxValue(Sign::GetPoolSize(), 3)));
270 size.height += padding.height;
271 size.width += padding.width;
272 break;
273 }
274 }
275
276 void OnEditboxChanged(WidgetID widget) override
277 {
278 if (widget == WID_SIL_FILTER_TEXT) this->SetFilterString(this->filter_editbox.text.GetText());
279 }
280
281 void BuildSortSignList()
282 {
283 if (this->signs.NeedRebuild()) {
284 this->BuildSignsList();
285 this->vscroll->SetCount(this->signs.size());
286 this->SetWidgetDirty(WID_SIL_CAPTION);
287 }
288 this->SortSignsList();
289 }
290
292 const IntervalTimer<TimerWindow> rebuild_interval = {std::chrono::seconds(3), [this](auto) {
293 this->BuildSortSignList();
294 this->SetDirty();
295 }};
296
302 void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
303 {
304 /* When there is a filter string, we always need to rebuild the list even if
305 * the amount of signs in total is unchanged, as the subset of signs that is
306 * accepted by the filter might has changed. */
307 if (data == 0 || data == -1 || !this->string_filter.IsEmpty()) { // New or deleted sign, changed visibility setting or there is a filter string
308 /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */
309 this->signs.ForceRebuild();
310 } else { // Change of sign contents while there is no filter string
311 this->signs.ForceResort();
312 }
313 }
314
320 static EventState SignListGlobalHotkeys(int hotkey)
321 {
322 if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
323 Window *w = ShowSignList();
324 if (w == nullptr) return ES_NOT_HANDLED;
325 return w->OnHotkey(hotkey);
326 }
327
328 static inline HotkeyList hotkeys{"signlist", {
329 Hotkey('F', "focus_filter_box", WID_SIL_FILTER_TEXT),
330 }, SignListGlobalHotkeys};
331};
332
333static constexpr std::initializer_list<NWidgetPart> _nested_sign_list_widgets = {
334 NWidget(NWID_HORIZONTAL),
335 NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
336 NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SIL_CAPTION),
337 NWidget(WWT_SHADEBOX, COLOUR_BROWN),
338 NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
339 NWidget(WWT_STICKYBOX, COLOUR_BROWN),
340 EndContainer(),
341 NWidget(NWID_HORIZONTAL),
342 NWidget(NWID_VERTICAL),
343 NWidget(WWT_PANEL, COLOUR_BROWN, WID_SIL_LIST), SetMinimalSize(WidgetDimensions::unscaled.frametext.Horizontal() + 16 + 255, 0),
344 SetResize(1, 1), SetFill(1, 0), SetScrollbar(WID_SIL_SCROLLBAR), EndContainer(),
345 NWidget(NWID_HORIZONTAL),
346 NWidget(WWT_PANEL, COLOUR_BROWN), SetFill(1, 1),
347 NWidget(WWT_EDITBOX, COLOUR_BROWN, WID_SIL_FILTER_TEXT), SetMinimalSize(80, 0), SetResize(1, 0), SetFill(1, 0), SetPadding(2, 2, 2, 2),
348 SetStringTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
349 EndContainer(),
350 NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_SIL_FILTER_MATCH_CASE_BTN), SetStringTip(STR_SIGN_LIST_MATCH_CASE, STR_SIGN_LIST_MATCH_CASE_TOOLTIP),
351 EndContainer(),
352 EndContainer(),
353 NWidget(NWID_VERTICAL),
354 NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_SIL_SCROLLBAR),
355 NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
356 EndContainer(),
357 EndContainer(),
358};
359
360static WindowDesc _sign_list_desc(
361 WDP_AUTO, "list_signs", 358, 138,
362 WC_SIGN_LIST, WC_NONE,
363 {},
364 _nested_sign_list_widgets,
365 &SignListWindow::hotkeys
366);
367
373 Window *ShowSignList()
374{
375 return AllocateWindowDescFront<SignListWindow>(_sign_list_desc, 0);
376}
377
384 static bool RenameSign(SignID index, std::string_view text)
385{
386 bool remove = text.empty();
387 Command<CMD_RENAME_SIGN>::Post(remove ? STR_ERROR_CAN_T_DELETE_SIGN : STR_ERROR_CAN_T_CHANGE_SIGN_NAME, index, std::string{text});
388 return remove;
389}
390
396 void MoveSign(SignID index, TileIndex tile)
397{
398 Command<CMD_MOVE_SIGN>::Post(STR_ERROR_CAN_T_PLACE_SIGN_HERE, index, tile);
399}
400
401 struct SignWindow : Window, SignList {
402 QueryString name_editbox;
403 SignID cur_sign{};
404 WidgetID last_user_action = INVALID_WIDGET;
405
406 SignWindow(WindowDesc &desc, const Sign *si) : Window(desc), name_editbox(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS)
407 {
408 this->querystrings[WID_QES_TEXT] = &this->name_editbox;
409 this->name_editbox.caption = STR_EDIT_SIGN_CAPTION;
410 this->name_editbox.cancel_button = WID_QES_CANCEL;
411 this->name_editbox.ok_button = WID_QES_OK;
412
413 this->InitNested(WN_QUERY_STRING_SIGN);
414
415 UpdateSignEditWindow(si);
416 this->SetFocusedWidget(WID_QES_TEXT);
417 }
418
419 void UpdateSignEditWindow(const Sign *si)
420 {
421 /* Display an empty string when the sign hasn't been edited yet */
422 if (!si->name.empty()) {
423 this->name_editbox.text.Assign(GetString(STR_SIGN_NAME, si->index));
424 } else {
425 this->name_editbox.text.DeleteAll();
426 }
427
428 this->cur_sign = si->index;
429
430 this->SetWidgetDirty(WID_QES_TEXT);
431 this->SetFocusedWidget(WID_QES_TEXT);
432 }
433
439 const Sign *PrevNextSign(bool next)
440 {
441 /* Rebuild the sign list */
442 this->signs.ForceRebuild();
443 this->signs.NeedResort();
444 this->BuildSignsList();
445 this->SortSignsList();
446
447 /* Search through the list for the current sign, excluding
448 * - the first sign if we want the previous sign or
449 * - the last sign if we want the next sign */
450 size_t end = this->signs.size() - (next ? 1 : 0);
451 for (uint i = next ? 0 : 1; i < end; i++) {
452 if (this->cur_sign == this->signs[i]->index) {
453 /* We've found the current sign, so return the sign before/after it */
454 return this->signs[i + (next ? 1 : -1)];
455 }
456 }
457 /* If we haven't found the current sign by now, return the last/first sign */
458 return next ? this->signs.front() : this->signs.back();
459 }
460
461 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
462 {
463 switch (widget) {
464 case WID_QES_CAPTION:
465 return GetString(this->name_editbox.caption);
466
467 default:
468 return this->Window::GetWidgetString(widget, stringid);
469 }
470 }
471
472 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
473 {
474 switch (widget) {
475 case WID_QES_LOCATION: {
476 const Sign *si = Sign::Get(this->cur_sign);
477 TileIndex tile = TileVirtXY(si->x, si->y);
478 if (_ctrl_pressed) {
479 ShowExtraViewportWindow(tile);
480 } else {
481 ScrollMainWindowToTile(tile);
482 }
483 break;
484 }
485
486 case WID_QES_PREVIOUS:
487 case WID_QES_NEXT: {
488 const Sign *si = this->PrevNextSign(widget == WID_QES_NEXT);
489
490 /* Rebuild the sign list */
491 this->signs.ForceRebuild();
492 this->signs.NeedResort();
493 this->BuildSignsList();
494 this->SortSignsList();
495
496 /* Scroll to sign and reopen window */
497 ScrollMainWindowToTile(TileVirtXY(si->x, si->y));
498 UpdateSignEditWindow(si);
499 break;
500 }
501
502 case WID_QES_OK:
503 if (RenameSign(this->cur_sign, this->name_editbox.text.GetText())) break;
504 [[fallthrough]];
505
506 case WID_QES_CANCEL:
507 this->Close();
508 break;
509
510 case WID_QES_DELETE:
511 /* Only need to set the buffer to null, the rest is handled as the OK button */
512 RenameSign(this->cur_sign, "");
513 /* don't delete this, we are deleted in Sign::~Sign() -> DeleteRenameSignWindow() */
514 break;
515
516 case WID_QES_MOVE:
517 HandlePlacePushButton(this, WID_QES_MOVE, SPR_CURSOR_SIGN, HT_RECT);
518 this->last_user_action = widget;
519 break;
520 }
521 }
522
523 void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
524 {
525 switch (this->last_user_action) {
526 case WID_QES_MOVE: // Place sign button
527 RenameSign(this->cur_sign, this->name_editbox.text.GetText());
528 MoveSign(this->cur_sign, tile);
529 this->Close();
530 break;
531
532 default: NOT_REACHED();
533 }
534 }
535
536 void OnPlaceObjectAbort() override
537 {
538 this->RaiseButtons();
539 }
540};
541
542static constexpr std::initializer_list<NWidgetPart> _nested_query_sign_edit_widgets = {
543 NWidget(NWID_HORIZONTAL),
544 NWidget(WWT_CLOSEBOX, COLOUR_GREY),
545 NWidget(WWT_CAPTION, COLOUR_GREY, WID_QES_CAPTION), SetTextStyle(TC_WHITE),
546 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_QES_LOCATION), SetAspect(WidgetDimensions::ASPECT_LOCATION), SetSpriteTip(SPR_GOTO_LOCATION, STR_EDIT_SIGN_LOCATION_TOOLTIP),
547 EndContainer(),
548 NWidget(WWT_PANEL, COLOUR_GREY),
549 NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QES_TEXT), SetMinimalSize(256, 0), SetStringTip(STR_EDIT_SIGN_SIGN_OSKTITLE), SetPadding(2, 2, 2, 2),
550 EndContainer(),
551 NWidget(NWID_HORIZONTAL),
552 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_QES_OK), SetMinimalSize(61, 12), SetStringTip(STR_BUTTON_OK),
553 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_QES_CANCEL), SetMinimalSize(60, 12), SetStringTip(STR_BUTTON_CANCEL),
554 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_QES_DELETE), SetMinimalSize(60, 12), SetStringTip(STR_TOWN_VIEW_DELETE_BUTTON),
555 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QES_MOVE), SetMinimalSize(60, 12), SetStringTip(STR_BUTTON_MOVE),
556 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_QES_PREVIOUS), SetMinimalSize(11, 12), SetArrowWidgetTypeTip(AWV_DECREASE, STR_EDIT_SIGN_PREVIOUS_SIGN_TOOLTIP),
557 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_QES_NEXT), SetMinimalSize(11, 12), SetArrowWidgetTypeTip(AWV_INCREASE, STR_EDIT_SIGN_NEXT_SIGN_TOOLTIP),
558 EndContainer(),
559};
560
561static WindowDesc _query_sign_edit_desc(
562 WDP_CENTER, {}, 0, 0,
563 WC_QUERY_STRING, WC_NONE,
564 WindowDefaultFlag::Construction,
565 _nested_query_sign_edit_widgets
566);
567
572 void HandleClickOnSign(const Sign *si)
573{
574 /* If we can't edit the sign, don't even open the rename GUI. */
575 if (!CompanyCanEditSign(si)) return;
576
577 if (_ctrl_pressed && (si->owner == _local_company || (si->owner == OWNER_DEITY && _game_mode == GM_EDITOR))) {
578 RenameSign(si->index, "");
579 return;
580 }
581
582 ShowRenameSignWindow(si);
583}
584
589 void ShowRenameSignWindow(const Sign *si)
590{
591 /* Delete all other edit windows */
592 CloseWindowByClass(WC_QUERY_STRING);
593
594 new SignWindow(_query_sign_edit_desc, si);
595}
596
601 void DeleteRenameSignWindow(SignID sign)
602{
603 SignWindow *w = dynamic_cast<SignWindow *>(FindWindowById(WC_QUERY_STRING, WN_QUERY_STRING_SIGN));
604
605 if (w != nullptr && w->cur_sign == sign) w->Close();
606}
HasBit
constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition bitmath_func.hpp:103
GUIList
List template of 'things' T to sort in a GUI.
Definition sortlist_type.h:43
GUIList::Filter
bool Filter(FilterFunction *decide, F filter_data)
Filter the list.
Definition sortlist_type.h:342
GUIList::RebuildDone
void RebuildDone()
Notify the sortlist that the rebuild is done.
Definition sortlist_type.h:405
GUIList::SetFilterState
void SetFilterState(bool state)
Enable or disable the filter.
Definition sortlist_type.h:326
GUIList::NeedRebuild
bool NeedRebuild() const
Check if a rebuild is needed.
Definition sortlist_type.h:387
GUIList::ForceRebuild
void ForceRebuild()
Force that a rebuild is needed.
Definition sortlist_type.h:395
GUIList::Sort
bool Sort(Comp compare)
Sort the list.
Definition sortlist_type.h:266
GUIList::ForceResort
void ForceResort()
Force a resort next Sort call Reset the resort timer if used too.
Definition sortlist_type.h:232
GUIList::NeedResort
bool NeedResort()
Check if a resort is needed next loop If used the resort timer will decrease every call till 0.
Definition sortlist_type.h:218
IntervalTimer
An interval timer will fire every interval, and will continue to fire until it is deleted.
Definition timer.h:76
Scrollbar
Scrollbar data structure.
Definition widget_type.h:708
Scrollbar::SetCount
void SetCount(size_t num)
Sets the number of elements in the list.
Definition widget_type.h:792
Scrollbar::GetScrolledItemFromWidget
auto GetScrolledItemFromWidget(Tcontainer &container, int clickpos, const Window *const w, WidgetID widget, int padding=0, int line_height=-1) const
Return an iterator pointing to the element of a scrolled widget that a user clicked in.
Definition widget_type.h:891
Scrollbar::SetCapacityFromWidget
void SetCapacityFromWidget(Window *w, WidgetID widget, int padding=0)
Set capacity of visible elements from the size and resize properties of a widget.
Definition widget.cpp:2499
Scrollbar::GetCount
size_type GetCount() const
Gets the number of elements in the list.
Definition widget_type.h:734
Scrollbar::GetVisibleRangeIterators
auto GetVisibleRangeIterators(Tcontainer &container) const
Get a pair of iterators for the range of visible elements in a container.
Definition widget_type.h:872
WidgetDimensions::framerect
RectPadding framerect
Standard padding inside many panels.
Definition window_gui.h:40
WidgetDimensions::frametext
RectPadding frametext
Padding inside frame with text.
Definition window_gui.h:41
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition window_gui.h:30
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:93
command_func.h
Functions related to commands.
DrawCompanyIcon
void DrawCompanyIcon(CompanyID c, int x, int y)
Draw the icon of a company.
Definition company_cmd.cpp:175
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition company_cmd.cpp:55
company_func.h
Functions related to companies.
company_gui.h
GUI Functions related to companies.
OWNER_DEITY
static constexpr Owner OWNER_DEITY
The object is owned by a superuser / goal script.
Definition company_type.h:28
OWNER_NONE
static constexpr Owner OWNER_NONE
The tile has no ownership.
Definition company_type.h:26
debug.h
Functions related to debugging.
Debug
#define Debug(category, level, format_string,...)
Output a line of debugging information.
Definition debug.h:37
GetCharacterHeight
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Definition fontcache.cpp:87
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition geometry_func.cpp:22
geometry_func.hpp
Geometry functions.
GetSpriteSize
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition gfx.cpp:965
GetStringBoundingBox
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition gfx.cpp:894
DrawString
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
Definition gfx.cpp:665
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition gfx.cpp:38
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition gfx_type.h:249
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1219
SetSpriteTip
constexpr NWidgetPart SetSpriteTip(SpriteID sprite, StringID tip={})
Widget part function for setting the sprite and tooltip.
Definition widget_type.h:1251
SetScrollbar
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
Definition widget_type.h:1399
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition widget_type.h:1332
SetStringTip
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
Definition widget_type.h:1240
SetAspect
constexpr NWidgetPart SetAspect(float ratio, AspectFlags flags=AspectFlag::ResizeX)
Widget part function for setting the aspect ratio.
Definition widget_type.h:1410
SetTextStyle
constexpr NWidgetPart SetTextStyle(TextColour colour, FontSize size=FS_NORMAL)
Widget part function for setting the text style.
Definition widget_type.h:1198
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1156
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1229
SetArrowWidgetTypeTip
constexpr NWidgetPart SetArrowWidgetTypeTip(ArrowWidgetValues widget_type, StringID tip={})
Widget part function for setting the arrow widget type and tooltip.
Definition widget_type.h:1274
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1424
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1145
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition window.cpp:966
gui.h
GUI functions that shouldn't be here.
ShowExtraViewportWindow
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
Definition viewport_gui.cpp:159
hotkeys.h
Hotkey related functions.
HandlePlacePushButton
bool HandlePlacePushButton(Window *w, WidgetID widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
Definition main_gui.cpp:63
map_func.h
Functions related to maps.
TileVirtXY
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
Definition map_func.h:416
DO_SHOW_COMPETITOR_SIGNS
@ DO_SHOW_COMPETITOR_SIGNS
Display signs, station names and waypoint names of opponent companies. Buoys and oilrig-stations are ...
Definition openttd.h:52
querystring_gui.h
Base for the GUIs that have an edit box in them.
safeguards.h
A number of safeguards to prevent using unsafe methods.
sign_widget.h
Types related to the sign widgets.
WID_QES_PREVIOUS
@ WID_QES_PREVIOUS
Previous button.
Definition sign_widget.h:32
WID_QES_MOVE
@ WID_QES_MOVE
Move Sign button.
Definition sign_widget.h:31
WID_QES_LOCATION
@ WID_QES_LOCATION
Scroll to sign location.
Definition sign_widget.h:26
WID_QES_CANCEL
@ WID_QES_CANCEL
Cancel button.
Definition sign_widget.h:29
WID_QES_OK
@ WID_QES_OK
OK button.
Definition sign_widget.h:28
WID_QES_NEXT
@ WID_QES_NEXT
Next button.
Definition sign_widget.h:33
WID_QES_DELETE
@ WID_QES_DELETE
Delete button.
Definition sign_widget.h:30
WID_QES_TEXT
@ WID_QES_TEXT
Text of the query.
Definition sign_widget.h:27
WID_QES_CAPTION
@ WID_QES_CAPTION
Caption of the window.
Definition sign_widget.h:25
WID_SIL_SCROLLBAR
@ WID_SIL_SCROLLBAR
Scrollbar of list.
Definition sign_widget.h:18
WID_SIL_FILTER_MATCH_CASE_BTN
@ WID_SIL_FILTER_MATCH_CASE_BTN
Button to toggle if case sensitive filtering should be used.
Definition sign_widget.h:20
WID_SIL_FILTER_TEXT
@ WID_SIL_FILTER_TEXT
Text box for typing a filter string.
Definition sign_widget.h:19
WID_SIL_CAPTION
@ WID_SIL_CAPTION
Caption of the window.
Definition sign_widget.h:16
WID_SIL_LIST
@ WID_SIL_LIST
List of signs.
Definition sign_widget.h:17
CompanyCanEditSign
bool CompanyCanEditSign(const Sign *si)
Check if the current company can rename or move a given sign.
Definition signs.cpp:62
signs_base.h
Base class for signs.
signs_cmd.h
Command definitions related to signs.
signs_func.h
Functions related to signs.
RenameSign
static bool RenameSign(SignID index, std::string_view text)
Actually rename the sign.
Definition signs_gui.cpp:384
HandleClickOnSign
void HandleClickOnSign(const Sign *si)
Handle clicking on a sign.
Definition signs_gui.cpp:572
DeleteRenameSignWindow
void DeleteRenameSignWindow(SignID sign)
Close the sign window associated with the given sign.
Definition signs_gui.cpp:601
MoveSign
void MoveSign(SignID index, TileIndex tile)
Actually move the sign.
Definition signs_gui.cpp:396
ShowRenameSignWindow
void ShowRenameSignWindow(const Sign *si)
Show the window to change the text of a sign.
Definition signs_gui.cpp:589
ShowSignList
Window * ShowSignList()
Open the sign list window.
Definition signs_gui.cpp:373
MAX_LENGTH_SIGN_NAME_CHARS
static const uint MAX_LENGTH_SIGN_NAME_CHARS
The maximum length of a sign name in characters including '\0'.
Definition signs_type.h:20
sortlist_type.h
Base types for having sorted lists in GUIs.
sprites.h
This file contains all sprite-related enums and defines.
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
StrNaturalCompare
int StrNaturalCompare(std::string_view s1, std::string_view s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
Definition string.cpp:427
string_func.h
Functions related to low-level strings.
stringfilter_type.h
Searching and filtering using a stringterm.
GetParamMaxValue
uint64_t GetParamMaxValue(uint64_t max_value, uint min_count, FontSize size)
Get some number that is suitable for string size computations.
Definition strings.cpp:236
GetString
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
Definition strings.cpp:424
_current_text_dir
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition strings.cpp:56
strings_func.h
Functions related to OTTD's strings.
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition strings_type.h:19
TD_RTL
@ TD_RTL
Text is written right-to-left by default.
Definition strings_type.h:27
MAX_CHAR_LENGTH
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
Definition strings_type.h:21
CommandHelper
Definition command_func.h:83
Coord2D< int >
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition geometry_type.hpp:56
HotkeyList
List of hotkeys for a window.
Definition hotkeys.h:37
Hotkey
All data for a single hotkey.
Definition hotkeys.h:21
PoolID< uint16_t, struct SignIDTag, 64000, 0xFFFF >
Pool::PoolItem<&_sign_pool >::GetPoolSize
static size_t GetPoolSize()
Returns first unused index.
Definition pool_type.hpp:408
Pool::PoolItem<&_sign_pool >::Get
static Titem * Get(auto index)
Returns Titem with given index.
Definition pool_type.hpp:387
Pool::PoolItem<&_sign_pool >::GetNumItems
static size_t GetNumItems()
Returns number of valid items in the pool.
Definition pool_type.hpp:417
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition pool_type.hpp:286
QueryString
Data stored about a string that can be modified in the GUI.
Definition querystring_gui.h:20
QueryString::ok_button
int ok_button
Widget button of parent window to simulate when pressing OK in OSK.
Definition querystring_gui.h:27
QueryString::cancel_button
int cancel_button
Widget button of parent window to simulate when pressing CANCEL in OSK.
Definition querystring_gui.h:28
QueryString::ACTION_CLEAR
static const int ACTION_CLEAR
Clear editbox.
Definition querystring_gui.h:24
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition geometry_type.hpp:101
Rect::Shrink
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Definition geometry_type.hpp:124
Rect::Indent
Rect Indent(int indent, bool end) const
Copy Rect and indent it from its position.
Definition geometry_type.hpp:224
ResizeInfo::step_height
uint step_height
Step-size of height resize changes.
Definition window_gui.h:213
SignListWindow
Definition signs_gui.cpp:136
SignListWindow::rebuild_interval
const IntervalTimer< TimerWindow > rebuild_interval
Resort the sign listing on a regular interval.
Definition signs_gui.cpp:292
SignListWindow::OnClick
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition signs_gui.cpp:231
SignListWindow::OnEditboxChanged
void OnEditboxChanged(WidgetID widget) override
The text in an editbox has been edited.
Definition signs_gui.cpp:276
SignListWindow::DrawWidget
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
Definition signs_gui.cpp:191
SignListWindow::GetWidgetString
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
Definition signs_gui.cpp:224
SignListWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition signs_gui.cpp:302
SignListWindow::text_offset
int text_offset
Offset of the sign text relative to the left edge of the WID_SIL_LIST widget.
Definition signs_gui.cpp:138
SignListWindow::filter_editbox
QueryString filter_editbox
Filter editbox;.
Definition signs_gui.cpp:137
SignListWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition signs_gui.cpp:185
SignListWindow::OnInit
void OnInit() override
Notification that the nested widget tree gets initialized.
Definition signs_gui.cpp:161
SignListWindow::SignListGlobalHotkeys
static EventState SignListGlobalHotkeys(int hotkey)
Handler for global hotkeys of the SignListWindow.
Definition signs_gui.cpp:320
SignListWindow::SetFilterString
void SetFilterString(std::string_view new_filter_string)
This function sets the filter string of the sign list.
Definition signs_gui.cpp:176
SignListWindow::UpdateWidgetSize
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
Definition signs_gui.cpp:256
SignListWindow::OnResize
void OnResize() override
Called after the window got resized.
Definition signs_gui.cpp:251
SignList
Definition signs_gui.cpp:41
SignList::OwnerDeityFilter
static bool OwnerDeityFilter(const Sign *const *a, StringFilter &)
Filter sign list excluding OWNER_DEITY.
Definition signs_gui.cpp:108
SignList::GUISignList
GUIList< const Sign *, std::nullptr_t, StringFilter & > GUISignList
A GUIList contains signs and uses a StringFilter for filtering.
Definition signs_gui.cpp:45
SignList::OwnerVisibilityFilter
static bool OwnerVisibilityFilter(const Sign *const *a, StringFilter &)
Filter sign list by owner.
Definition signs_gui.cpp:115
SignList::SignNameSorter
static bool SignNameSorter(const Sign *const &a, const Sign *const &b)
Sort signs by their name.
Definition signs_gui.cpp:77
SignList::SignList
SignList()
Creates a SignList with filtering disabled by default.
Definition signs_gui.cpp:56
SignList::FilterSignList
void FilterSignList()
Filter out signs from the sign list that does not match the name filter.
Definition signs_gui.cpp:123
SignList::match_case
static bool match_case
Should case sensitive matching be used?
Definition signs_gui.cpp:50
SignList::default_name
static std::string default_name
Default sign name, used if Sign::name is nullptr.
Definition signs_gui.cpp:51
SignList::SignNameFilter
static bool SignNameFilter(const Sign *const *a, StringFilter &filter)
Filter sign list by sign name.
Definition signs_gui.cpp:97
SignList::string_filter
StringFilter string_filter
The match string to be used when the GUIList is (re)-sorted.
Definition signs_gui.cpp:49
SignWindow
Definition signs_gui.cpp:401
SignWindow::OnPlaceObject
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Definition signs_gui.cpp:523
SignWindow::OnPlaceObjectAbort
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition signs_gui.cpp:536
SignWindow::PrevNextSign
const Sign * PrevNextSign(bool next)
Returns a pointer to the (alphabetically) previous or next sign of the current sign.
Definition signs_gui.cpp:439
SignWindow::last_user_action
WidgetID last_user_action
Last started user action.
Definition signs_gui.cpp:404
SignWindow::OnClick
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition signs_gui.cpp:472
SignWindow::GetWidgetString
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
Definition signs_gui.cpp:461
Sign
Definition signs_base.h:21
StringFilter
String filter and state.
Definition stringfilter_type.h:30
StringFilter::IsEmpty
bool IsEmpty() const
Check whether any filter words were entered.
Definition stringfilter_type.h:57
StringFilter::SetFilterTerm
void SetFilterTerm(std::string_view str)
Set the term to filter on.
Definition stringfilter.cpp:29
StringFilter::ResetState
void ResetState()
Reset the matching state to process a new item.
Definition stringfilter.cpp:80
StringFilter::GetState
bool GetState() const
Get the matching state of the current item.
Definition stringfilter_type.h:67
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
Textbuf::DeleteAll
void DeleteAll()
Delete every character in the textbuffer.
Definition textbuf.cpp:112
Textbuf::GetText
std::string_view GetText() const
Get the current text.
Definition textbuf.cpp:284
Textbuf::Assign
void Assign(std::string_view text)
Copy a string into the textbuffer.
Definition textbuf.cpp:420
WindowDesc
High level window description.
Definition window_gui.h:168
WindowNumber
Number to differentiate different windows of the same class.
Definition window_type.h:760
Window
Data structure for an opened window.
Definition window_gui.h:274
Window::Close
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
Definition window.cpp:1102
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition window.cpp:1807
Window::querystrings
std::map< WidgetID, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
Definition window_gui.h:321
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition widget.cpp:766
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:3234
Window::SetWidgetDirty
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
Definition window.cpp:556
Window::GetWidgetString
virtual std::string GetWidgetString(WidgetID widget, StringID stringid) const
Get the raw string for a widget.
Definition window.cpp:504
Window::resize
ResizeInfo resize
Resize information.
Definition window_gui.h:315
Window::CreateNestedTree
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
Definition window.cpp:1797
Window::SetFocusedWidget
bool SetFocusedWidget(WidgetID widget_index)
Set focus within this window to the given widget.
Definition window.cpp:485
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition window.cpp:530
Window::SetWidgetLoweredState
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition window_gui.h:442
Window::IsShaded
bool IsShaded() const
Is window shaded currently?
Definition window_gui.h:560
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition window.cpp:1820
Window::GetScrollbar
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
Definition window.cpp:313
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition window.cpp:570
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition window_gui.h:303
tilehighlight_func.h
Functions related to tile highlights.
HT_RECT
@ HT_RECT
rectangle (stations, depots, ...)
Definition tilehighlight_type.h:21
timer.h
Definition of Interval and OneShot timers.
timer_window.h
Definition of the Window system.
transparency.h
Functions related to transparency.
_display_opt
uint8_t _display_opt
What do we want to draw/do?
Definition transparency_gui.cpp:26
ScrollMainWindowToTile
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Definition viewport.cpp:2592
viewport_func.h
Functions related to (drawing on) viewports.
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:104
WWT_PUSHIMGBTN
@ WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition widget_type.h:105
WWT_PUSHARROWBTN
@ WWT_PUSHARROWBTN
Normal push-button (no toggle button) with arrow caption.
Definition widget_type.h:106
WWT_EDITBOX
@ WWT_EDITBOX
a textbox for typing
Definition widget_type.h:62
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition widget_type.h:44
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:57
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition widget_type.h:55
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:52
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition widget_type.h:76
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:60
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition widget_type.h:59
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition widget_type.h:56
AWV_DECREASE
@ AWV_DECREASE
Arrow to the left or in case of RTL to the right.
Definition widget_type.h:20
AWV_INCREASE
@ AWV_INCREASE
Arrow to the right or in case of RTL to the left.
Definition widget_type.h:21
CloseWindowByClass
void CloseWindowByClass(WindowClass cls, int data)
Close all windows of a given class.
Definition window.cpp:1205
FindWindowById
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Definition window.cpp:1151
window_func.h
Window functions not directly related to making/drawing windows.
WindowDefaultFlag::Construction
@ Construction
This window is used for construction; close it whenever changing company.
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition window_gui.h:145
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition window_gui.h:144
WidgetID
int WidgetID
Widget ID.
Definition window_type.h:20
WN_QUERY_STRING_SIGN
@ WN_QUERY_STRING_SIGN
Query string for signs.
Definition window_type.h:35
EventState
EventState
State of handling an event.
Definition window_type.h:780
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition window_type.h:782
INVALID_WIDGET
static constexpr WidgetID INVALID_WIDGET
An invalid widget index.
Definition window_type.h:23
WC_SIGN_LIST
@ WC_SIGN_LIST
Sign list; Window numbers:
Definition window_type.h:283
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition window_type.h:50
WC_QUERY_STRING
@ WC_QUERY_STRING
Query string window; Window numbers:
Definition window_type.h:128