SUMO - Simulation of Urban MObility
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-2016 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 // ===========================================================================
69 class GUIParameterTableWindow : public FXMainWindow {
70  FXDECLARE(GUIParameterTableWindow)
71 public:
79  GUIGlObject& o, int 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, long long int value);
172 
173 
181  void mkItem(const char* name, bool dynamic, SUMOReal value);
182 
183 
185 
186 
187 
190 
192  long onSimStep(FXObject*, FXSelector, void*);
193 
197  long onTableSelected(FXObject*, FXSelector, void*);
198 
202  long onTableDeselected(FXObject*, FXSelector, void*);
203 
213  long onRightButtonPress(FXObject*, FXSelector, void*);
215 
218  static void updateAll() {
220  std::for_each(myContainer.begin(), myContainer.end(), std::mem_fun(&GUIParameterTableWindow::updateTable));
221  }
222 
223 protected:
230  void updateTable();
231 
234 
236  static std::vector<GUIParameterTableWindow*> myContainer;
237 
238 private:
241 
243  FXTable* myTable;
244 
247 
249  std::vector<GUIParameterTableItemInterface*> myItems;
250 
252  unsigned myCurrentPos;
253 
255  mutable MFXMutex myLock;
256 
257 protected:
260 
261 };
262 
263 
264 #endif
265 
266 /****************************************************************************/
267 
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:213
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&#39;s parameter.