OpenTTD
Data Structures | Functions | Variables
airport_gui.cpp File Reference

The GUI for airports. More...

#include "stdafx.h"
#include "window_gui.h"
#include "station_gui.h"
#include "terraform_gui.h"
#include "sound_func.h"
#include "window_func.h"
#include "strings_func.h"
#include "viewport_func.h"
#include "company_func.h"
#include "tilehighlight_func.h"
#include "company_base.h"
#include "station_type.h"
#include "newgrf_airport.h"
#include "newgrf_callbacks.h"
#include "widgets/dropdown_type.h"
#include "core/geometry_func.hpp"
#include "hotkeys.h"
#include "vehicle_func.h"
#include "gui.h"
#include "widgets/airport_widget.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  BuildAirToolbarWindow
 Airport build toolbar window handler. More...
 
class  BuildAirportWindow
 

Functions

static void ShowBuildAirportPicker (Window *parent)
 
SpriteID GetCustomAirportSprite (const AirportSpec *as, byte layout)
 
void CcBuildAirport (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
static void PlaceAirport (TileIndex tile)
 Place an airport. More...
 
static EventState AirportToolbarGlobalHotkeys (int hotkey)
 Handler for global hotkeys of the BuildAirToolbarWindow. More...
 
WindowShowBuildAirToolbar ()
 Open the build airport toolbar window. More...
 
void InitializeAirportGui ()
 

Variables

static AirportClassID _selected_airport_class
 the currently visible airport class
 
static int _selected_airport_index
 the index of the selected airport in the current class or -1
 
static byte _selected_airport_layout
 selected airport layout number.
 
static Hotkey airtoolbar_hotkeys []
 
static const NWidgetPart _nested_air_toolbar_widgets []
 
static WindowDesc _air_toolbar_desc (WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets), &BuildAirToolbarWindow::hotkeys)
 
static const NWidgetPart _nested_build_airport_widgets []
 
static WindowDesc _build_airport_desc (WDP_AUTO, "build_station_air", 0, 0, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_build_airport_widgets, lengthof(_nested_build_airport_widgets))
 

Detailed Description

The GUI for airports.

Definition in file airport_gui.cpp.

Function Documentation

◆ AirportToolbarGlobalHotkeys()

static EventState AirportToolbarGlobalHotkeys ( int  hotkey)
static

Handler for global hotkeys of the BuildAirToolbarWindow.

Parameters
hotkeyHotkey
Returns
ES_HANDLED if hotkey was accepted.

Definition at line 160 of file airport_gui.cpp.

◆ PlaceAirport()

static void PlaceAirport ( TileIndex  tile)
static

Place an airport.

Parameters
tilePosition to put the new airport.

Definition at line 57 of file airport_gui.cpp.

References _ctrl_pressed, _selected_airport_index, and SB().

Referenced by BuildAirToolbarWindow::OnPlaceObject().

◆ ShowBuildAirToolbar()

Window* ShowBuildAirToolbar ( )

Open the build airport toolbar window.

If the terraform toolbar is linked to the toolbar, that window is also opened.

Returns
newly opened airport toolbar, or NULL if the toolbar could not be opened.

Definition at line 203 of file airport_gui.cpp.

References _local_company, DeleteWindowByClass(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and WC_BUILD_TOOLBAR.

Referenced by MenuClickBuildAir().

Variable Documentation

◆ _nested_air_toolbar_widgets

const NWidgetPart _nested_air_toolbar_widgets[]
static
Initial value:
= {
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_AIRPORT), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
}
Horizontal container.
Definition: widget_type.h:75
Close box (at top-left of a window)
Definition: widget_type.h:69
Build airport button.
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1014
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
Simple depressed panel.
Definition: widget_type.h:50
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new &#39;real&#39; widget.
Definition: widget_type.h:1114
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
Demolish button.
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:66
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:983
(Toggle) Button with image
Definition: widget_type.h:52

Definition at line 175 of file airport_gui.cpp.

◆ airtoolbar_hotkeys

Hotkey airtoolbar_hotkeys[]
static
Initial value:
= {
Hotkey('1', "airport", WID_AT_AIRPORT),
Hotkey('2', "demolish", WID_AT_DEMOLISH),
HOTKEY_LIST_END
}
All data for a single hotkey.
Definition: hotkeys.h:24
Build airport button.
Demolish button.

Definition at line 168 of file airport_gui.cpp.