# toolbar_gui.cpp File Reference

Code related to the (main) toolbar. More...

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "gui.h"`
`#include "window_gui.h"`
`#include "window_func.h"`
`#include "viewport_func.h"`
`#include "command_func.h"`
`#include "variables.h"`
`#include "vehicle_gui.h"`
`#include "rail_gui.h"`
`#include "road_gui.h"`
`#include "date_func.h"`
`#include "vehicle_func.h"`
`#include "sound_func.h"`
`#include "terraform_gui.h"`
`#include "transparency.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 "functions.h"`
`#include "console_gui.h"`
`#include "news_gui.h"`
`#include "ai/ai_gui.hpp"`
`#include "tilehighlight_func.h"`
`#include "rail.h"`
`#include "widgets/dropdown_type.h"`
`#include "settings_type.h"`
`#include "newgrf_config.h"`
`#include "network/network.h"`
`#include "network/network_gui.h"`
`#include "network/network_func.h"`
`#include "table/strings.h"`
`#include "table/sprites.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...
struct | MainToolbarWindow
struct | ScenarioEditorToolbarWindow
## Typedefs
typedef void | MenuClickedProc (int index)
typedef void | ToolbarButtonProc (Window *w)
## Enumerations
enum | ToolBarProperties { TBP_BUTTONWIDTH = 22, TBP_BUTTONHEIGHT = 22, TBP_DATEPANELWIDTH = 130, TBP_TOOLBAR_MINBUTTON = 14, TBP_NORMAL_MAXBUTTON = 19, TBP_SCENARIO_MAXBUTTON = 16 }
| This enum gathers properties of both toolbars. More...
enum | ToolbarMode { TB_NORMAL, TB_UPPER, TB_LOWER }
enum | ToolbarNormalWidgets { TBN_PAUSE = 0, TBN_FASTFORWARD, TBN_SETTINGS, TBN_SAVEGAME, TBN_SMALLMAP, TBN_TOWNDIRECTORY, TBN_SUBSIDIES, TBN_STATIONS, TBN_FINANCES, TBN_COMPANIES, TBN_GRAPHICS, TBN_LEAGUE, TBN_INDUSTRIES, TBN_VEHICLESTART, TBN_TRAINS = TBN_VEHICLESTART, TBN_ROADVEHS, TBN_SHIPS, TBN_AIRCRAFTS, TBN_ZOOMIN, TBN_ZOOMOUT, TBN_RAILS, TBN_ROADS, TBN_WATER, TBN_AIR, TBN_LANDSCAPE, TBN_MUSICSOUND, TBN_NEWSREPORT, TBN_HELP, TBN_SWITCHBAR }
enum | ToolbarScenEditorWidgets { TBSE_PAUSE = 0, TBSE_FASTFORWARD, TBSE_SAVESCENARIO = 3, TBSE_SPACERPANEL, TBSE_DATEPANEL, TBSE_DATEBACKWARD, TBSE_DATEFORWARD, TBSE_SMALLMAP, TBSE_ZOOMIN, TBSE_ZOOMOUT, TBSE_LANDGENERATE, TBSE_TOWNGENERATE, TBSE_INDUSTRYGENERATE, TBSE_BUILDROAD, TBSE_BUILDDOCKS, TBSE_PLANTTREES, TBSE_PLACESIGNS }
enum | { CTMN_CLIENT_LIST = -1, CTMN_NEW_COMPANY = -2, CTMN_SPECTATE = -3 }
| Enum for the Company Toolbar's network related buttons. More...
enum | OptionMenuEntries { OME_GAMEOPTIONS, OME_DIFFICULTIES, OME_SETTINGS, OME_NEWGRFSETTINGS, OME_TRANSPARENCIES, OME_SHOW_TOWNNAMES, OME_SHOW_STATIONNAMES, OME_SHOW_SIGNS, OME_SHOW_WAYPOINTNAMES, OME_FULL_ANIMATION, OME_FULL_DETAILS, OME_TRANSPARENTBUILDINGS, OME_SHOW_STATIONSIGNS }
enum | SaveLoadEditorMenuEntries { SLEME_SAVE_SCENARIO = 0, SLEME_LOAD_SCENARIO, SLEME_LOAD_HEIGHTMAP, SLEME_EXIT_TOINTRO, SLEME_EXIT_GAME = 5, SLEME_MENUCOUNT }
enum | SaveLoadNormalMenuEntries { SLNME_SAVE_GAME = 0, SLNME_LOAD_GAME, SLNME_EXIT_TOINTRO, SLNME_EXIT_GAME, SLNME_MENUCOUNT }
enum | MapMenuEntries { MME_SHOW_SMALLMAP = 0, MME_SHOW_EXTRAVIEWPORTS, MME_SHOW_SIGNLISTS, MME_SHOW_TOWNDIRECTORY, MME_MENUCOUNT_NORMAL = 3, MME_MENUCOUNT_EDITOR = 4 }
## Functions
static void | SplitToolbar (Window *w)
static void | PopupMainToolbMenu (Window *w, int widget, StringID string, int count)
| Pop up a generic text only menu.
static void | PopupMainCompanyToolbMenu (Window *w, int widget, int grey=0)
| Pop up a generic company list menu.
static void | SelectSignTool ()
static void | ToolbarPauseClick (Window *w)
static void | ToolbarFastForwardClick (Window *w)
static void | ToolbarOptionsClick (Window *w)
static void | MenuClickSettings (int index)
static void | ToolbarSaveClick (Window *w)
static void | ToolbarScenSaveOrLoad (Window *w)
static void | MenuClickSaveLoad (int index=0)
static void | ToolbarMapClick (Window *w)
static void | ToolbarScenMapTownDir (Window *w)
static void | MenuClickMap (int index)
static void | ToolbarTownClick (Window *w)
static void | MenuClickTown (int index)
static void | ToolbarSubsidiesClick (Window *w)
static void | MenuClickSubsidies (int index)
static void | ToolbarStationsClick (Window *w)
static void | MenuClickStations (int index)
static void | ToolbarFinancesClick (Window *w)
static void | MenuClickFinances (int index)
static void | ToolbarCompaniesClick (Window *w)
static void | MenuClickCompany (int index)
static void | ToolbarGraphsClick (Window *w)
static void | MenuClickGraphs (int index)
static void | ToolbarLeagueClick (Window *w)
static void | MenuClickLeague (int index)
static void | ToolbarIndustryClick (Window *w)
static void | MenuClickIndustry (int index)
static void | ToolbarVehicleClick (Window *w, VehicleType veh)
static void | ToolbarTrainClick (Window *w)
static void | MenuClickShowTrains (int index)
static void | ToolbarRoadClick (Window *w)
static void | MenuClickShowRoad (int index)
static void | ToolbarShipClick (Window *w)
static void | MenuClickShowShips (int index)
static void | ToolbarAirClick (Window *w)
static void | MenuClickShowAir (int index)
static void | ToolbarZoomInClick (Window *w)
static void | ToolbarZoomOutClick (Window *w)
static void | ToolbarBuildRailClick (Window *w)
static void | MenuClickBuildRail (int index)
static void | ToolbarBuildRoadClick (Window *w)
static void | MenuClickBuildRoad (int index)
static void | ToolbarBuildWaterClick (Window *w)
static void | MenuClickBuildWater (int index)
static void | ToolbarBuildAirClick (Window *w)
static void | MenuClickBuildAir (int index)
static void | ToolbarForestClick (Window *w)
static void | MenuClickForest (int index)
static void | ToolbarMusicClick (Window *w)
static void | MenuClickMusicWindow (int index)
static void | ToolbarNewspaperClick (Window *w)
static void | MenuClickNewspaper (int index)
static void | ToolbarHelpClick (Window *w)
static void | MenuClickSmallScreenshot ()
static void | MenuClickWorldScreenshot ()
static void | MenuClickHelp (int index)
static void | ToolbarSwitchClick (Window *w)
static void | ToolbarScenDateBackward (Window *w)
static void | ToolbarScenDateForward (Window *w)
static void | ToolbarScenGenLand (Window *w)
static void | ToolbarScenGenTown (Window *w)
static void | ToolbarScenGenIndustry (Window *w)
static void | ToolbarScenBuildRoad (Window *w)
static void | ToolbarScenBuildDocks (Window *w)
static void | ToolbarScenPlantTrees (Window *w)
static void | ToolbarScenPlaceSign (Window *w)
static void | ToolbarBtn_NULL (Window *w)
static void | ResizeToolbar (Window *w)
void | AllocateToolbar ()
## Variables
RailType | _last_built_railtype
RoadType | _last_built_roadtype
static ToolbarMode | _toolbar_mode
static MenuClickedProc *const | _menu_clicked_procs []
static ToolbarButtonProc *const | _toolbar_button_procs []
static const Widget | _toolb_normal_widgets []
static const WindowDesc | _toolb_normal_desc (0, 0, 0, TBP_BUTTONHEIGHT, 640, TBP_BUTTONHEIGHT, WC_MAIN_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS|WDF_DEF_WIDGET|WDF_NO_FOCUS, _toolb_normal_widgets)
static ToolbarButtonProc *const | _scen_toolbar_button_procs []
static const Widget | _toolb_scen_widgets []
static const WindowDesc | _toolb_scen_desc (0, 0, 130, TBP_BUTTONHEIGHT, 640, TBP_BUTTONHEIGHT, WC_MAIN_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS|WDF_NO_FOCUS, _toolb_scen_widgets)

## Detailed Description

Code related to the (main) toolbar.

Definition in file toolbar_gui.cpp.

## Enumeration Type Documentation

anonymous enum

Enum for the Company Toolbar's network related buttons.

Enumerator:

  CTMN_CLIENT_LIST | Show the client list.
  CTMN_NEW_COMPANY | Create a new company.
  CTMN_SPECTATE | Become spectator.

Definition at line 202 of file toolbar_gui.cpp.

enum MapMenuEntries

Enumerator:

  MME_SHOW_TOWNDIRECTORY | This entry is only used in Editor mode.

Definition at line 379 of file toolbar_gui.cpp.

enum ToolbarNormalWidgets

Enumerator:

  TBN_VEHICLESTART | trains, actually. So following are trucks, boats and planes
  TBN_SWITCHBAR | only available when toolbar has been split

Definition at line 69 of file toolbar_gui.cpp.

enum ToolBarProperties

This enum gathers properties of both toolbars.

Enumerator:

  TBP_BUTTONWIDTH | width of a button
  TBP_BUTTONHEIGHT | height of a button as well as the toolbars
  TBP_DATEPANELWIDTH | used in scenario editor to calculate width of the toolbar.
  TBP_TOOLBAR_MINBUTTON | references both toolbars
  TBP_NORMAL_MAXBUTTON | normal toolbar has this many buttons
  TBP_SCENARIO_MAXBUTTON | while the scenario has these

Definition at line 53 of file toolbar_gui.cpp.

## Variable Documentation

MenuClickedProc* const _menu_clicked_procs[]`[static]`

Initial value:

     {
      NULL,
      NULL,
      MenuClickSettings,
      MenuClickSaveLoad,
      MenuClickMap,
      MenuClickTown,
      MenuClickSubsidies,
      MenuClickStations,
      MenuClickFinances,
      MenuClickCompany,
      MenuClickGraphs,
      MenuClickLeague,
      MenuClickIndustry,
      MenuClickShowTrains,
      MenuClickShowRoad,
      MenuClickShowShips,
      MenuClickShowAir,
      MenuClickMap,
      NULL,
      MenuClickBuildRail,
      MenuClickBuildRoad,
      MenuClickBuildWater,
      MenuClickBuildAir,
      MenuClickForest,
      MenuClickMusicWindow,
      MenuClickNewspaper,
      MenuClickHelp,
    }

Definition at line 954 of file toolbar_gui.cpp.

ToolbarButtonProc* const _scen_toolbar_button_procs[]`[static]`

Initial value:

     {
      ToolbarPauseClick,
      ToolbarFastForwardClick,
      ToolbarOptionsClick,
      ToolbarScenSaveOrLoad,
      ToolbarBtn_NULL,
      ToolbarBtn_NULL,
      ToolbarScenDateBackward,
      ToolbarScenDateForward,
      ToolbarScenMapTownDir,
      ToolbarZoomInClick,
      ToolbarZoomOutClick,
      ToolbarScenGenLand,
      ToolbarScenGenTown,
      ToolbarScenGenIndustry,
      ToolbarScenBuildRoad,
      ToolbarScenBuildDocks,
      ToolbarScenPlantTrees,
      ToolbarScenPlaceSign,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      ToolbarMusicClick,
      NULL,
      ToolbarHelpClick,
    }

Definition at line 1197 of file toolbar_gui.cpp.

ToolbarButtonProc* const _toolbar_button_procs[]`[static]`

Initial value:

     {
      ToolbarPauseClick,
      ToolbarFastForwardClick,
      ToolbarOptionsClick,
      ToolbarSaveClick,
      ToolbarMapClick,
      ToolbarTownClick,
      ToolbarSubsidiesClick,
      ToolbarStationsClick,
      ToolbarFinancesClick,
      ToolbarCompaniesClick,
      ToolbarGraphsClick,
      ToolbarLeagueClick,
      ToolbarIndustryClick,
      ToolbarTrainClick,
      ToolbarRoadClick,
      ToolbarShipClick,
      ToolbarAirClick,
      ToolbarZoomInClick,
      ToolbarZoomOutClick,
      ToolbarBuildRailClick,
      ToolbarBuildRoadClick,
      ToolbarBuildWaterClick,
      ToolbarBuildAirClick,
      ToolbarForestClick,
      ToolbarMusicClick,
      ToolbarNewspaperClick,
      ToolbarHelpClick,
      ToolbarSwitchClick,
    }

Definition at line 988 of file toolbar_gui.cpp.