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[] = {
155 _nested_transparency_widgets
163 AllocateWindowDescFront<TransparenciesWindow>(_transparency_desc, 0);
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
void OnInvalidateData([[maybe_unused]] int data=0, [[maybe_unused]] bool gui_scope=true) override
Some data on this window has become invalid.
void OnPaint() override
The window must be repainted.
bool _ctrl_pressed
Is Ctrl pressed?
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
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.
A number of safeguards to prevent using unsafe methods.
ClientSettings _settings_client
The current settings for this game.
Types related to global configuration settings.
Functions related to sound.
@ SND_15_BEEP
19 == 0x13 GUI button click
This file contains all sprite-related enums and defines.
Definition of base types and functions in a cross-platform compatible way.
SoundSettings sound
sound effect settings
Coordinates of a point in 2D.
Specification of a rectangle with absolute coordinates of all edges.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
bool click_beep
Beep on a random selection of buttons.
High level window description.
Data structure for an opened window.
void DrawWidgets() const
Paint all widgets of a window.
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
WindowNumber window_number
Window number within the window class.
Functions related to transparency.
void ToggleTransparency(TransparencyOption to)
Toggle the transparency option bit.
TransparencyOption
Transparency option bits: which position in _transparency_opt stands for which transparency.
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...
void ToggleInvisibility(TransparencyOption to)
Toggle the invisibility option bit.
uint TransparencyOptionBits
transparency option bits
void ToggleTransparencyLock(TransparencyOption to)
Toggle the transparency lock bit.
TransparencyOptionBits _transparency_opt
The bits that should be transparent.
void ShowTransparencyToolbar()
Show the transparency toolbar.
TransparencyOptionBits _transparency_lock
Prevent these bits from flipping with X.
TransparencyOptionBits _invisibility_opt
The bits that should be invisible.
uint8_t _display_opt
What do we want to draw/do?
Point GetToolbarAlignedWindowPosition(int window_width)
Computer the position of the top-left corner of a window to be opened right under the toolbar.
Functions, definitions and such used only by the GUI.
@ FR_LOWERED
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ WC_TRANSPARENCY_TOOLBAR
Transparency toolbar; Window numbers: