GUIGlObject.cpp

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Base class for all objects that may be displayed within the openGL-gui
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 <string>
00031 #include <stack>
00032 #include <utils/common/ToString.h>
00033 #include <utils/gui/windows/GUISUMOAbstractView.h>
00034 #include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
00035 #include "GUIGlObject.h"
00036 #include "GUIGlObjectStorage.h"
00037 #include <utils/foxtools/MFXMenuHeader.h>
00038 #include <utils/gui/images/GUIIconSubSys.h>
00039 #include <utils/gui/windows/GUIAppEnum.h>
00040 #include <gui/GUIApplicationWindow.h>
00041 #include <utils/gui/div/GUIGlobalSelection.h>
00042 
00043 #ifdef CHECK_MEMORY_LEAKS
00044 #include <foreign/nvwa/debug_new.h>
00045 #endif // CHECK_MEMORY_LEAKS
00046 
00047 
00048 // ===========================================================================
00049 // method definitions
00050 // ===========================================================================
00051 GUIGlObject::GUIGlObject(GUIGlObjectStorage &idStorage,
00052                          std::string fullName) throw()
00053         : myFullName(fullName) {
00054     idStorage.registerObject(this);
00055 }
00056 
00057 
00058 GUIGlObject::GUIGlObject(std::string fullName, GLuint glID) throw()
00059         : myFullName(fullName) {
00060 }
00061 
00062 
00063 
00064 GUIGlObject::~GUIGlObject() throw() {}
00065 
00066 
00067 void
00068 GUIGlObject::setGlID(GLuint id) throw() {
00069     myGlID = id;
00070 }
00071 
00072 
00073 
00074 void
00075 GUIGlObject::buildPopupHeader(GUIGLObjectPopupMenu *ret,
00076                               GUIMainWindow &app,
00077                               bool addSeparator) throw() {
00078     new MFXMenuHeader(ret, app.getBoldFont(), getFullName().c_str(), 0, 0, 0);
00079     if (addSeparator) {
00080         new FXMenuSeparator(ret);
00081     }
00082 }
00083 
00084 
00085 void
00086 GUIGlObject::buildCenterPopupEntry(GUIGLObjectPopupMenu *ret,
00087                                    bool addSeparator) throw() {
00088     new FXMenuCommand(ret, "Center", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), ret, MID_CENTER);
00089     if (addSeparator) {
00090         new FXMenuSeparator(ret);
00091     }
00092 }
00093 
00094 
00095 void
00096 GUIGlObject::buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret,
00097                                      bool addSeparator) throw() {
00098     new FXMenuCommand(ret, "Copy name to clipboard", 0, ret, MID_COPY_NAME);
00099     new FXMenuCommand(ret, "Copy typed name to clipboard", 0, ret, MID_COPY_TYPED_NAME);
00100     if (addSeparator) {
00101         new FXMenuSeparator(ret);
00102     }
00103 }
00104 
00105 
00106 void
00107 GUIGlObject::buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret,
00108                                       bool addSeparator) throw() {
00109     if (gSelected.isSelected(getType(), getGlID())) {
00110         new FXMenuCommand(ret, "Remove From Selected", GUIIconSubSys::getIcon(ICON_FLAG_MINUS), ret, MID_REMOVESELECT);
00111     } else {
00112         new FXMenuCommand(ret, "Add To Selected", GUIIconSubSys::getIcon(ICON_FLAG_PLUS), ret, MID_ADDSELECT);
00113     }
00114     if (addSeparator) {
00115         new FXMenuSeparator(ret);
00116     }
00117 }
00118 
00119 
00120 void
00121 GUIGlObject::buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret,
00122                                        bool addSeparator) throw() {
00123     new FXMenuCommand(ret, "Show Parameter", GUIIconSubSys::getIcon(ICON_APP_TABLE), ret, MID_SHOWPARS);
00124     if (addSeparator) {
00125         new FXMenuSeparator(ret);
00126     }
00127 }
00128 
00129 
00130 void
00131 GUIGlObject::buildPositionCopyEntry(GUIGLObjectPopupMenu *ret,
00132                                     bool addSeparator) throw() {
00133     new FXMenuCommand(ret, "Copy cursor position to clipboard", 0, ret, MID_COPY_CURSOR_POSITION);
00134     if (addSeparator) {
00135         new FXMenuSeparator(ret);
00136     }
00137 }
00138 
00139 
00140 void
00141 GUIGlObject::buildShowManipulatorPopupEntry(GUIGLObjectPopupMenu *ret,
00142         bool addSeparator) throw() {
00143     new FXMenuCommand(ret, "Open Manipulator...",
00144                       GUIIconSubSys::getIcon(ICON_MANIP), ret, MID_MANIP);
00145     if (addSeparator) {
00146         new FXMenuSeparator(ret);
00147     }
00148 }
00149 
00150 
00151 
00152 /****************************************************************************/
00153 

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