|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
107 WWB_PUSHBUTTON = 1 << 7,
139 virtual void AdjustPaddingForZoom();
153 template <
class NWID>
157 if (NWID *nwid =
dynamic_cast<NWID *
>(nwid_parent); nwid !=
nullptr)
return nwid;
167 template <
class NWID>
170 for (
const NWidgetBase *nwid_parent = this->
parent; nwid_parent !=
nullptr; nwid_parent = nwid_parent->
parent) {
171 if (
const NWID *nwid =
dynamic_cast<const NWID *
>(nwid_parent); nwid !=
nullptr)
return nwid;
176 virtual bool IsHighlighted()
const {
return false; }
177 virtual TextColour GetHighlightColour()
const {
return TC_INVALID; }
178 virtual void SetHighlighted([[maybe_unused]]
TextColour highlight_colour) {}
187 inline void SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
193 this->AdjustPaddingForZoom();
203 this->AdjustPaddingForZoom();
212 Rect GetCurrentRect()
const
215 r.left = this->
pos_x;
295 void AdjustPaddingForZoom()
override;
365 inline void SetLowered(
bool lowered);
366 inline bool IsLowered()
const;
367 inline void SetDisabled(
bool disabled);
368 inline bool IsDisabled()
const;
370 void FillWidgetLookup(
WidgetLookup &widget_lookup)
override;
372 bool IsHighlighted()
const override;
373 TextColour GetHighlightColour()
const override;
374 void SetHighlighted(
TextColour highlight_colour)
override;
449 void AdjustPaddingForZoom()
override;
450 void Add(std::unique_ptr<NWidgetBase> &&wid);
462 std::vector<std::unique_ptr<NWidgetBase>>
children;
488 void AdjustPaddingForZoom()
override;
518 void AdjustPaddingForZoom()
override;
519 void SetPIP(uint8_t pip_pre, uint8_t pip_inter, uint8_t pip_post);
520 void SetPIPRatio(uint8_t pip_ratio_pre, uint8_t pip_ratio_inter, uint8_t pip_rato_post);
609 void GetScrollOffsets(
int &start_x,
int &start_y,
int &base_offs_x,
int &base_offs_y);
637 void Add(std::unique_ptr<NWidgetBase> &&nwid);
638 void SetPIP(uint8_t pip_pre, uint8_t pip_inter, uint8_t pip_post);
639 void SetPIPRatio(uint8_t pip_ratio_pre, uint8_t pip_ratio_inter, uint8_t pip_ratio_post);
641 void AdjustPaddingForZoom()
override;
652 std::unique_ptr<NWidgetPIPContainer>
child;
752 this->stepsize = ClampTo<uint16_t>(
stepsize);
764 this->count = ClampTo<uint16_t>(num);
778 this->cap = ClampTo<uint16_t>(capacity);
792 uint16_t old_pos = this->
pos;
793 this->pos =
Clamp(position, 0, std::max(this->count - this->cap, 0));
794 return this->pos != old_pos;
806 if (difference == 0)
return false;
809 case SS_BIG: difference *= this->
cap;
break;
844 template <
typename Tcontainer>
847 assert(this->
GetCount() == container.size());
849 if (row == INT_MAX)
return std::end(container);
851 typename Tcontainer::iterator it = std::begin(container);
852 std::advance(it, row);
871 static void InvalidateDimensionCache();
873 static Dimension GetHorizontalDimension();
914 if (base >= max_space || step == 0)
return base;
915 if (step == 1)
return max_space;
916 uint increment = max_space - base;
917 increment -= increment % step;
918 return base + increment;
1210 return SetPadding(padding, padding, padding, padding);
Widget part for storing text colour.
Dimensions (a width and height) of a rectangle in 2D.
FontSize size
Font size of text.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
ZoomLevel
All zoom levels we know.
StringAlignment
How to align the to-be drawn text.
#define SETBITS(x, y)
Sets several bits in a variable.
Padding dimensions to apply to each side of a Rect.
constexpr bool IsInsideBS(const T x, const size_t base, const size_t size)
Checks if a value is between a window started at some base point.
@ FS_NORMAL
Index of the normal font in the font tables.
uint8_t lines
Number of text lines.
Base class that provides memory initialization on dynamically created objects.
Widget part for storing minimal text line data.
Coordinates of a point in 2D.
uint8_t spacing
Extra spacing around lines.
EventState
State of handling an event.
#define MAX_UVALUE(type)
The largest value that can be entered in a variable.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
FontSize
Available font sizes.
Data structure for an opened window.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Specification of a rectangle with absolute coordinates of all edges.
FontSize size
Font size of text lines.
#define CLRBITS(x, y)
Clears several bits in a variable.
TextColour colour
TextColour for DrawString.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.