# toolbar_gui.cpp File Reference

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

`#include "stdafx.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 "company_base.h"`
`#include "smallmap_gui.h"`
`#include "graph_gui.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...
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
struct | ScenarioEditorToolbarWindow

## Typedefs

typedef void | MenuClickedProc (int index)
typedef void | ToolbarButtonProc (Window *w)

## Enumerations

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, TBN_END
}

enum | ToolbarScenEditorWidgets { TBSE_PAUSE = 0, TBSE_FASTFORWARD, TBSE_SETTINGS, TBSE_SAVESCENARIO, 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, TBSE_DATEPANEL_CONTAINER }
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_WAYPOINTNAMES, OME_SHOW_SIGNS, 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 | 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 NWidgetBase * | MakeMainToolbar (int *biggest_index)
static NWidgetBase * | MakeScenarioToolbar (int *biggest_index)
void | AllocateToolbar ()

## Variables

RailType | _last_built_railtype
static RoadType | _last_built_roadtype
static ToolbarMode | _toolbar_mode
static MenuClickedProc *const | _menu_clicked_procs []
static ToolbarButtonProc *const | _toolbar_button_procs []
static const NWidgetPart | _nested_toolbar_normal_widgets []
static const WindowDesc | _toolb_normal_desc (WDP_MANUAL, 640, 22, WC_MAIN_TOOLBAR, WC_NONE, WDF_NO_FOCUS, _nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets))
static ToolbarButtonProc *const | _scen_toolbar_button_procs []
static const NWidgetPart | _nested_toolb_scen_inner_widgets []
static const NWidgetPart | _nested_toolb_scen_widgets []
static const WindowDesc | _toolb_scen_desc (WDP_MANUAL, 640, 22, WC_MAIN_TOOLBAR, WC_NONE, WDF_UNCLICK_BUTTONS|WDF_NO_FOCUS, _nested_toolb_scen_widgets, lengthof(_nested_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 212 of file toolbar_gui.cpp.

enum MapMenuEntries

Enumerator:

  MME_SHOW_TOWNDIRECTORY | This entry is only used in Editor mode.

Definition at line 389 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
  TBN_END | The end marker.

Definition at line 63 of file toolbar_gui.cpp.

## Function Documentation

static NWidgetBase* MakeMainToolbar | ( | int * | biggest_index | ) | `[static]`

Sprites to use for the different toolbar buttons

Definition at line 1335 of file toolbar_gui.cpp.

References NWidgetContainer::Add(), TBN_END, TBN_SWITCHBAR, WWT_IMGBTN, and WWT_IMGBTN_2.

## 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 886 of file toolbar_gui.cpp.

const NWidgetPart _nested_toolb_scen_widgets[]`[static]`

Initial value:

     {
      NWidgetFunction(MakeScenarioToolbar),
    }

Definition at line 1604 of file toolbar_gui.cpp.

const NWidgetPart _nested_toolbar_normal_widgets[]`[static]`

Initial value:

     {
      NWidgetFunction(MakeMainToolbar),
    }

Definition at line 1381 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,
      ToolbarBtn_NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      ToolbarMusicClick,
      NULL,
      ToolbarHelpClick,
      ToolbarSwitchClick,
    }

Definition at line 1395 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 1185 of file toolbar_gui.cpp.