OpenTTD Source 20250312-master-gcdcc6b491d
|
GUIs for a number of misc windows. More...
#include "stdafx.h"
#include "debug.h"
#include "landscape.h"
#include "error.h"
#include "gui.h"
#include "gfx_layout.h"
#include "command_func.h"
#include "company_func.h"
#include "town.h"
#include "string_func.h"
#include "company_base.h"
#include "texteff.hpp"
#include "strings_func.h"
#include "window_func.h"
#include "querystring_gui.h"
#include "core/geometry_func.hpp"
#include "newgrf_debug.h"
#include "zoom_func.h"
#include "viewport_func.h"
#include "landscape_cmd.h"
#include "rev.h"
#include "timer/timer.h"
#include "timer/timer_window.h"
#include "pathfinder/water_regions.h"
#include "widgets/misc_widget.h"
#include "table/strings.h"
#include <sstream>
#include <iomanip>
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
class | LandInfoWindow |
struct | AboutWindow |
struct | TooltipsWindow |
Window for displaying a tooltip. More... | |
struct | QueryStringWindow |
Class for the string query window. More... | |
struct | QueryWindow |
Window used for asking the user a YES/NO question. More... | |
Macros | |
#define | LANDINFOD_LEVEL 1 |
Enumerations | |
enum | OskActivation : uint8_t { OSKA_DISABLED , OSKA_DOUBLE_CLICK , OSKA_SINGLE_CLICK , OSKA_IMMEDIATELY } |
Method to open the OSK. More... | |
Functions | |
void | ShowLandInfo (TileIndex tile) |
Show land information window. | |
void | ShowAboutWindow () |
void | ShowEstimatedCostOrIncome (Money cost, int x, int y) |
Display estimated costs. | |
void | ShowCostOrIncomeAnimation (int x, int y, int z, Money cost) |
Display animated income or costs on the map. | |
void | ShowFeederIncomeAnimation (int x, int y, int z, Money transfer, Money income) |
Display animated feeder income. | |
TextEffectID | ShowFillingPercent (int x, int y, int z, uint8_t percent, StringID string) |
Display vehicle loading indicators. | |
void | UpdateFillingPercent (TextEffectID te_id, uint8_t percent, StringID string) |
Update vehicle loading indicators. | |
void | HideFillingPercent (TextEffectID *te_id) |
Hide vehicle loading indicators. | |
void | GuiShowTooltips (Window *parent, EncodedString &&text, TooltipCloseCondition close_tooltip) |
Shows a tooltip. | |
static int | GetCaretWidth () |
static Rect | ScrollEditBoxTextRect (Rect r, const Textbuf &tb) |
Reposition edit text box rect based on textbuf length can caret position. | |
void | ShowQueryString (std::string_view str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags) |
Show a query popup window with a textbox in it. | |
void | ShowQuery (EncodedString &&caption, EncodedString &&message, Window *parent, QueryCallbackProc *callback, bool focus) |
Show a confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre of its parent. | |
Variables | |
static constexpr NWidgetPart | _nested_land_info_widgets [] |
static WindowDesc | _land_info_desc (WDP_AUTO, nullptr, 0, 0, WC_LAND_INFO, WC_NONE, {}, _nested_land_info_widgets) |
static constexpr NWidgetPart | _nested_about_widgets [] |
static WindowDesc | _about_desc (WDP_CENTER, nullptr, 0, 0, WC_GAME_OPTIONS, WC_NONE, {}, _nested_about_widgets) |
static const std::initializer_list< const std::string_view > | _credits |
static constexpr NWidgetPart | _nested_tooltips_widgets [] |
static WindowDesc | _tool_tips_desc (WDP_MANUAL, nullptr, 0, 0, WC_TOOLTIPS, WC_NONE, {WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose}, _nested_tooltips_widgets) |
static constexpr NWidgetPart | _nested_query_string_widgets [] |
static WindowDesc | _query_string_desc (WDP_CENTER, nullptr, 0, 0, WC_QUERY_STRING, WC_NONE, {}, _nested_query_string_widgets) |
static constexpr NWidgetPart | _nested_query_widgets [] |
static WindowDesc | _query_desc (WDP_CENTER, nullptr, 0, 0, WC_CONFIRM_POPUP_QUERY, WC_NONE, WindowDefaultFlag::Modal, _nested_query_widgets) |
GUIs for a number of misc windows.
Definition in file misc_gui.cpp.
enum OskActivation : uint8_t |
Method to open the OSK.
Definition at line 45 of file misc_gui.cpp.
|
static |
Definition at line 709 of file misc_gui.cpp.
void GuiShowTooltips | ( | Window * | parent, |
EncodedString && | text, | ||
TooltipCloseCondition | close_tooltip | ||
) |
Shows a tooltip.
parent | The window this tooltip is related to. |
text | String to be displayed. May include encoded parameters. |
close_tooltip | the condition under which the tooltip closes |
Definition at line 690 of file misc_gui.cpp.
References CloseWindowById(), CursorVars::in_window, and WC_TOOLTIPS.
Referenced by DispatchHoverEvent(), DispatchRightClickEvent(), DepotWindow::OnRightClick(), ReplaceVehicleWindow::OnTooltip(), CheatWindow::OnTooltip(), IndustryCargoesWindow::OnTooltip(), LinkGraphLegendWindow::OnTooltip(), NetworkClientListWindow::OnTooltip(), BuildRailToolbarWindow::OnTooltip(), TextfileWindow::OnTooltip(), VehicleDetailsWindow::OnTooltip(), and ShowMeasurementTooltips().
void HideFillingPercent | ( | TextEffectID * | te_id | ) |
Hide vehicle loading indicators.
*te_id | TextEffectID which is supposed to be hidden. |
Definition at line 583 of file misc_gui.cpp.
Referenced by CmdReverseTrainDirection(), Train::Crash(), Vehicle::LeaveStation(), and Vehicle::PreDestructor().
Reposition edit text box rect based on textbuf length can caret position.
r | Initial rect of edit text box. |
tb | The Textbuf being processed. |
Definition at line 720 of file misc_gui.cpp.
References Textbuf::caretxoffs, Textbuf::pixels, Rect::Translate(), Rect::Width(), and Rect::WithWidth().
Referenced by QueryString::GetBoundingRect(), QueryString::GetCaretPosition(), and QueryString::GetCharAtPosition().
void ShowAboutWindow | ( | ) |
Definition at line 480 of file misc_gui.cpp.
void ShowCostOrIncomeAnimation | ( | int | x, |
int | y, | ||
int | z, | ||
Money | cost | ||
) |
Display animated income or costs on the map.
Does nothing if cost is zero.
x | World X position of the animation location. |
y | World Y position of the animation location. |
z | World Z position of the animation location. |
cost | Estimated cost (or income if negative). |
Definition at line 510 of file misc_gui.cpp.
References Ticks::DAY_TICKS, GetEncodedString(), RemapCoords(), and TE_RISING.
Referenced by CmdChangeBankBalance(), CommandHelperBase::InternalPostResult(), and VehicleEnterDepot().
void ShowEstimatedCostOrIncome | ( | Money | cost, |
int | x, | ||
int | y | ||
) |
Display estimated costs.
cost | Estimated cost (or income if negative). |
x | X position of the notification window. |
y | Y position of the notification window. |
Definition at line 492 of file misc_gui.cpp.
References GetEncodedString(), ShowErrorMessage(), and WL_INFO.
Referenced by CommandHelperBase::InternalPostResult().
Display animated feeder income.
x | World X position of the animation location. |
y | World Y position of the animation location. |
z | World Z position of the animation location. |
transfer | Estimated feeder income. |
income | Real income from goods being delivered to their final destination. |
Definition at line 533 of file misc_gui.cpp.
References Ticks::DAY_TICKS, GetEncodedString(), RemapCoords(), and TE_RISING.
TextEffectID ShowFillingPercent | ( | int | x, |
int | y, | ||
int | z, | ||
uint8_t | percent, | ||
StringID | string | ||
) |
Display vehicle loading indicators.
x | World X position of the animation location. |
y | World Y position of the animation location. |
z | World Z position of the animation location. |
percent | Estimated feeder income. |
string | String which is drawn on the map. |
Definition at line 558 of file misc_gui.cpp.
References GetEncodedString(), RemapCoords(), and TE_STATIC.
Referenced by LoadUnloadVehicle().
void ShowLandInfo | ( | TileIndex | tile | ) |
Show land information window.
tile | The tile to show information about. |
Definition at line 319 of file misc_gui.cpp.
References CloseWindowById(), and WC_LAND_INFO.
Referenced by MainToolbarWindow::OnPlaceObject(), and ScenarioEditorToolbarWindow::OnPlaceObject().
void ShowQuery | ( | EncodedString && | caption, |
EncodedString && | message, | ||
Window * | parent, | ||
QueryCallbackProc * | callback, | ||
bool | focus | ||
) |
Show a confirmation window with standard 'yes' and 'no' buttons The window is aligned to the centre of its parent.
caption | string shown as window caption |
message | string that will be shown for the window |
parent | pointer to parent window, if this pointer is nullptr the parent becomes the main window WC_MAIN_WINDOW |
callback | callback function pointer to set in the window descriptor |
focus | whether the window should be focussed (by default false) |
Definition at line 1151 of file misc_gui.cpp.
References QueryWindow::Close(), GetMainWindow(), Window::parent, QueryWindow::proc, SetFocusedWindow(), WC_CONFIRM_POPUP_QUERY, and Window::window_class.
Referenced by CmdPause(), MakeScreenshotWithConfirm(), DepotWindow::OnClick(), GenerateLandscapeWindow::OnClick(), GenerateProgressWindow::OnClick(), VehicleGroupWindow::OnClick(), BuildIndustryWindow::OnClick(), NetworkContentListWindow::OnClick(), NewGRFWindow::OnClick(), GameSettingsWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), NetworkClientListWindow::OnDropdownSelect(), and SaveLoadWindow::OnTimeout().
void ShowQueryString | ( | std::string_view | str, |
StringID | caption, | ||
uint | maxsize, | ||
Window * | parent, | ||
CharSetFilter | afilter, | ||
QueryStringFlags | flags | ||
) |
Show a query popup window with a textbox in it.
str | StringID for the text shown in the textbox |
caption | StringID of text shown in caption of querywindow |
maxsize | maximum size in bytes or characters (including terminating '\0') depending on flags |
parent | pointer to a Window that will handle the events (ok/cancel) of this window. |
afilter | filters out unwanted character input |
flags | various flags, |
Definition at line 1011 of file misc_gui.cpp.
References CloseWindowByClass(), LengthIsInChars, MAX_CHAR_LENGTH, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and WC_QUERY_STRING.
Referenced by BuildVehicleWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), CompanyWindow::OnClick(), DepotWindow::OnClick(), GSConfigWindow::OnClick(), GenerateLandscapeWindow::OnClick(), CreateScenarioWindow::OnClick(), IndustryViewWindow::OnClick(), NetworkGameWindow::OnClick(), NetworkStartServerWindow::OnClick(), NetworkClientListWindow::OnClick(), NewGRFInspectWindow::OnClick(), SpriteAlignerWindow::OnClick(), NewGRFParametersWindow::OnClick(), OrdersWindow::OnClick(), ScriptSettingsWindow::OnClick(), GameSettingsWindow::OnClick(), CustomCurrencyWindow::OnClick(), StationViewWindow::OnClick(), TimetableWindow::OnClick(), TownViewWindow::OnClick(), VehicleViewWindow::OnClick(), WaypointWindow::OnClick(), GenerateLandscapeWindow::OnDropdownSelect(), and ToolbarScenDatePanel().
void UpdateFillingPercent | ( | TextEffectID | te_id, |
uint8_t | percent, | ||
StringID | string | ||
) |
Update vehicle loading indicators.
te_id | TextEffectID to be updated. |
string | String which is printed. |
Definition at line 572 of file misc_gui.cpp.
References GetEncodedString().
Referenced by LoadUnloadVehicle().
|
static |
Definition at line 348 of file misc_gui.cpp.
|
staticconstexpr |
Definition at line 325 of file misc_gui.cpp.
|
staticconstexpr |
Definition at line 53 of file misc_gui.cpp.
|
staticconstexpr |
Definition at line 980 of file misc_gui.cpp.
|
staticconstexpr |
Definition at line 1118 of file misc_gui.cpp.
|
staticconstexpr |
Definition at line 591 of file misc_gui.cpp.