OpenTTD Source 20241224-master-gf74b0cf984
|
Specification of a rectangle with absolute coordinates of all edges. More...
#include <geometry_type.hpp>
Public Member Functions | |
int | Width () const |
Get width of Rect. | |
int | Height () const |
Get height of Rect. | |
Rect | Shrink (int s) const |
Copy and shrink Rect by s pixels. | |
Rect | Shrink (int h, int v) const |
Copy and shrink Rect by h horizontal and v vertical pixels. | |
Rect | Shrink (int left, int top, int right, int bottom) const |
Copy and shrink Rect by pixels. | |
Rect | Shrink (const RectPadding &other) const |
Copy and shrink Rect by a RectPadding. | |
Rect | Shrink (const RectPadding &horz, const RectPadding &vert) const |
Copy and shrink Rect by a different horizontal and vertical RectPadding. | |
Rect | Expand (int s) const |
Copy and expand Rect by s pixels. | |
Rect | Expand (const RectPadding &other) const |
Copy and expand Rect by a RectPadding. | |
Rect | Translate (int x, int y) const |
Copy and translate Rect by x,y pixels. | |
Rect | WithWidth (int width, bool end) const |
Copy Rect and set its width. | |
Rect | Indent (int indent, bool end) const |
Copy Rect and indent it from its position. | |
Rect | WithHeight (int height, bool end=false) const |
Copy Rect and set its height. | |
bool | Contains (const Point &pt) const |
Test if a point falls inside this Rect. | |
Data Fields | |
int | left |
int | top |
int | right |
int | bottom |
Specification of a rectangle with absolute coordinates of all edges.
Definition at line 75 of file geometry_type.hpp.
|
inline |
Test if a point falls inside this Rect.
pt | the point to test. |
Definition at line 223 of file geometry_type.hpp.
Referenced by IndustryViewWindow::OnClick().
|
inline |
Copy and expand Rect by a RectPadding.
other | RectPadding to add to each side of Rect. |
Definition at line 163 of file geometry_type.hpp.
|
inline |
Copy and expand Rect by s pixels.
s | number of pixels to add to each side of Rect. |
Definition at line 153 of file geometry_type.hpp.
References Shrink().
Referenced by DrawAircraftImage(), DrawFrame(), DrawRoadVehImage(), DrawShipImage(), DrawTrainImage(), and Window::DrawWidgets().
|
inline |
Get height of Rect.
Definition at line 91 of file geometry_type.hpp.
Referenced by DrawAircraftImage(), DrawEngineList(), DrawHorizontalScrollbar(), DrawMatrix(), DrawRoadVehImage(), DrawShipImage(), DrawTrainDetails(), DrawTrainImage(), ErrmsgWindow::DrawWidget(), ScenarioEditorToolbarWindow::DrawWidget(), EnsureVisibleCaption(), GetAircraftSpriteSize(), GetRoadVehSpriteSize(), GetShipSpriteSize(), GetTrainSpriteSize(), BitmapTileArea::Initialize(), and PreventHiding().
|
inline |
Copy Rect and indent it from its position.
indent | offset in pixels for new Rect. |
end | if set, set indent at end of Rect, i.e. on right. |
Definition at line 198 of file geometry_type.hpp.
Referenced by DrawCategory(), NetworkClientListWindow::DrawCompany(), DrawEngineList(), StationViewWindow::DrawEntries(), GoalListWindow::DrawListColumn(), TownAuthorityWindow::DrawRatings(), DrawTrainDetails(), DepotWindow::DrawVehicleInDepot(), BaseVehicleListWindow::DrawVehicleListItems(), DrawVehicleRefitWindow(), SelectCompanyLiveryWindow::DrawWidget(), CompanyInfrastructureWindow::DrawWidget(), DepotWindow::DrawWidget(), GSConfigWindow::DrawWidget(), GraphLegendWindow::DrawWidget(), PaymentRatesGraphWindow::DrawWidget(), IndustryProductionGraphWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), PerformanceLeagueWindow::DrawWidget(), ScriptLeagueWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), MessageHistoryWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), SmallMapWindow::DrawWidget(), SubsidyListWindow::DrawWidget(), QueryString::GetBoundingRect(), QueryString::GetCaretPosition(), QueryString::GetCharAtPosition(), and IndustryViewWindow::OnClick().
|
inline |
Copy and shrink Rect by a different horizontal and vertical RectPadding.
horz | RectPadding to remove from left and right of Rect. |
vert | RectPadding to remove from top and bottom of Rect. |
Definition at line 143 of file geometry_type.hpp.
|
inline |
Copy and shrink Rect by a RectPadding.
other | RectPadding to remove from each side of Rect. |
Definition at line 132 of file geometry_type.hpp.
|
inline |
Copy and shrink Rect by h horizontal and v vertical pixels.
h | number of pixels to remove from left and right sides. |
v | number of pixels to remove from top and bottom sides. |
Definition at line 109 of file geometry_type.hpp.
|
inline |
Copy and shrink Rect by pixels.
left | number of pixels to remove from left side. |
top | number of pixels to remove from top side. |
right | number of pixels to remove from right side. |
bottom | number of pixels to remove from bottom side. |
Definition at line 122 of file geometry_type.hpp.
|
inline |
Copy and shrink Rect by s pixels.
s | number of pixels to remove from each side of Rect. |
Definition at line 98 of file geometry_type.hpp.
Referenced by NWidgetBackground::Draw(), NWidgetScrollbar::Draw(), NWidgetLeaf::Draw(), StationViewWindow::DrawAcceptedCargo(), TownAuthorityWindow::DrawActions(), TimetableWindow::DrawArrivalDeparturePanel(), DrawArrowButtons(), NetworkClientListWindow::DrawButtons(), DrawCaption(), StationViewWindow::DrawCargoRatings(), NetworkContentListWindow::DrawDetails(), DrawDropDownButton(), DrawEngineList(), DrawFrame(), DrawFrameRect(), IndustryViewWindow::DrawInfo(), DrawInset(), GoalListWindow::DrawListColumn(), NetworkContentListWindow::DrawMatrix(), TownAuthorityWindow::DrawRatings(), DrawResizeBox(), NetworkGameWindow::DrawServerLine(), BuildSignalWindow::DrawSignalSprite(), NewGRFInspectWindow::DrawString(), TimetableWindow::DrawSummaryPanel(), TimetableWindow::DrawTimetablePanel(), NewGRFInspectWindow::DrawVehicleChainWidget(), DepotWindow::DrawVehicleInDepot(), BaseVehicleListWindow::DrawVehicleListItems(), DrawVehicleRefitWindow(), AIConfigWindow::DrawWidget(), BuildAirportWindow::DrawWidget(), ReplaceVehicleWindow::DrawWidget(), BootstrapErrorWindow::DrawWidget(), BootstrapAskForDownloadWindow::DrawWidget(), BuildBridgeWindow::DrawWidget(), CheatWindow::DrawWidget(), SelectCompanyLiveryWindow::DrawWidget(), DepotWindow::DrawWidget(), BuildDocksDepotWindow::DrawWidget(), DropdownWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), GSConfigWindow::DrawWidget(), GenerateProgressWindow::DrawWidget(), GraphLegendWindow::DrawWidget(), BaseGraphWindow::DrawWidget(), PaymentRatesGraphWindow::DrawWidget(), IndustryProductionGraphWindow::DrawWidget(), VehicleGroupWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), IndustryDirectoryWindow::DrawWidget(), IndustryCargoesWindow::DrawWidget(), PerformanceLeagueWindow::DrawWidget(), ScriptLeagueWindow::DrawWidget(), LinkGraphLegendWindow::DrawWidget(), LandInfoWindow::DrawWidget(), TooltipsWindow::DrawWidget(), MusicTrackSelectionWindow::DrawWidget(), MusicWindow::DrawWidget(), BaseNetworkContentDownloadStatusWindow::DrawWidget(), NetworkClientListWindow::DrawWidget(), NetworkJoinStatusWindow::DrawWidget(), SpriteAlignerWindow::DrawWidget(), NewGRFParametersWindow::DrawWidget(), NewGRFWindow::DrawWidget(), SavePresetWindow::DrawWidget(), ScanProgressWindow::DrawWidget(), MessageHistoryWindow::DrawWidget(), BuildObjectWindow::DrawWidget(), OrdersWindow::DrawWidget(), PickerWindow::DrawWidget(), BuildRailStationWindow::DrawWidget(), BuildRailDepotWindow::DrawWidget(), BuildRoadDepotWindow::DrawWidget(), BuildRoadStationWindow::DrawWidget(), ScriptListWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), GameSettingsWindow::DrawWidget(), SignListWindow::DrawWidget(), SmallMapWindow::DrawWidget(), CompanyStationsWindow::DrawWidget(), SelectStationWindow< T >::DrawWidget(), StatusBarWindow::DrawWidget(), StoryBookWindow::DrawWidget(), SubsidyListWindow::DrawWidget(), TextfileWindow::DrawWidget(), TownAuthorityWindow::DrawWidget(), TownViewWindow::DrawWidget(), TownDirectoryWindow::DrawWidget(), TransparenciesWindow::DrawWidget(), RefitWindow::DrawWidget(), VehicleDetailsWindow::DrawWidget(), VehicleViewWindow::DrawWidget(), ScriptDebugWindow::DrawWidgetLog(), Window::DrawWidgets(), Expand(), QueryString::GetBoundingRect(), NetworkClientListWindow::GetButtonAtPoint(), QueryString::GetCaretPosition(), QueryString::GetCharAtPosition(), DropdownWindow::GetDropDownItem(), HighlightDragPosition(), ReplaceVehicleWindow::OnClick(), BuildVehicleWindow::OnClick(), CheatWindow::OnClick(), GSConfigWindow::OnClick(), IndustryViewWindow::OnClick(), NewGRFParametersWindow::OnClick(), ScriptSettingsWindow::OnClick(), ReplaceVehicleWindow::OnPaint(), BuildVehicleWindow::OnPaint(), GameSettingsWindow::OnPaint(), StationViewWindow::OnPaint(), and NetworkClientListWindow::OnTooltip().
|
inline |
Copy and translate Rect by x,y pixels.
x | number of pixels to move horizontally. |
y | number of pixels to move vertically. |
Definition at line 174 of file geometry_type.hpp.
Referenced by DrawRoadVehImage(), DrawTrainImage(), DepotWindow::DrawVehicleInDepot(), BuildAirportWindow::DrawWidget(), BaseGraphWindow::DrawWidget(), PaymentRatesGraphWindow::DrawWidget(), IndustryProductionGraphWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), NetworkClientListWindow::DrawWidget(), SpriteAlignerWindow::DrawWidget(), SmallMapWindow::DrawWidget(), ScrollEditBoxTextRect(), and DropdownWindow::UpdateSizeAndPosition().
|
inline |
Get width of Rect.
Definition at line 85 of file geometry_type.hpp.
Referenced by DrawAircraftImage(), DrawMatrix(), DrawRoadVehImage(), DrawShipImage(), DrawTrainImage(), NewGRFInspectWindow::DrawVehicleChainWidget(), DrawVerticalScrollbar(), SmallMapWindow::DrawWidget(), RefitWindow::DrawWidget(), GetAircraftSpriteSize(), GetRoadVehSpriteSize(), GetShipSpriteSize(), GetSingleVehicleWidth(), GetTrainSpriteSize(), BitmapTileArea::Initialize(), CheatWindow::OnClick(), GSConfigWindow::OnClick(), NewGRFParametersWindow::OnClick(), ScriptSettingsWindow::OnClick(), and ScrollEditBoxTextRect().
|
inline |
Copy Rect and set its height.
width | height in pixels for new Rect. |
end | if set, set height at end of Rect, i.e. at bottom. |
Definition at line 211 of file geometry_type.hpp.
Referenced by NetworkContentListWindow::DrawDetails(), DrawEngineList(), NetworkContentListWindow::DrawMatrix(), DepotWindow::DrawVehicleInDepot(), BaseVehicleListWindow::DrawVehicleListItems(), DrawVerticalScrollbar(), BuildAirportWindow::DrawWidget(), BuildBridgeWindow::DrawWidget(), SelectCompanyLiveryWindow::DrawWidget(), DepotWindow::DrawWidget(), ErrmsgWindow::DrawWidget(), SaveLoadWindow::DrawWidget(), BaseGraphWindow::DrawWidget(), PaymentRatesGraphWindow::DrawWidget(), IndustryProductionGraphWindow::DrawWidget(), VehicleGroupWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), NetworkClientListWindow::DrawWidget(), SmallMapWindow::DrawWidget(), and VehicleDetailsWindow::DrawWidget().
|
inline |
Copy Rect and set its width.
Definition at line 185 of file geometry_type.hpp.
Referenced by DrawButtonDropdown(), NetworkClientListWindow::DrawCompany(), CompanyInfrastructureWindow::DrawCountLine(), DrawEngineList(), StationViewWindow::DrawEntries(), DrawHorizontalScrollbar(), GoalListWindow::DrawListColumn(), TownAuthorityWindow::DrawRatings(), NetworkGameWindow::DrawServerLine(), Window::DrawSortButtonState(), DepotWindow::DrawVehicleInDepot(), SelectCompanyLiveryWindow::DrawWidget(), CompanyInfrastructureWindow::DrawWidget(), DepotWindow::DrawWidget(), GSConfigWindow::DrawWidget(), PaymentRatesGraphWindow::DrawWidget(), IndustryProductionGraphWindow::DrawWidget(), BuildIndustryWindow::DrawWidget(), PerformanceLeagueWindow::DrawWidget(), ScriptLeagueWindow::DrawWidget(), MessageHistoryWindow::DrawWidget(), ScriptSettingsWindow::DrawWidget(), SmallMapWindow::DrawWidget(), VehicleDetailsWindow::DrawWidget(), ReplaceVehicleWindow::OnClick(), BuildVehicleWindow::OnClick(), IndustryViewWindow::OnClick(), and ScrollEditBoxTextRect().
int Rect::bottom |
Definition at line 79 of file geometry_type.hpp.
int Rect::left |
Definition at line 76 of file geometry_type.hpp.
int Rect::right |
Definition at line 78 of file geometry_type.hpp.
int Rect::top |
Definition at line 77 of file geometry_type.hpp.