OpenTTD Source 20251005-master-ga617d009cc
transparency_gui.cpp File Reference

The transparency GUI. More...

#include "stdafx.h"
#include "window_gui.h"
#include "transparency.h"
#include "sound_func.h"
#include "settings_type.h"
#include "widgets/transparency_widget.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

class  TransparenciesWindow
 

Functions

void ShowTransparencyToolbar ()
 Show the transparency toolbar.
 

Variables

TransparencyOptionBits _transparency_opt
 The bits that should be transparent.
 
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?
 
StationFacilities _facility_display_opt
 What station facilities to draw.
 
static constexpr NWidgetPart _nested_transparency_widgets []
 
static WindowDesc _transparency_desc (WDP_MANUAL, "toolbar_transparency", 0, 0, WC_TRANSPARENCY_TOOLBAR, WC_NONE, {}, _nested_transparency_widgets)
 

Detailed Description

The transparency GUI.

Definition in file transparency_gui.cpp.

Function Documentation

◆ ShowTransparencyToolbar()

void ShowTransparencyToolbar ( )

Show the transparency toolbar.

Definition at line 162 of file transparency_gui.cpp.

Referenced by MenuClickSettings(), and MainWindow::OnHotkey().

Variable Documentation

◆ _display_opt

◆ _facility_display_opt

StationFacilities _facility_display_opt

What station facilities to draw.

Definition at line 27 of file transparency_gui.cpp.

Referenced by MenuClickSettings(), and ToolbarOptionsClick().

◆ _invisibility_opt

TransparencyOptionBits _invisibility_opt

The bits that should be invisible.

Definition at line 25 of file transparency_gui.cpp.

Referenced by TransparenciesWindow::DrawWidget(), IsInvisibilitySet(), ToggleInvisibility(), and ToggleInvisibilityWithTransparency().

◆ _nested_transparency_widgets

constexpr NWidgetPart _nested_transparency_widgets[]
staticconstexpr
Initial value:
= {
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetStringTip(STR_TRANSPARENCY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_SIGNS), SetToolbarMinimalSize(1), SetFill(0, 1), SetSpriteTip(SPR_IMG_SIGN, STR_TRANSPARENT_SIGNS_TOOLTIP),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_TREES), SetToolbarMinimalSize(1), SetFill(0, 1), SetSpriteTip(SPR_IMG_PLANTTREES, STR_TRANSPARENT_TREES_TOOLTIP),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_HOUSES), SetToolbarMinimalSize(1), SetFill(0, 1), SetSpriteTip(SPR_IMG_TOWN, STR_TRANSPARENT_HOUSES_TOOLTIP),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_INDUSTRIES), SetToolbarMinimalSize(1), SetFill(0, 1), SetSpriteTip(SPR_IMG_INDUSTRY, STR_TRANSPARENT_INDUSTRIES_TOOLTIP),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_BUILDINGS), SetToolbarMinimalSize(1), SetFill(0, 1), SetSpriteTip(SPR_IMG_COMPANY_LIST, STR_TRANSPARENT_BUILDINGS_TOOLTIP),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_BRIDGES), SetToolbarMinimalSize(2), SetFill(0, 1), SetSpriteTip(SPR_IMG_BRIDGE, STR_TRANSPARENT_BRIDGES_TOOLTIP),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_STRUCTURES), SetToolbarMinimalSize(1), SetFill(0, 1), SetSpriteTip(SPR_IMG_TRANSMITTER, STR_TRANSPARENT_STRUCTURES_TOOLTIP),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_CATENARY), SetToolbarMinimalSize(1), SetFill(0, 1), SetSpriteTip(SPR_BUILD_X_ELRAIL, STR_TRANSPARENT_CATENARY_TOOLTIP),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_TEXT), SetToolbarMinimalSize(1), SetFill(0, 1), SetSpriteTip(SPR_IMG_TRAINLIST, STR_TRANSPARENT_TEXT_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 1), EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_TT_BUTTONS), SetMinimalSize(219, 13), SetToolTip(STR_TRANSPARENT_INVISIBLE_TOOLTIP),
}
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
constexpr NWidgetPart SetSpriteTip(SpriteID sprite, StringID tip={})
Widget part function for setting the sprite and tooltip.
constexpr NWidgetPart SetToolbarMinimalSize(int width)
Widget part function to setting the minimal size for a toolbar button.
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
constexpr NWidgetPart SetToolTip(StringID tip)
Widget part function for setting tooltip and clearing the widget data.
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
@ WID_TT_TREES
Trees transparency toggle button.
@ WID_TT_BRIDGES
Bridges transparency toggle button.
@ WID_TT_SIGNS
Signs background transparency toggle button.
@ WID_TT_BUTTONS
Panel with 'invisibility' buttons.
@ WID_TT_BUILDINGS
Company buildings and structures transparency toggle button.
@ WID_TT_INDUSTRIES
industries transparency toggle button.
@ WID_TT_CATENARY
Catenary transparency toggle button.
@ WID_TT_HOUSES
Houses transparency toggle button.
@ WID_TT_TEXT
Loading and cost/income text transparency toggle button.
@ WID_TT_STRUCTURES
Object structure transparency toggle button.
@ WWT_IMGBTN
(Toggle) Button with image
Definition widget_type.h:42
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:67
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:40
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:58
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:53
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:61

Definition at line 129 of file transparency_gui.cpp.

◆ _transparency_lock

TransparencyOptionBits _transparency_lock

Prevent these bits from flipping with X.

Definition at line 24 of file transparency_gui.cpp.

Referenced by TransparenciesWindow::DrawWidget(), ResetRestoreAllTransparency(), and ToggleTransparencyLock().

◆ _transparency_opt