SUMO - Simulation of Urban MObility
GUIParameterTableWindow.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // The window that holds the table of an object's parameter
20 /****************************************************************************/
21 #ifndef GUIParameterTableWindow_h
22 #define GUIParameterTableWindow_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <string>
36 #include <algorithm>
37 #include <functional>
38 #include <fx.h>
41 #include <utils/common/SUMOTime.h>
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class GUIGlObject;
48 class GUIMainWindow;
50 class Parameterised;
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(const Parameterised* p = 0);
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<double>* 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, double 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 
258  static int numParams(const GUIGlObject* obj);
259 
260 protected:
263 
264 };
265 
266 
267 #endif
268 
269 /****************************************************************************/
270 
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
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.
static int numParams(const GUIGlObject *obj)
returns the number of parameters if obj is Parameterised and 0 otherwise
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.
An upper class for objects with additional parameters.
Definition: Parameterised.h:50
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:70
GUIGlObject * myObject
The object to get the information from.
static void updateAll()
Updates all instances.
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.
A window containing a gl-object&#39;s parameter.