SUMO - Simulation of Urban MObility
GUIParam_PopupMenu.cpp
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // A popup-menu for dynamic patameter table entries
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00012 /****************************************************************************/
00013 //
00014 //   This file is part of SUMO.
00015 //   SUMO is free software: you can redistribute it and/or modify
00016 //   it under the terms of the GNU General Public License as published by
00017 //   the Free Software Foundation, either version 3 of the License, or
00018 //   (at your option) any later version.
00019 //
00020 /****************************************************************************/
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <iostream>
00033 #include <string>
00034 #include "GUIParameterTableWindow.h"
00035 #include <utils/gui/globjects/GUIGlObject.h>
00036 #include "GUIParam_PopupMenu.h"
00037 #include <utils/gui/tracker/GUIParameterTracker.h>
00038 #include <utils/gui/tracker/TrackerValueDesc.h>
00039 #include <utils/gui/windows/GUIAppEnum.h>
00040 #include <utils/gui/windows/GUIMainWindow.h>
00041 
00042 #ifdef CHECK_MEMORY_LEAKS
00043 #include <foreign/nvwa/debug_new.h>
00044 #endif // CHECK_MEMORY_LEAKS
00045 
00046 
00047 // ===========================================================================
00048 // FOX callback mapping
00049 // ===========================================================================
00050 FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[] = {
00051     FXMAPFUNC(SEL_COMMAND,  MID_OPENTRACKER, GUIParam_PopupMenuInterface::onCmdOpenTracker),
00052 };
00053 
00054 // Object implementation
00055 FXIMPLEMENT(GUIParam_PopupMenuInterface, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))
00056 
00057 
00058 // ===========================================================================
00059 // method definitions
00060 // ===========================================================================
00061 GUIParam_PopupMenuInterface::GUIParam_PopupMenuInterface(GUIMainWindow& app,
00062         GUIParameterTableWindow& parentWindow, GUIGlObject& o, const std::string& varName,
00063         ValueSource<SUMOReal> *src)
00064     : FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow),
00065       myApplication(&app), myVarName(varName), mySource(src) {
00066 }
00067 
00068 
00069 GUIParam_PopupMenuInterface::~GUIParam_PopupMenuInterface() {
00070     delete mySource;
00071 }
00072 
00073 
00074 long
00075 GUIParam_PopupMenuInterface::onCmdOpenTracker(FXObject*, FXSelector, void*) {
00076     std::string trackerName = myVarName + " from " + myObject->getFullName();
00077     GUIParameterTracker* tr = new GUIParameterTracker(*myApplication, trackerName);
00078     TrackerValueDesc* newTracked = new TrackerValueDesc(myVarName, RGBColor(0, 0, 0), myApplication->getCurrentSimTime());
00079     tr->addTracked(*myObject, mySource->copy(), newTracked);
00080     tr->create();
00081     tr->show();
00082     return 1;
00083 }
00084 
00085 
00086 /****************************************************************************/
00087 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines