Go to the documentation of this file.
24 #include "table/strings.h"
46 if (!s->IsAwarded()) {
75 void HandleClick(
const Subsidy *s)
82 default: NOT_REACHED();
92 default: NOT_REACHED();
110 uint num_awarded = 0;
111 uint num_not_awarded = 0;
121 if (num_awarded == 0) num_awarded = 1;
122 if (num_not_awarded == 0) num_not_awarded = 1;
125 return 3 + num_awarded + num_not_awarded;
133 resize->height = d.height;
217 if (!gui_scope)
return;
222 static const NWidgetPart _nested_subsidies_list_widgets[] = {
240 WDP_AUTO,
"list_subsidies", 500, 127,
243 _nested_subsidies_list_widgets,
lengthof(_nested_subsidies_list_widgets)
247 void ShowSubsidiesList()
249 AllocateWindowDescFront<SubsidyListWindow>(&_subsidies_list_desc, 0);
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
uint32 TileIndex
The index/ID of a Tile.
uint CountLines()
Count the number of lines in this window.
static Titem * Get(size_t index)
Returns Titem with given index.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
Dimensions (a width and height) of a rectangle in 2D.
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
@ WC_SUBSIDIES_LIST
Subsidies list; Window numbers:
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
bool _ctrl_pressed
Is Ctrl pressed?
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
bool IsAwarded() const
Tests whether this subsidy has been awarded to someone.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
int32 WindowNumber
Number to differentiate different windows of the same class.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
@ ST_TOWN
Source/destination is a town.
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
High level window description.
Struct about subsidies, offered and awarded.
@ WDP_AUTO
Find a place automatically.
ResizeInfo resize
Resize information.
Date _date
Current date in days (day counter)
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
SourceID src
Index of source. Either TownID or IndustryID.
@ WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
@ WD_FRAMERECT_BOTTOM
Offset at bottom to draw the frame rectangular area.
@ ST_INDUSTRY
Source/destination is an industry.
void ConvertDateToYMD(Date date, YearMonthDay *ymd)
Converts a Date to a Year, Month & Day.
SourceID dst
Index of destination. Either TownID or IndustryID.
Coordinates of a point in 2D.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
WindowNumber window_number
Window number within the window class.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
SourceType dst_type
Destination of subsidised path (ST_INDUSTRY or ST_TOWN)
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Pair SetupSubsidyDecodeParam(const Subsidy *s, bool mode)
Setup the string parameters for printing the subsidy at the screen, and compute the news reference fo...
byte remaining
Remaining months when this subsidy is valid.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
void OnResize() override
Called after the window got resized.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
#define lengthof(x)
Return the length of an fixed size array.
Data structure to convert between Date and triplet (year, month, and day).
Data structure for an opened window.
SourceType src_type
Source of subsidised path (ST_INDUSTRY or ST_TOWN)
Specification of a rectangle with absolute coordinates of all edges.
CompanyID awarded
Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone.