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-2017 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 class Parameterised;
52 
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
70 class GUIParameterTableWindow : public FXMainWindow {
71  FXDECLARE(GUIParameterTableWindow)
72 public:
80  GUIGlObject& o, int noRows);
81 
82 
85 
86 
95  void closeBuilding(const Parameterised* p = 0);
96 
97 
98 
102  void removeObject(GUIGlObject* const o);
103 
104 
105 
108 
115  void mkItem(const char* name, bool dynamic, ValueSource<unsigned>* src);
116 
123  void mkItem(const char* name, bool dynamic, ValueSource<int>* src);
124 
125 
132  void mkItem(const char* name, bool dynamic, ValueSource<double>* src);
133 
134 
142  void mkItem(const char* name, bool dynamic, std::string value);
143 
144 
152  void mkItem(const char* name, bool dynamic, unsigned value);
153 
154 
162  void mkItem(const char* name, bool dynamic, int value);
163 
164 
172  void mkItem(const char* name, bool dynamic, long long int value);
173 
174 
182  void mkItem(const char* name, bool dynamic, double value);
183 
184 
186 
187 
188 
191 
193  long onSimStep(FXObject*, FXSelector, void*);
194 
198  long onTableSelected(FXObject*, FXSelector, void*);
199 
203  long onTableDeselected(FXObject*, FXSelector, void*);
204 
214  long onRightButtonPress(FXObject*, FXSelector, void*);
216 
219  static void updateAll() {
221  std::for_each(myContainer.begin(), myContainer.end(), std::mem_fun(&GUIParameterTableWindow::updateTable));
222  }
223 
224 protected:
231  void updateTable();
232 
235 
237  static std::vector<GUIParameterTableWindow*> myContainer;
238 
239 private:
242 
244  FXTable* myTable;
245 
248 
250  std::vector<GUIParameterTableItemInterface*> myItems;
251 
253  unsigned myCurrentPos;
254 
256  mutable MFXMutex myLock;
257 
259  static int numParams(const GUIGlObject* obj);
260 
261 protected:
264 
265 };
266 
267 
268 #endif
269 
270 /****************************************************************************/
271 
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:51
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.
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.