OpenTTD Source  1.11.2
toolbar_gui.cpp File Reference
#include "stdafx.h"
#include "gui.h"
#include "window_gui.h"
#include "window_func.h"
#include "viewport_func.h"
#include "command_func.h"
#include "vehicle_gui.h"
#include "rail_gui.h"
#include "road.h"
#include "road_gui.h"
#include "date_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "terraform_gui.h"
#include "strings_func.h"
#include "company_func.h"
#include "company_gui.h"
#include "vehicle_base.h"
#include "cheat_func.h"
#include "transparency_gui.h"
#include "screenshot.h"
#include "signs_func.h"
#include "fios.h"
#include "console_gui.h"
#include "news_gui.h"
#include "ai/ai_gui.hpp"
#include "tilehighlight_func.h"
#include "smallmap_gui.h"
#include "graph_gui.h"
#include "textbuf_gui.h"
#include "linkgraph/linkgraph_gui.h"
#include "newgrf_debug.h"
#include "hotkeys.h"
#include "engine_base.h"
#include "highscore.h"
#include "game/game.hpp"
#include "goal_base.h"
#include "story_base.h"
#include "toolbar_gui.h"
#include "framerate_type.h"
#include "guitimer_func.h"
#include "screenshot_gui.h"
#include "widgets/toolbar_widget.h"
#include "network/network.h"
#include "network/network_gui.h"
#include "network/network_func.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

class  DropDownListCheckedItem
 Drop down list entry for showing a checked/unchecked toggle item. More...
 
class  DropDownListCompanyItem
 Drop down list entry for showing a company entry, with companies 'blob'. More...
 
class  NWidgetToolbarContainer
 Full blown container to make it behave exactly as we want :) More...
 
class  NWidgetMainToolbarContainer
 Container for the 'normal' main toolbar. More...
 
class  NWidgetScenarioToolbarContainer
 Container for the scenario editor's toolbar. More...
 
struct  MainToolbarWindow
 Main toolbar. More...
 
struct  ScenarioEditorToolbarWindow
 

Typedefs

typedef CallBackFunction MenuClickedProc(int index)
 
typedef CallBackFunction ToolbarButtonProc(Window *w)
 

Enumerations

enum  ToolbarMode { TB_NORMAL, TB_UPPER, TB_LOWER }
 Toobar modes.
 
enum  CallBackFunction { CBF_NONE, CBF_PLACE_SIGN, CBF_PLACE_LANDINFO }
 Callback functions.
 
enum  OptionMenuEntries {
  OME_GAMEOPTIONS, OME_SETTINGS, OME_SCRIPT_SETTINGS, OME_NEWGRFSETTINGS,
  OME_TRANSPARENCIES, OME_SHOW_TOWNNAMES, OME_SHOW_STATIONNAMES, OME_SHOW_WAYPOINTNAMES,
  OME_SHOW_SIGNS, OME_SHOW_COMPETITOR_SIGNS, OME_FULL_ANIMATION, OME_FULL_DETAILS,
  OME_TRANSPARENTBUILDINGS, OME_SHOW_STATIONSIGNS
}
 Game Option button menu entries.
 
enum  SaveLoadEditorMenuEntries {
  SLEME_SAVE_SCENARIO = 0, SLEME_LOAD_SCENARIO, SLEME_SAVE_HEIGHTMAP, SLEME_LOAD_HEIGHTMAP,
  SLEME_EXIT_TOINTRO, SLEME_EXIT_GAME = 6, SLEME_MENUCOUNT
}
 SaveLoad entries in scenario editor mode.
 
enum  SaveLoadNormalMenuEntries {
  SLNME_SAVE_GAME = 0, SLNME_LOAD_GAME, SLNME_EXIT_TOINTRO, SLNME_EXIT_GAME = 4,
  SLNME_MENUCOUNT
}
 SaveLoad entries in normal game mode.
 
enum  MapMenuEntries {
  MME_SHOW_SMALLMAP = 0, MME_SHOW_EXTRAVIEWPORTS, MME_SHOW_LINKGRAPH, MME_SHOW_SIGNLISTS,
  MME_SHOW_TOWNDIRECTORY, MME_SHOW_INDUSTRYDIRECTORY
}
 
enum  MainToolbarHotkeys {
  MTHK_PAUSE, MTHK_FASTFORWARD, MTHK_SETTINGS, MTHK_SAVEGAME,
  MTHK_LOADGAME, MTHK_SMALLMAP, MTHK_TOWNDIRECTORY, MTHK_SUBSIDIES,
  MTHK_STATIONS, MTHK_FINANCES, MTHK_COMPANIES, MTHK_STORY,
  MTHK_GOAL, MTHK_GRAPHS, MTHK_LEAGUE, MTHK_INDUSTRIES,
  MTHK_TRAIN_LIST, MTHK_ROADVEH_LIST, MTHK_SHIP_LIST, MTHK_AIRCRAFT_LIST,
  MTHK_ZOOM_IN, MTHK_ZOOM_OUT, MTHK_BUILD_RAIL, MTHK_BUILD_ROAD,
  MTHK_BUILD_TRAM, MTHK_BUILD_DOCKS, MTHK_BUILD_AIRPORT, MTHK_BUILD_TREES,
  MTHK_MUSIC, MTHK_LANDINFO, MTHK_AI_DEBUG, MTHK_SMALL_SCREENSHOT,
  MTHK_ZOOMEDIN_SCREENSHOT, MTHK_DEFAULTZOOM_SCREENSHOT, MTHK_GIANT_SCREENSHOT, MTHK_CHEATS,
  MTHK_TERRAFORM, MTHK_EXTRA_VIEWPORT, MTHK_CLIENT_LIST, MTHK_SIGN_LIST
}
 
enum  MainToolbarEditorHotkeys {
  MTEHK_PAUSE, MTEHK_FASTFORWARD, MTEHK_SETTINGS, MTEHK_SAVEGAME,
  MTEHK_GENLAND, MTEHK_GENTOWN, MTEHK_GENINDUSTRY, MTEHK_BUILD_ROAD,
  MTEHK_BUILD_TRAM, MTEHK_BUILD_DOCKS, MTEHK_BUILD_TREES, MTEHK_SIGN,
  MTEHK_MUSIC, MTEHK_LANDINFO, MTEHK_SMALL_SCREENSHOT, MTEHK_ZOOMEDIN_SCREENSHOT,
  MTEHK_DEFAULTZOOM_SCREENSHOT, MTEHK_GIANT_SCREENSHOT, MTEHK_ZOOM_IN, MTEHK_ZOOM_OUT,
  MTEHK_TERRAFORM, MTEHK_SMALLMAP, MTEHK_EXTRA_VIEWPORT
}
 

Functions

static void PopupMainToolbMenu (Window *w, int widget, DropDownList &&list, int def)
 Pop up a generic text only menu. More...
 
static void PopupMainToolbMenu (Window *w, int widget, StringID string, int count)
 Pop up a generic text only menu. More...
 
static void PopupMainCompanyToolbMenu (Window *w, int widget, int grey=0)
 Pop up a generic company list menu. More...
 
static CallBackFunction SelectSignTool ()
 
static CallBackFunction ToolbarPauseClick (Window *w)
 
static CallBackFunction ToolbarFastForwardClick (Window *w)
 Toggle fast forward mode. More...
 
static CallBackFunction ToolbarOptionsClick (Window *w)
 Handle click on Options button in toolbar. More...
 
static CallBackFunction MenuClickSettings (int index)
 Handle click on one of the entries in the Options button menu. More...
 
static CallBackFunction ToolbarSaveClick (Window *w)
 Handle click on Save button in toolbar in normal game mode. More...
 
static CallBackFunction ToolbarScenSaveOrLoad (Window *w)
 Handle click on SaveLoad button in toolbar in the scenario editor. More...
 
static CallBackFunction MenuClickSaveLoad (int index=0)
 Handle click on one of the entries in the SaveLoad menu. More...
 
static CallBackFunction ToolbarMapClick (Window *w)
 
static CallBackFunction ToolbarScenMapTownDir (Window *w)
 
static CallBackFunction MenuClickMap (int index)
 Handle click on one of the entries in the Map menu. More...
 
static CallBackFunction ToolbarTownClick (Window *w)
 
static CallBackFunction MenuClickTown (int index)
 Handle click on one of the entries in the Town menu. More...
 
static CallBackFunction ToolbarSubsidiesClick (Window *w)
 
static CallBackFunction MenuClickSubsidies (int index)
 Handle click on the entry in the Subsidies menu. More...
 
static CallBackFunction ToolbarStationsClick (Window *w)
 
static CallBackFunction MenuClickStations (int index)
 Handle click on the entry in the Stations menu. More...
 
static CallBackFunction ToolbarFinancesClick (Window *w)
 
static CallBackFunction MenuClickFinances (int index)
 Handle click on the entry in the finances overview menu. More...
 
static CallBackFunction ToolbarCompaniesClick (Window *w)
 
static CallBackFunction MenuClickCompany (int index)
 Handle click on the entry in the Company menu. More...
 
static CallBackFunction ToolbarStoryClick (Window *w)
 
static CallBackFunction MenuClickStory (int index)
 Handle click on the entry in the Story menu. More...
 
static CallBackFunction ToolbarGoalClick (Window *w)
 
static CallBackFunction MenuClickGoal (int index)
 Handle click on the entry in the Goal menu. More...
 
static CallBackFunction ToolbarGraphsClick (Window *w)
 
static CallBackFunction MenuClickGraphs (int index)
 Handle click on the entry in the Graphs menu. More...
 
static CallBackFunction ToolbarLeagueClick (Window *w)
 
static CallBackFunction MenuClickLeague (int index)
 Handle click on the entry in the CompanyLeague menu. More...
 
static CallBackFunction ToolbarIndustryClick (Window *w)
 
static CallBackFunction MenuClickIndustry (int index)
 Handle click on the entry in the Industry menu. More...
 
static void ToolbarVehicleClick (Window *w, VehicleType veh)
 
static CallBackFunction ToolbarTrainClick (Window *w)
 
static CallBackFunction MenuClickShowTrains (int index)
 Handle click on the entry in the Train menu. More...
 
static CallBackFunction ToolbarRoadClick (Window *w)
 
static CallBackFunction MenuClickShowRoad (int index)
 Handle click on the entry in the Road Vehicles menu. More...
 
static CallBackFunction ToolbarShipClick (Window *w)
 
static CallBackFunction MenuClickShowShips (int index)
 Handle click on the entry in the Ships menu. More...
 
static CallBackFunction ToolbarAirClick (Window *w)
 
static CallBackFunction MenuClickShowAir (int index)
 Handle click on the entry in the Aircraft menu. More...
 
static CallBackFunction ToolbarZoomInClick (Window *w)
 
static CallBackFunction ToolbarZoomOutClick (Window *w)
 
static CallBackFunction ToolbarBuildRailClick (Window *w)
 
static CallBackFunction MenuClickBuildRail (int index)
 Handle click on the entry in the Build Rail menu. More...
 
static CallBackFunction ToolbarBuildRoadClick (Window *w)
 
static CallBackFunction MenuClickBuildRoad (int index)
 Handle click on the entry in the Build Road menu. More...
 
static CallBackFunction ToolbarBuildTramClick (Window *w)
 
static CallBackFunction MenuClickBuildTram (int index)
 Handle click on the entry in the Build Tram menu. More...
 
static CallBackFunction ToolbarBuildWaterClick (Window *w)
 
static CallBackFunction MenuClickBuildWater (int index)
 Handle click on the entry in the Build Waterways menu. More...
 
static CallBackFunction ToolbarBuildAirClick (Window *w)
 
static CallBackFunction MenuClickBuildAir (int index)
 Handle click on the entry in the Build Air menu. More...
 
static CallBackFunction ToolbarForestClick (Window *w)
 
static CallBackFunction MenuClickForest (int index)
 Handle click on the entry in the landscaping menu. More...
 
static CallBackFunction ToolbarMusicClick (Window *w)
 
static CallBackFunction MenuClickMusicWindow (int index)
 Handle click on the entry in the Music menu. More...
 
static CallBackFunction ToolbarNewspaperClick (Window *w)
 
static CallBackFunction MenuClickNewspaper (int index)
 Handle click on the entry in the Newspaper menu. More...
 
static CallBackFunction PlaceLandBlockInfo ()
 
static CallBackFunction ToolbarHelpClick (Window *w)
 
void ToggleBoundingBoxes ()
 Toggle drawing of sprites' bounding boxes. More...
 
void ToggleDirtyBlocks ()
 Toggle drawing of the dirty blocks. More...
 
void SetStartingYear (Year year)
 Set the starting year for a scenario. More...
 
static CallBackFunction MenuClickHelp (int index)
 Choose the proper callback function for the main toolbar's help menu. More...
 
static CallBackFunction ToolbarSwitchClick (Window *w)
 
static CallBackFunction ToolbarScenDatePanel (Window *w)
 Called when clicking at the date panel of the scenario editor toolbar.
 
static CallBackFunction ToolbarScenDateBackward (Window *w)
 
static CallBackFunction ToolbarScenDateForward (Window *w)
 
static CallBackFunction ToolbarScenGenLand (Window *w)
 
static CallBackFunction ToolbarScenGenTown (Window *w)
 
static CallBackFunction ToolbarScenGenIndustry (Window *w)
 
static CallBackFunction ToolbarScenBuildRoadClick (Window *w)
 
static CallBackFunction ToolbarScenBuildRoad (int index)
 Handle click on the entry in the Build Road menu. More...
 
static CallBackFunction ToolbarScenBuildTramClick (Window *w)
 
static CallBackFunction ToolbarScenBuildTram (int index)
 Handle click on the entry in the Build Tram menu. More...
 
static CallBackFunction ToolbarScenBuildDocks (Window *w)
 
static CallBackFunction ToolbarScenPlantTrees (Window *w)
 
static CallBackFunction ToolbarScenPlaceSign (Window *w)
 
static CallBackFunction ToolbarBtn_NULL (Window *w)
 
static NWidgetBaseMakeMainToolbar (int *biggest_index)
 
static NWidgetBaseMakeScenarioToolbar (int *biggest_index)
 
void AllocateToolbar ()
 Allocate the toolbar.
 

Variables

uint _toolbar_width = 0
 Width of the toolbar, shared by statusbar.
 
RailType _last_built_railtype
 
RoadType _last_built_roadtype
 
RoadType _last_built_tramtype
 
static CallBackFunction _last_started_action = CBF_NONE
 Last started user action.
 
static const int CTMN_CLIENT_LIST = -1
 Enum for the Company Toolbar's network related buttons. More...
 
static const int CTMN_NEW_COMPANY = -2
 Create a new company.
 
static const int CTMN_SPECTATE = -3
 Become spectator.
 
static const int CTMN_SPECTATOR = -4
 Show a company window as spectator.
 
static ToolbarMode _toolbar_mode
 
static MenuClickedProc *const _menu_clicked_procs []
 
static ToolbarButtonProc *const _toolbar_button_procs []
 
const uint16 _maintoolbar_pause_keys [] = {WKC_F1, WKC_PAUSE, 0}
 
const uint16 _maintoolbar_zoomin_keys [] = {WKC_NUM_PLUS, WKC_EQUALS, WKC_SHIFT | WKC_EQUALS, WKC_SHIFT | WKC_F5, 0}
 
const uint16 _maintoolbar_zoomout_keys [] = {WKC_NUM_MINUS, WKC_MINUS, WKC_SHIFT | WKC_MINUS, WKC_SHIFT | WKC_F6, 0}
 
const uint16 _maintoolbar_smallmap_keys [] = {WKC_F4, 'M', 0}
 
static Hotkey maintoolbar_hotkeys []
 
static const NWidgetPart _nested_toolbar_normal_widgets []
 
static WindowDesc _toolb_normal_desc (WDP_MANUAL, nullptr, 0, 0, WC_MAIN_TOOLBAR, WC_NONE, WDF_NO_FOCUS, _nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets), &MainToolbarWindow::hotkeys)
 
static MenuClickedProc *const _scen_toolbar_dropdown_procs []
 
static ToolbarButtonProc *const _scen_toolbar_button_procs []
 
static Hotkey scenedit_maintoolbar_hotkeys []
 
static const NWidgetPart _nested_toolb_scen_inner_widgets []
 
static const NWidgetPart _nested_toolb_scen_widgets []
 
static WindowDesc _toolb_scen_desc (WDP_MANUAL, nullptr, 0, 0, WC_MAIN_TOOLBAR, WC_NONE, WDF_NO_FOCUS, _nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets), &ScenarioEditorToolbarWindow::hotkeys)
 

Detailed Description

Code related to the (main) toolbar.

Definition in file toolbar_gui.cpp.

Function Documentation

◆ MakeMainToolbar()

static NWidgetBase* MakeMainToolbar ( int *  biggest_index)
static

Sprites to use for the different toolbar buttons

Definition at line 2213 of file toolbar_gui.cpp.

◆ MenuClickBuildAir()

static CallBackFunction MenuClickBuildAir ( int  index)
static

Handle click on the entry in the Build Air menu.

Parameters
indexUnused.
Returns
#CBF_NONE

Definition at line 975 of file toolbar_gui.cpp.

References ShowBuildAirToolbar().

◆ MenuClickBuildRail()

static CallBackFunction MenuClickBuildRail ( int  index)
static

Handle click on the entry in the Build Rail menu.

Parameters
indexRailType to show the build toolbar for.
Returns
#CBF_NONE

Definition at line 884 of file toolbar_gui.cpp.

◆ MenuClickBuildRoad()

static CallBackFunction MenuClickBuildRoad ( int  index)
static

Handle click on the entry in the Build Road menu.

Parameters
indexRoadType to show the build toolbar for.
Returns
#CBF_NONE

Definition at line 906 of file toolbar_gui.cpp.

◆ MenuClickBuildTram()

static CallBackFunction MenuClickBuildTram ( int  index)
static

Handle click on the entry in the Build Tram menu.

Parameters
indexRoadType to show the build toolbar for.
Returns
#CBF_NONE

Definition at line 928 of file toolbar_gui.cpp.

◆ MenuClickBuildWater()

static CallBackFunction MenuClickBuildWater ( int  index)
static

Handle click on the entry in the Build Waterways menu.

Parameters
indexUnused.
Returns
#CBF_NONE

Definition at line 952 of file toolbar_gui.cpp.

References ShowBuildDocksToolbar().

◆ MenuClickCompany()

static CallBackFunction MenuClickCompany ( int  index)
static

Handle click on the entry in the Company menu.

Parameters
indexMenu entry to handle.
Returns
#CBF_NONE

Definition at line 607 of file toolbar_gui.cpp.

References _networking, and CTMN_CLIENT_LIST.

◆ MenuClickFinances()

static CallBackFunction MenuClickFinances ( int  index)
static

Handle click on the entry in the finances overview menu.

Parameters
indexCompanyID to show finances for.
Returns
#CBF_NONE

Definition at line 587 of file toolbar_gui.cpp.

References ShowCompanyFinances().

◆ MenuClickForest()

static CallBackFunction MenuClickForest ( int  index)
static

Handle click on the entry in the landscaping menu.

Parameters
indexMenu entry clicked.
Returns
#CBF_NONE

Definition at line 1000 of file toolbar_gui.cpp.

References ShowTerraformToolbar().

◆ MenuClickGoal()

static CallBackFunction MenuClickGoal ( int  index)
static

Handle click on the entry in the Goal menu.

Parameters
indexCompanyID to show story book for
Returns
#CBF_NONE

Definition at line 671 of file toolbar_gui.cpp.

References CTMN_SPECTATOR, INVALID_COMPANY, and ShowGoalsList().

◆ MenuClickGraphs()

static CallBackFunction MenuClickGraphs ( int  index)
static

Handle click on the entry in the Graphs menu.

Parameters
indexGraph to show.
Returns
#CBF_NONE

Definition at line 691 of file toolbar_gui.cpp.

◆ MenuClickHelp()

static CallBackFunction MenuClickHelp ( int  index)
static

Choose the proper callback function for the main toolbar's help menu.

Parameters
indexThe menu index which was selected.
Returns
CBF_NONE

Definition at line 1125 of file toolbar_gui.cpp.

◆ MenuClickIndustry()

static CallBackFunction MenuClickIndustry ( int  index)
static

Handle click on the entry in the Industry menu.

Parameters
indexMenu entry number.
Returns
#CBF_NONE

Definition at line 746 of file toolbar_gui.cpp.

◆ MenuClickLeague()

static CallBackFunction MenuClickLeague ( int  index)
static

Handle click on the entry in the CompanyLeague menu.

Parameters
indexMenu entry number.
Returns
#CBF_NONE

Definition at line 721 of file toolbar_gui.cpp.

◆ MenuClickMap()

static CallBackFunction MenuClickMap ( int  index)
static

Handle click on one of the entries in the Map menu.

Parameters
indexIndex being clicked.
Returns
#CBF_NONE

Definition at line 493 of file toolbar_gui.cpp.

◆ MenuClickMusicWindow()

static CallBackFunction MenuClickMusicWindow ( int  index)
static

Handle click on the entry in the Music menu.

Parameters
indexUnused.
Returns
#CBF_NONE

Definition at line 1024 of file toolbar_gui.cpp.

◆ MenuClickNewspaper()

static CallBackFunction MenuClickNewspaper ( int  index)
static

Handle click on the entry in the Newspaper menu.

Parameters
indexMenu entry clicked.
Returns
#CBF_NONE

Definition at line 1044 of file toolbar_gui.cpp.

References DeleteAllMessages(), ShowLastNewsMessage(), and ShowMessageHistory().

◆ MenuClickSaveLoad()

static CallBackFunction MenuClickSaveLoad ( int  index = 0)
static

Handle click on one of the entries in the SaveLoad menu.

Parameters
indexIndex being clicked.
Returns
#CBF_NONE

Definition at line 431 of file toolbar_gui.cpp.

◆ MenuClickSettings()

static CallBackFunction MenuClickSettings ( int  index)
static

Handle click on one of the entries in the Options button menu.

Parameters
indexIndex being clicked.
Returns
#CBF_NONE

Definition at line 351 of file toolbar_gui.cpp.

◆ MenuClickShowAir()

static CallBackFunction MenuClickShowAir ( int  index)
static

Handle click on the entry in the Aircraft menu.

Parameters
indexCompanyID to show aircraft list for.
Returns
#CBF_NONE

Definition at line 841 of file toolbar_gui.cpp.

◆ MenuClickShowRoad()

static CallBackFunction MenuClickShowRoad ( int  index)
static

Handle click on the entry in the Road Vehicles menu.

Parameters
indexCompanyID to show road vehicles list for.
Returns
#CBF_NONE

Definition at line 801 of file toolbar_gui.cpp.

◆ MenuClickShowShips()

static CallBackFunction MenuClickShowShips ( int  index)
static

Handle click on the entry in the Ships menu.

Parameters
indexCompanyID to show ship list for.
Returns
#CBF_NONE

Definition at line 821 of file toolbar_gui.cpp.

◆ MenuClickShowTrains()

static CallBackFunction MenuClickShowTrains ( int  index)
static

Handle click on the entry in the Train menu.

Parameters
indexCompanyID to show train list for.
Returns
#CBF_NONE

Definition at line 781 of file toolbar_gui.cpp.

◆ MenuClickStations()

static CallBackFunction MenuClickStations ( int  index)
static

Handle click on the entry in the Stations menu.

Parameters
indexCompanyID to show station list for
Returns
#CBF_NONE

Definition at line 567 of file toolbar_gui.cpp.

References ShowCompanyStations().

◆ MenuClickStory()

static CallBackFunction MenuClickStory ( int  index)
static

Handle click on the entry in the Story menu.

Parameters
indexCompanyID to show story book for
Returns
#CBF_NONE

Definition at line 651 of file toolbar_gui.cpp.

References CTMN_SPECTATOR, INVALID_COMPANY, and ShowStoryBook().

◆ MenuClickSubsidies()

static CallBackFunction MenuClickSubsidies ( int  index)
static

Handle click on the entry in the Subsidies menu.

Parameters
indexUnused.
Returns
#CBF_NONE

Definition at line 545 of file toolbar_gui.cpp.

◆ MenuClickTown()

static CallBackFunction MenuClickTown ( int  index)
static

Handle click on one of the entries in the Town menu.

Parameters
indexIndex being clicked.
Returns
#CBF_NONE

Definition at line 520 of file toolbar_gui.cpp.

◆ PopupMainCompanyToolbMenu()

static void PopupMainCompanyToolbMenu ( Window w,
int  widget,
int  grey = 0 
)
static

◆ PopupMainToolbMenu() [1/2]

static void PopupMainToolbMenu ( Window w,
int  widget,
DropDownList &&  list,
int  def 
)
static

Pop up a generic text only menu.

Parameters
wToolbar
widgetToolbar button
listList of items
defDefault item

Definition at line 183 of file toolbar_gui.cpp.

References _settings_client, SoundSettings::click_beep, ShowDropDownList(), and ClientSettings::sound.

Referenced by PopupMainCompanyToolbMenu(), PopupMainToolbMenu(), ToolbarSaveClick(), and ToolbarScenSaveOrLoad().

◆ PopupMainToolbMenu() [2/2]

static void PopupMainToolbMenu ( Window w,
int  widget,
StringID  string,
int  count 
)
static

Pop up a generic text only menu.

Parameters
wToolbar
widgetToolbar button
stringString for the first item in the menu
countNumber of items in the menu

Definition at line 196 of file toolbar_gui.cpp.

References PopupMainToolbMenu().

◆ SetStartingYear()

void SetStartingYear ( Year  year)

◆ ToggleBoundingBoxes()

void ToggleBoundingBoxes ( )

Toggle drawing of sprites' bounding boxes.

Note
has only an effect when newgrf_developer_tools are active.

Function is found here and not in viewport.cpp in order to avoid importing the settings structs to there.

Definition at line 1080 of file toolbar_gui.cpp.

◆ ToggleDirtyBlocks()

void ToggleDirtyBlocks ( )

Toggle drawing of the dirty blocks.

Note
has only an effect when newgrf_developer_tools are active.

Function is found here and not in viewport.cpp in order to avoid importing the settings structs to there.

Definition at line 1097 of file toolbar_gui.cpp.

◆ ToolbarFastForwardClick()

static CallBackFunction ToolbarFastForwardClick ( Window w)
static

Toggle fast forward mode.

Parameters
wUnused.
Returns
#CBF_NONE

Definition at line 284 of file toolbar_gui.cpp.

◆ ToolbarOptionsClick()

static CallBackFunction ToolbarOptionsClick ( Window w)
static

Handle click on Options button in toolbar.

Parameters
wparent window the shown Drop down list is attached to.
Returns
#CBF_NONE

Definition at line 318 of file toolbar_gui.cpp.

◆ ToolbarSaveClick()

static CallBackFunction ToolbarSaveClick ( Window w)
static

Handle click on Save button in toolbar in normal game mode.

Parameters
wparent window the shown save dialogue is attached to.
Returns
#CBF_NONE

Definition at line 407 of file toolbar_gui.cpp.

References PopupMainToolbMenu(), and WID_TN_SAVE.

◆ ToolbarScenBuildRoad()

static CallBackFunction ToolbarScenBuildRoad ( int  index)
static

Handle click on the entry in the Build Road menu.

Parameters
indexRoadType to show the build toolbar for.
Returns
#CBF_NONE

Definition at line 1235 of file toolbar_gui.cpp.

◆ ToolbarScenBuildTram()

static CallBackFunction ToolbarScenBuildTram ( int  index)
static

Handle click on the entry in the Build Tram menu.

Parameters
indexRoadType to show the build toolbar for.
Returns
#CBF_NONE

Definition at line 1255 of file toolbar_gui.cpp.

◆ ToolbarScenSaveOrLoad()

static CallBackFunction ToolbarScenSaveOrLoad ( Window w)
static

Handle click on SaveLoad button in toolbar in the scenario editor.

Parameters
wparent window the shown save dialogue is attached to.
Returns
#CBF_NONE

Definition at line 419 of file toolbar_gui.cpp.

References PopupMainToolbMenu(), and WID_TE_SAVE.

Variable Documentation

◆ _nested_toolb_scen_widgets

const NWidgetPart _nested_toolb_scen_widgets[]
static
Initial value:
= {
NWidgetFunction(MakeScenarioToolbar),
}

Definition at line 2617 of file toolbar_gui.cpp.

◆ _nested_toolbar_normal_widgets

const NWidgetPart _nested_toolbar_normal_widgets[]
static
Initial value:

Definition at line 2269 of file toolbar_gui.cpp.

◆ _scen_toolbar_button_procs

ToolbarButtonProc* const _scen_toolbar_button_procs[]
static
Initial value:
= {
ToolbarPauseClick,
ToolbarBtn_NULL,
ToolbarScenDateBackward,
ToolbarScenDateForward,
ToolbarScenMapTownDir,
ToolbarZoomInClick,
ToolbarZoomOutClick,
ToolbarScenGenLand,
ToolbarScenGenTown,
ToolbarScenGenIndustry,
ToolbarScenBuildRoadClick,
ToolbarScenBuildTramClick,
ToolbarScenBuildDocks,
ToolbarScenPlantTrees,
ToolbarScenPlaceSign,
ToolbarBtn_NULL,
ToolbarMusicClick,
ToolbarHelpClick,
ToolbarSwitchClick,
}

Definition at line 2310 of file toolbar_gui.cpp.

◆ _scen_toolbar_dropdown_procs

MenuClickedProc* const _scen_toolbar_dropdown_procs[]
static
Initial value:
= {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
}

Definition at line 2284 of file toolbar_gui.cpp.

◆ CTMN_CLIENT_LIST

const int CTMN_CLIENT_LIST = -1
static

Enum for the Company Toolbar's network related buttons.

Show the client list

Definition at line 206 of file toolbar_gui.cpp.

Referenced by MenuClickCompany(), and PopupMainCompanyToolbMenu().

◆ scenedit_maintoolbar_hotkeys

Hotkey scenedit_maintoolbar_hotkeys[]
static
Initial value:
= {
Hotkey(_maintoolbar_pause_keys, "pause", MTEHK_PAUSE),
Hotkey((uint16)0, "fastforward", MTEHK_FASTFORWARD),
Hotkey(WKC_F2, "settings", MTEHK_SETTINGS),
Hotkey(WKC_F3, "saveload", MTEHK_SAVEGAME),
Hotkey(WKC_F4, "gen_land", MTEHK_GENLAND),
Hotkey(WKC_F5, "gen_town", MTEHK_GENTOWN),
Hotkey(WKC_F6, "gen_industry", MTEHK_GENINDUSTRY),
Hotkey(WKC_F7, "build_road", MTEHK_BUILD_ROAD),
Hotkey((uint16)0, "build_tram", MTEHK_BUILD_TRAM),
Hotkey(WKC_F8, "build_docks", MTEHK_BUILD_DOCKS),
Hotkey(WKC_F9, "build_trees", MTEHK_BUILD_TREES),
Hotkey(WKC_F10, "build_sign", MTEHK_SIGN),
Hotkey(WKC_F11, "music", MTEHK_MUSIC),
Hotkey(WKC_F12, "land_info", MTEHK_LANDINFO),
Hotkey(WKC_CTRL | 'S', "small_screenshot", MTEHK_SMALL_SCREENSHOT),
Hotkey(WKC_CTRL | 'P', "zoomedin_screenshot", MTEHK_ZOOMEDIN_SCREENSHOT),
Hotkey(WKC_CTRL | 'D', "defaultzoom_screenshot", MTEHK_DEFAULTZOOM_SCREENSHOT),
Hotkey((uint16)0, "giant_screenshot", MTEHK_GIANT_SCREENSHOT),
Hotkey(_maintoolbar_zoomin_keys, "zoomin", MTEHK_ZOOM_IN),
Hotkey(_maintoolbar_zoomout_keys, "zoomout", MTEHK_ZOOM_OUT),
Hotkey('L', "terraform", MTEHK_TERRAFORM),
Hotkey('M', "smallmap", MTEHK_SMALLMAP),
Hotkey('V', "extra_viewport", MTEHK_EXTRA_VIEWPORT),
HOTKEY_LIST_END
}

Definition at line 2549 of file toolbar_gui.cpp.

NWidgetFunction
static NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
Obtain a nested widget (sub)tree from an external source.
Definition: widget_type.h:1155
ToolbarFastForwardClick
static CallBackFunction ToolbarFastForwardClick(Window *w)
Toggle fast forward mode.
Definition: toolbar_gui.cpp:284
ToolbarScenSaveOrLoad
static CallBackFunction ToolbarScenSaveOrLoad(Window *w)
Handle click on SaveLoad button in toolbar in the scenario editor.
Definition: toolbar_gui.cpp:419
MenuClickMap
static CallBackFunction MenuClickMap(int index)
Handle click on one of the entries in the Map menu.
Definition: toolbar_gui.cpp:493
ToolbarScenBuildTram
static CallBackFunction ToolbarScenBuildTram(int index)
Handle click on the entry in the Build Tram menu.
Definition: toolbar_gui.cpp:1255
ToolbarOptionsClick
static CallBackFunction ToolbarOptionsClick(Window *w)
Handle click on Options button in toolbar.
Definition: toolbar_gui.cpp:318
MenuClickSaveLoad
static CallBackFunction MenuClickSaveLoad(int index=0)
Handle click on one of the entries in the SaveLoad menu.
Definition: toolbar_gui.cpp:431
ToolbarScenDatePanel
static CallBackFunction ToolbarScenDatePanel(Window *w)
Called when clicking at the date panel of the scenario editor toolbar.
Definition: toolbar_gui.cpp:1162
ToolbarScenBuildRoad
static CallBackFunction ToolbarScenBuildRoad(int index)
Handle click on the entry in the Build Road menu.
Definition: toolbar_gui.cpp:1235
MakeMainToolbar
static NWidgetBase * MakeMainToolbar(int *biggest_index)
Definition: toolbar_gui.cpp:2213
MenuClickHelp
static CallBackFunction MenuClickHelp(int index)
Choose the proper callback function for the main toolbar's help menu.
Definition: toolbar_gui.cpp:1125
MenuClickSettings
static CallBackFunction MenuClickSettings(int index)
Handle click on one of the entries in the Options button menu.
Definition: toolbar_gui.cpp:351
MenuClickMusicWindow
static CallBackFunction MenuClickMusicWindow(int index)
Handle click on the entry in the Music menu.
Definition: toolbar_gui.cpp:1024
Hotkey
All data for a single hotkey.
Definition: hotkeys.h:22