53FXIMPLEMENT(
GUIParameterTableWindow, FXMainWindow, GUIParameterTableWindowMap, ARRAYNUMBER(GUIParameterTableWindowMap))
66 FXMainWindow(app.getApp(), ((title ==
"" ? o.getFullName() : title) +
" Parameter").c_str(), nullptr, nullptr, DECOR_ALL, 20, 40, 200, 500),
72 myTable =
new FXTable(
this,
this,
MID_TABLE, TABLE_COL_SIZABLE | TABLE_ROW_SIZABLE | LAYOUT_FILL_X | LAYOUT_FILL_Y);
75 myTable->setBackColor(FXRGB(255, 255, 255));
79 myTable->getRowHeader()->setWidth(0);
80 FXHeader* header =
myTable->getColumnHeader();
81 header->setItemJustify(0, JUSTIFY_CENTER_X);
82 header->setItemSize(0, 240);
83 header->setItemJustify(1, JUSTIFY_CENTER_X);
84 header->setItemSize(1, 120);
85 header->setItemJustify(2, JUSTIFY_CENTER_X);
86 header->setItemSize(2, 60);
101 for (std::vector<GUIParameterTableItemInterface*>::iterator i =
myItems.begin(); i !=
myItems.end(); ++i) {
109 std::vector<GUIParameterTableWindow*>::iterator i = std::find(
myContainer.begin(),
myContainer.end(),
this);
118 FXMutexLock locker(
myLock);
145 FXEvent* e = (FXEvent*) eventData;
146 int row =
myTable->rowAtY(e->win_y);
147 int col =
myTable->colAtX(e->win_x);
148 if (col == 2 && row >= 0 && row < (
int)
myItems.size()) {
157 tr->setX(getX() + getWidth() + 10);
165 return FXMainWindow::onLeftBtnPress(sender, sel, eventData);
171 FXEvent* e = (FXEvent*) eventData;
172 int row =
myTable->rowAtY(e->win_y);
173 if (row == -1 || row >= (
int)(
myItems.size())) {
185 if (doubleSource !=
nullptr) {
189 p->setX(
static_cast<FXEvent*
>(eventData)->root_x);
190 p->setY(
static_cast<FXEvent*
>(eventData)->root_y);
241 FXMutexLock locker(
myLock);
259 for (Parameterised::Map::const_iterator it = map.begin(); it != map.end(); ++it) {
260 mkItem((
"param:" + it->first).c_str(),
false, it->second);
263 const int rows = (int)
myItems.size() + 1;
264 int h = rows * 20 + 40;
266 for (
int i = 0; i < (int)
myItems.size(); i++) {
270 myTable->fitColumnsToContents(1);
271 setWidth(
myTable->getContentWidth() + 40);
281 bool missingChar =
false;
282 FXString fxs(text.c_str());
283 for (FXint i = 0; i < fxs.length(); i = fxs.inc(i)) {
284 FXwchar wc = fxs.wc(i);
285 if (
myTable->getFont()->hasChar(wc) != TRUE) {
@ MID_SIMSTEP
A Simulation step was performed.
@ MID_OPENTRACKER
A Tracker shall be opened.
FXDEFMAP(GUIParameterTableWindow) GUIParameterTableWindowMap[]
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
const std::string & getFullName() const
void addParameterTable(GUIParameterTableWindow *w)
void removeParameterTable(GUIParameterTableWindow *w)
Lets this object know a parameter window showing the object's values was closed.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
virtual double getTrackerInterval() const =0
get tracker interval (must be implemented in all children)
virtual SUMOTime getCurrentSimTime() const =0
get current sim time (must be implemented in all children)
FXFont * getFallbackFont()
get fallback front
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
void addChild(FXMainWindow *child)
Adds a further child window to the list (FXMainWindow)
Instance of a single line in a parameter window.
Interface to a single line in a parameter window.
virtual const std::string & getName() const =0
Returns the name of the value.
virtual ValueSource< double > * getdoubleSourceCopy() const =0
Returns a double-typed copy of the value-source.
virtual bool dynamic() const =0
Returns the information whether the value changes over simulation time.
A window containing a gl-object's parameter.
long onRightButtonPress(FXObject *, FXSelector, void *)
Shows a popup.
GUIMainWindow * myApplication
The main application window.
static FXMutex myGlobalContainerLock
The mutex used to avoid concurrent updates of the instance container.
void removeObject(GUIGlObject *const o)
Lets this window know the object shown is being deleted.
static int numParams(const GUIGlObject *obj)
returns the number of parameters if obj is Parameterised and 0 otherwise
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
int myTrackerY
y-position for opening new tracker window
long onLeftBtnPress(FXObject *, FXSelector, void *)
directly opens tracker when clicking on last column
long onTableSelected(FXObject *, FXSelector, void *)
Does nothing.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
FXMutex myLock
A lock assuring save updates in case of object deletion.
std::vector< GUIParameterTableItemInterface * > myItems
The list of table rows.
unsigned myCurrentPos
The index of the next row to add - used while building.
void checkFont(const std::string &text)
ensure that the font covers the given text
long onTableDeselected(FXObject *, FXSelector, void *)
Does nothing.
~GUIParameterTableWindow()
Destructor.
FXTable * myTable
The table to display the information in.
static std::vector< GUIParameterTableWindow * > myContainer
The container of items that shall be updated.
long onSimStep(FXObject *, FXSelector, void *)
Updates the table due to a simulation step.
GUIParameterTableWindow(GUIMainWindow &app, GUIGlObject &o, const std::string &title="")
Constructor.
void updateTable()
Updates the table.
GUIGlObject * myObject
The object to get the information from.
A window which displays the time line of one (or more) value(s)
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
void create()
Creates the window.
static bool addTrackedMultiplot(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
all value source to multiplot trackers
Persists window position in the registry.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
static const RGBColor BLACK
Representation of a timeline of floats with their names and moments.