/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GUIMainWindow.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Fri, 29.04.200518///19//20/****************************************************************************/21#pragma once22#include <config.h>2324#include <utils/foxtools/fxheader.h>25#include <vector>26#include <string>27#include <map>28#include <utils/common/StdDefs.h>29#include <utils/common/SUMOTime.h>30#include "GUIAppEnum.h"313233// ===========================================================================34// class declarations35// ===========================================================================36class GUIEvent;37class GUIGlChildWindow;38class GUISUMOAbstractView;39class MFXStaticToolTip;404142// ===========================================================================43// class definitions44// ===========================================================================45class GUIMainWindow : public FXMainWindow {4647public:48/// @brief constructor49GUIMainWindow(FXApp* app);5051/// @brief destructor52virtual ~GUIMainWindow();5354/// @brief Adds a further child window to the list (GUIGlChildWindow)55void addGLChild(GUIGlChildWindow* child);5657/// @brief Adds a further child window to the list (FXMainWindow)58void addChild(FXMainWindow* child);5960/// @brief removes the given child window from the list (GUIGlChildWindow)61void removeGLChild(GUIGlChildWindow* child);6263/// @brief removes the given child window from the list (FXMainWindow)64void removeChild(FXMainWindow* child);6566/// @brief get top dock67FXDockSite* getTopDock();6869/// @brief get view IDs70std::vector<std::string> getViewIDs() const;7172/// @brief get specific view by ID73GUIGlChildWindow* getViewByID(const std::string& id) const;7475void removeViewByID(const std::string& id);7677/// @brief get views78const std::vector<GUIGlChildWindow*>& getViews() const;7980/// @brief update childrens81void updateChildren(int msg = MID_SIMSTEP);8283/// @brief get bold front84FXFont* getBoldFont();8586/// @brief get fallback front87FXFont* getFallbackFont();8889/// @brief get GL Visual90FXGLVisual* getGLVisual() const;9192/// @brief get static toolTip for menus93MFXStaticToolTip* getStaticTooltipMenu() const;9495/// @brief get static toolTip for view96MFXStaticToolTip* getStaticTooltipView() const;9798/// @brief get build GL Canvas (must be implemented in all children)99virtual FXGLCanvas* getBuildGLCanvas() const = 0;100101/// @brief get current sim time (must be implemented in all children)102virtual SUMOTime getCurrentSimTime() const = 0;103104/// @brief get tracker interval (must be implemented in all children)105virtual double getTrackerInterval() const = 0;106107/// @brief get status bar text (can be implemented in children)108virtual void setStatusBarText(const std::string&) { }109110/// @brief get cartesian label111FXLabel* getCartesianLabel();112113/// @brief get geo label114FXLabel* getGeoLabel();115116/// @brief get test label117FXLabel* getTestLabel();118119/// @brief get test frame120FXHorizontalFrame* getTestFrame();121122/// @brief return whether the gui is in gaming mode123bool isGaming() const;124125/// @brief return whether to list internal structures126bool listInternal() const;127128/// @brief return whether to list parking vehicles129bool listParking() const;130131/// @brief return whether to list teleporting vehicles132bool listTeleporting() const;133134/// @brief get instance135static GUIMainWindow* getInstance();136137/** @brief Returns the delay (should be overwritten by subclasses if applicable)138* @return parsed delay in milliseconds139*/140virtual double getDelay() const {141return 0.;142}143144/// @brief Sets the delay of the parent application145virtual void setDelay(double) {}146147/// @brief Sets the breakpoints of the parent application148virtual void setBreakpoints(const std::vector<SUMOTime>&) {}149150/** @brief Sends an event from the application thread to the GUI and waits until it is handled151* @param event the event to send152*/153virtual void sendBlockingEvent(GUIEvent* event) {154UNUSED_PARAMETER(event);155}156157/// @brief get the active view or 0158GUISUMOAbstractView* getActiveView() const;159160/// @brief Toggle full screen mode161virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {162return 1;163}164165bool isFullScreen() {166return myAmFullScreen;167}168169const std::map<std::string, std::string>& getOnlineMaps() const {170return myOnlineMaps;171}172173void addOnlineMap(const std::string& name, const std::string& url) {174myOnlineMaps[name] = url;175}176177/// @brief add breakpoint to the application178virtual void addBreakpoint(SUMOTime /* time */) {}179180/// @brief retrieve breakpoints if provided by the application181virtual const std::vector<SUMOTime> retrieveBreakpoints() const {182return std::vector<SUMOTime>();183}184185// @brief called when changes language186long onCmdChangeLanguage(FXObject*, FXSelector, void*);187188// @brief called when language is updated189long onUpdChangeLanguage(FXObject*, FXSelector, void*);190191protected:192/// @brief FOX need this193FOX_CONSTRUCTOR(GUIMainWindow)194195/// @brief whether to show the window in full screen mode196bool myAmFullScreen;197198/// @brief list of GLWindows199std::vector<GUIGlChildWindow*> myGLWindows;200201/// @brief list of tracker windows202std::vector<FXMainWindow*> myTrackerWindows;203204/// @brief A lock to make the removal and addition of trackers secure205FXMutex myTrackerLock;206207/// @brief Font used for popup-menu titles208FXFont* myBoldFont = nullptr;209210/// @brief Fallback font for extended characters support211FXFont* myFallbackFont = nullptr;212213/// @brief The multi view panel214FXMDIClient* myMDIClient = nullptr;215216/// @brief The status bar217FXStatusBar* myStatusbar = nullptr;218219/// @brief Labels for the current cartesian, geo-coordinate and test coordinates220FXLabel* myCartesianCoordinate = nullptr;221FXLabel* myGeoCoordinate = nullptr;222FXLabel* myTestCoordinate = nullptr;223224/// @brief frames for coordinates225FXHorizontalFrame* myTraCiFrame = nullptr;226FXHorizontalFrame* myCartesianFrame = nullptr;227FXHorizontalFrame* myGeoFrame = nullptr;228FXHorizontalFrame* myTestFrame = nullptr;229230/// @brief The gl-visual used231FXGLVisual* myGLVisual = nullptr;232233/// @brief dock sites234FXDockSite* myTopDock = nullptr;235FXDockSite* myBottomDock = nullptr;236FXDockSite* myLeftDock = nullptr;237FXDockSite* myRightDock = nullptr;238239/// @brief Language menu common to all applications240FXMenuPane* myLanguageMenu = nullptr;241242/// @brief static toolTip used in menus243MFXStaticToolTip* myStaticTooltipMenu = nullptr;244245/// @brief static toolTip used in view246MFXStaticToolTip* myStaticTooltipView = nullptr;247248/// @brief information whether the gui is currently in gaming mode249bool myAmGaming;250251/// @brief information whether the locator should list internal structures252bool myListInternal;253254/// @brief information whether the locator should list parking vehicles255bool myListParking;256257/// @brief information whether the locator should list teleporting vehicles258bool myListTeleporting;259260/// @brief online mapping services for the context menu261std::map<std::string, std::string> myOnlineMaps;262263/// @brief the singleton window instance264static GUIMainWindow* myInstance;265266/// @brief perform initial window positioning and sizing according to user options / previous call267void setWindowSizeAndPos();268269/// @brief record window position and size in registry270void storeWindowSizeAndPos();271272void buildLanguageMenu(FXMenuBar* menuBar);273274};275276277