SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GUIParameterTableWindow.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // The window that holds the table of an object's parameter
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2002-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef GUIParameterTableWindow_h
23 #define GUIParameterTableWindow_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <string>
37 #include <algorithm>
38 #include <functional>
39 #include <fx.h>
42 #include <utils/common/SUMOTime.h>
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class GUIGlObject;
49 class GUIMainWindow;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
70  FXDECLARE(GUIParameterTableWindow)
71 public:
79  GUIGlObject& o, size_t noRows);
80 
81 
84 
85 
94  void closeBuilding();
95 
96 
97 
101  void removeObject(GUIGlObject* const o);
102 
103 
104 
107 
114  void mkItem(const char* name, bool dynamic, ValueSource<unsigned>* src);
115 
122  void mkItem(const char* name, bool dynamic, ValueSource<int>* src);
123 
124 
131  void mkItem(const char* name, bool dynamic, ValueSource<SUMOReal>* src);
132 
133 
141  void mkItem(const char* name, bool dynamic, std::string value);
142 
143 
151  void mkItem(const char* name, bool dynamic, unsigned value);
152 
153 
161  void mkItem(const char* name, bool dynamic, int value);
162 
163 
171  void mkItem(const char* name, bool dynamic, SUMOReal value);
172 
173 
175 
176 
177 
180 
182  long onSimStep(FXObject*, FXSelector, void*);
183 
187  long onTableSelected(FXObject*, FXSelector, void*);
188 
192  long onTableDeselected(FXObject*, FXSelector, void*);
193 
203  long onRightButtonPress(FXObject*, FXSelector, void*);
205 
208  static void updateAll() {
210  std::for_each(myContainer.begin(), myContainer.end(), std::mem_fun(&GUIParameterTableWindow::updateTable));
211  }
212 
213 protected:
220  void updateTable();
221 
224 
226  static std::vector<GUIParameterTableWindow*> myContainer;
227 
228 private:
231 
234 
237 
239  std::vector<GUIParameterTableItemInterface*> myItems;
240 
242  unsigned myCurrentPos;
243 
245  mutable MFXMutex myLock;
246 
247 protected:
250 
251 };
252 
253 
254 #endif
255 
256 /****************************************************************************/
257 
void removeObject(GUIGlObject *const o)
Lets this window know the object shown is being deleted.
unsigned myCurrentPos
The index of the next row to add - used while building.
FXTable * myTable
The table to display the information in.
GUIMainWindow * myApplication
The main application window.
void updateTable()
Updates the table.
static MFXMutex myGlobalContainerLock
The mutex used to avoid concurrent updates of the instance container.
Interface to a single line in a parameter window.
static std::vector< GUIParameterTableWindow * > myContainer
The container of items that shall be updated.
long onRightButtonPress(FXObject *, FXSelector, void *)
Shows a popup.
long onSimStep(FXObject *, FXSelector, void *)
Updates the table due to a simulation step.
long onTableDeselected(FXObject *, FXSelector, void *)
Does nothing.
GUIParameterTableWindow()
FOX needs this.
MFXMutex myLock
A lock assuring save updates in case of object deletion.
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
GUIGlObject * myObject
The object to get the information from.
static void updateAll()
Updates all instances.
#define SUMOReal
Definition: config.h:218
long onTableSelected(FXObject *, FXSelector, void *)
Does nothing.
std::vector< GUIParameterTableItemInterface * > myItems
The list of table rows.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
void closeBuilding()
Closes the building of the table.
A window containing a gl-object's parameter.