|
OpenTTD Source
14.0-beta3
|
Go to the documentation of this file.
19 #include "table/strings.h"
42 void DrawWidget(
const Rect &r,
WidgetID widget)
const override
64 DrawFrameRect(wr.left, fr.top, wr.right, fr.bottom, COLOUR_PALE_GREEN,
72 void OnClick([[maybe_unused]]
Point pt,
WidgetID widget, [[maybe_unused]]
int click_count)
override
88 const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(i);
107 Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]]
int window_number)
override
110 pt.y += 2 * (sm_height - this->GetWidget<NWidgetBase>(
WID_TT_BUTTONS)->current_y);
119 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
121 if (!gui_scope)
return;
128 static constexpr
NWidgetPart _nested_transparency_widgets[] = {
151 static WindowDesc _transparency_desc(__FILE__, __LINE__,
155 std::begin(_nested_transparency_widgets), std::end(_nested_transparency_widgets)
163 AllocateWindowDescFront<TransparenciesWindow>(&_transparency_desc, 0);
@ WC_TRANSPARENCY_TOOLBAR
Transparency toolbar; Window numbers:
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
bool IsTransparencySet(TransparencyOption to)
Check if the transparency option bit is set and if we aren't in the game menu (there's never transpar...
bool _ctrl_pressed
Is Ctrl pressed?
@ SND_15_BEEP
19 == 0x13 GUI button click
ClientSettings _settings_client
The current settings for this game.
@ FR_LOWERED
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
void ToggleTransparencyLock(TransparencyOption to)
Toggle the transparency lock bit.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
High level window description.
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.
SoundSettings sound
sound effect settings
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
TransparencyOptionBits _invisibility_opt
The bits that should be invisible.
void ToggleInvisibility(TransparencyOption to)
Toggle the invisibility option bit.
uint TransparencyOptionBits
transparency option bits
Point GetToolbarAlignedWindowPosition(int window_width)
Computer the position of the top-left corner of a window to be opened right under the toolbar.
void OnPaint() override
The window must be repainted.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Coordinates of a point in 2D.
void OnInvalidateData([[maybe_unused]] int data=0, [[maybe_unused]] bool gui_scope=true) override
Some data on this window has become invalid.
WindowNumber window_number
Window number within the window class.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
TransparencyOption
Transparency option bits: which position in _transparency_opt stands for which transparency.
void ShowTransparencyToolbar()
Show the transparency toolbar.
TransparencyOptionBits _transparency_opt
The bits that should be transparent.
void ToggleTransparency(TransparencyOption to)
Toggle the transparency option bit.
TransparencyOptionBits _transparency_lock
Prevent these bits from flipping with X.
byte _display_opt
What do we want to draw/do?
bool click_beep
Beep on a random selection of buttons.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
Data structure for an opened window.
void DrawWidgets() const
Paint all widgets of a window.
Specification of a rectangle with absolute coordinates of all edges.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.