OpenTTD Source
20241120-master-g6d3adc6169
|
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. More... | |
int | Height () const |
Get height of Rect. More... | |
Rect | Shrink (int s) const |
Copy and shrink Rect by s pixels. More... | |
Rect | Shrink (int h, int v) const |
Copy and shrink Rect by h horizontal and v vertical pixels. More... | |
Rect | Shrink (int left, int top, int right, int bottom) const |
Copy and shrink Rect by pixels. More... | |
Rect | Shrink (const RectPadding &other) const |
Copy and shrink Rect by a RectPadding. More... | |
Rect | Shrink (const RectPadding &horz, const RectPadding &vert) const |
Copy and shrink Rect by a different horizontal and vertical RectPadding. More... | |
Rect | Expand (int s) const |
Copy and expand Rect by s pixels. More... | |
Rect | Expand (const RectPadding &other) const |
Copy and expand Rect by a RectPadding. More... | |
Rect | Translate (int x, int y) const |
Copy and translate Rect by x,y pixels. More... | |
Rect | WithWidth (int width, bool end) const |
Copy Rect and set its width. More... | |
Rect | Indent (int indent, bool end) const |
Copy Rect and indent it from its position. More... | |
Rect | WithHeight (int height, bool end=false) const |
Copy Rect and set its height. More... | |
bool | Contains (const Point &pt) const |
Test if a point falls inside this Rect. More... | |
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.
|
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 |
|
inline |
Get height of Rect.
Definition at line 91 of file geometry_type.hpp.
Referenced by EnsureVisibleCaption(), 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 StationViewWindow::DrawCargoRatings(), DrawCategory(), GoalListWindow::DrawListColumn(), TownAuthorityWindow::DrawRatings(), and DepotWindow::DrawVehicleInDepot().
|
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 StationViewWindow::DrawAcceptedCargo(), TownAuthorityWindow::DrawActions(), TimetableWindow::DrawArrivalDeparturePanel(), DrawCaption(), StationViewWindow::DrawCargoRatings(), NetworkContentListWindow::DrawDetails(), IndustryViewWindow::DrawInfo(), DrawInset(), GoalListWindow::DrawListColumn(), NetworkContentListWindow::DrawMatrix(), TownAuthorityWindow::DrawRatings(), BuildSignalWindow::DrawSignalSprite(), NewGRFInspectWindow::DrawString(), TimetableWindow::DrawSummaryPanel(), TimetableWindow::DrawTimetablePanel(), DepotWindow::DrawVehicleInDepot(), BaseVehicleListWindow::DrawVehicleListItems(), DrawVehicleRefitWindow(), ScriptDebugWindow::DrawWidgetLog(), Expand(), NetworkClientListWindow::GetButtonAtPoint(), ReplaceVehicleWindow::OnPaint(), BuildVehicleWindow::OnPaint(), and GameSettingsWindow::OnPaint().
|
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 DropdownWindow::UpdateSizeAndPosition().
|
inline |
Get width of Rect.
Definition at line 85 of file geometry_type.hpp.
Referenced by DrawAircraftImage(), DrawRoadVehImage(), DrawShipImage(), DrawTrainImage(), GetSingleVehicleWidth(), BitmapTileArea::Initialize(), and DropdownWindow::UpdateSizeAndPosition().
|
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(), NetworkContentListWindow::DrawMatrix(), BaseVehicleListWindow::DrawVehicleListItems(), and DrawVerticalScrollbar().
|
inline |
Copy Rect and set its width.
Definition at line 185 of file geometry_type.hpp.
Referenced by DrawHorizontalScrollbar(), GoalListWindow::DrawListColumn(), and TownAuthorityWindow::DrawRatings().