19#include "table/strings.h"
29class TransparenciesWindow :
public Window
131 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
133 if (!gui_scope)
return;
140static constexpr std::initializer_list<NWidgetPart> _nested_transparency_widgets = {
166 WindowClass::TransparencyToolbar, WindowClass::None,
168 _nested_transparency_widgets
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Compute the initial position of the window.
TransparencyOption GetTransparencyOptionOfWidget(WidgetID widget) const
Get the TransparencyOption associated with a widget.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void OnPaint() override
The window must be repainted.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
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.
#define Point
Macro that prevents name conflicts between included headers.
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.
constexpr bool IsInsideMM(const size_t x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
EnumBitSet< DisplayOption, uint8_t > DisplayOptions
Bitset of DisplayOption elements.
A number of safeguards to prevent using unsafe methods.
Types related to global configuration settings.
void SndClickBeep()
Play a beep sound for a click event if enabled in settings.
Functions related to sound.
This file contains all sprite-related enums and defines.
Definition of base types and functions in a cross-platform compatible way.
Specification of a rectangle with absolute coordinates of all edges.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Rect WithY(int new_top, int new_bottom) const
Create a new Rect, replacing the top and bottom coordinates.
High level window description.
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...
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
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.
StationFacilities _facility_display_opt
What station facilities to draw.
TransparencyOptions _invisibility_opt
The bits that should be invisible.
void ToggleTransparency(TransparencyOption to)
Toggle the transparency option bit.
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.
EnumBitSet< TransparencyOption, uint32_t > TransparencyOptions
Bitset of TransparencyOption elements.
TransparencyOptions _transparency_opt
The bits that should be transparent.
TransparencyOptions _transparency_lock
Prevent these bits from flipping with X.
DisplayOptions _display_opt
What do we want to draw/do?
TransparencyOption
Transparency option bits: which position in _transparency_opt stands for which transparency.
@ Invalid
Invalid transparency option.
void ToggleTransparencyLock(TransparencyOption to)
Toggle the transparency lock bit.
TransparencyOptions _invisibility_opt
The bits that should be invisible.
static WindowDesc _transparency_desc(WindowPosition::Manual, "toolbar_transparency", 0, 0, WindowClass::TransparencyToolbar, WindowClass::None, {}, _nested_transparency_widgets)
Window definition for the transparency toolbar window.
void ShowTransparencyToolbar()
Show the transparency toolbar.
TransparencyOptions _transparency_lock
Prevent these bits from flipping with X.
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.
@ Lowered
If set the frame is lowered and the background colour brighter (ie. buttons when pressed).
Twindow * AllocateWindowDescFront(WindowDesc &desc, WindowNumber window_number, Targs... extra_arguments)
Open a new window.
@ Manual
Manually align the window (so no automatic location finding).