GUIParam_PopupMenu.cpp

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

Generated on Wed May 5 00:06:30 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6