GUIParameterTableWindow Class Reference

#include <GUIParameterTableWindow.h>

Inheritance diagram for GUIParameterTableWindow:

FXMainWindow

Detailed Description

A window containing a gl-object's parameter.

This class realises a view on some parameter of a gl-object. The gl-object itself is responsible for filling this table.

After allocating such a table, the object should fill the rows by calling one of the mkItem-methods for each. The building is closed using closeBuilding what forces the table to be displayed.

Each row is represented using an instance of GUIParameterTableItemInterface.

Definition at line 63 of file GUIParameterTableWindow.h.


Public Member Functions

void closeBuilding () throw ()
 Closes the building of the table.
 GUIParameterTableWindow (GUIMainWindow &app, GUIGlObject &o, size_t noRows) throw ()
 Constructor.
 ~GUIParameterTableWindow () throw ()
 Destructor.
Row adding functions
void mkItem (const char *name, bool dynamic, SUMOTime value) throw ()
 Adds a row which shows a SUMOTime-value.
void mkItem (const char *name, bool dynamic, SUMOReal value) throw ()
 Adds a row which shows a SUMOReal-value.
void mkItem (const char *name, bool dynamic, unsigned value) throw ()
 Adds a row which shows a unsigned-value.
void mkItem (const char *name, bool dynamic, std::string value) throw ()
 Adds a row which shows a string-value.
void mkItem (const char *name, bool dynamic, ValueSource< SUMOTime > *src) throw ()
 Adds a row which obtains its value from an SUMOTime-ValueSource.
void mkItem (const char *name, bool dynamic, ValueSource< SUMOReal > *src) throw ()
 Adds a row which obtains its value from an SUMOReal-ValueSource.
void mkItem (const char *name, bool dynamic, ValueSource< unsigned > *src) throw ()
 Adds a row which obtains its value from an unsigned-ValueSource.
FOX-callbacks
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.
long onTableSelected (FXObject *, FXSelector, void *)
 Does nothing.

Protected Member Functions

 GUIParameterTableWindow ()
 FOX needs this.
void updateTable () throw ()
 Updates the table.

Private Attributes

GUIMainWindowmyApplication
 The main application window.
unsigned myCurrentPos
 The index of the next row to add - used while building.
std::vector
< GUIParameterTableItemInterface * > 
myItems
 The list of table rows.
GUIGlObjectmyObject
 The object to get the information from.
FXTablemyTable
 The table to display the information in.

Constructor & Destructor Documentation

GUIParameterTableWindow::GUIParameterTableWindow ( GUIMainWindow app,
GUIGlObject o,
size_t  noRows 
) throw ()

Constructor.

Parameters:
[in] app The application this window belongs to
[in] o The gl-object this table describes
[in] noRows Number of rows to allocate

GUIParameterTableWindow::~GUIParameterTableWindow (  )  throw ()

Destructor.

Definition at line 88 of file GUIParameterTableWindow.cpp.

References myApplication, myItems, and GUIMainWindow::removeChild().

00088                                                           {
00089     myApplication->removeChild(this);
00090     for (std::vector<GUIParameterTableItemInterface*>::iterator i=myItems.begin(); i!=myItems.end(); ++i) {
00091         delete(*i);
00092     }
00093 }

GUIParameterTableWindow::GUIParameterTableWindow (  )  [inline, protected]

FOX needs this.

Definition at line 225 of file GUIParameterTableWindow.h.

00225 { }


Member Function Documentation

void GUIParameterTableWindow::closeBuilding (  )  throw ()

Closes the building of the table.

Adds the table to the list of child windows of the applications also telling the application that the window should be updated in each simulation step. Shows the table.

See also:
GUIMainWindow::addChild

Definition at line 222 of file GUIParameterTableWindow.cpp.

References GUIMainWindow::addChild(), and myApplication.

Referenced by GUIVehicle::getParameterWindow(), GUINet::getParameterWindow(), GUILaneWrapper::getParameterWindow(), GUILaneSpeedTrigger::getParameterWindow(), GUIInductLoop::MyWrapper::getParameterWindow(), GUIEdge::getParameterWindow(), GUIE3Collector::MyWrapper::getParameterWindow(), GUI_E2_ZS_CollectorOverLanes::MyWrapper::getParameterWindow(), and GUI_E2_ZS_Collector::MyWrapper::getParameterWindow().

00222                                                {
00223     myApplication->addChild(this, true);
00224     create();
00225     show();
00226 }

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
SUMOTime  value 
) throw ()

Adds a row which shows a SUMOTime-value.

Parameters:
[in] name The name of the row entry
[in] dynamic Information whether the entry is dynamic
[in] value The value to show
Todo:
the dynamic-parameter is obsolete

Definition at line 204 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

00205                                                         {
00206     GUIParameterTableItemInterface *i = new GUIParameterTableItem<SUMOTime>(
00207         myTable, myCurrentPos++, name, dynamic, value);
00208     myItems.push_back(i);
00209 }

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
SUMOReal  value 
) throw ()

Adds a row which shows a SUMOReal-value.

Parameters:
[in] name The name of the row entry
[in] dynamic Information whether the entry is dynamic
[in] value The value to show
Todo:
the dynamic-parameter is obsolete

Definition at line 185 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

00186                                                         {
00187     GUIParameterTableItemInterface *i = new GUIParameterTableItem<SUMOReal>(
00188         myTable, myCurrentPos++, name, dynamic, value);
00189     myItems.push_back(i);
00190 }

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
unsigned  value 
) throw ()

Adds a row which shows a unsigned-value.

Parameters:
[in] name The name of the row entry
[in] dynamic Information whether the entry is dynamic
[in] value The value to show
Todo:
the dynamic-parameter is obsolete

Definition at line 194 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

00195                                                         {
00196     GUIParameterTableItemInterface *i = new GUIParameterTableItem<unsigned>(
00197         myTable, myCurrentPos++, name, dynamic, value);
00198     myItems.push_back(i);
00199 }

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
std::string  value 
) throw ()

Adds a row which shows a string-value.

Parameters:
[in] name The name of the row entry
[in] dynamic Information whether the entry is dynamic
[in] value The value to show
Todo:
the dynamic-parameter is obsolete(?)

Definition at line 176 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

00177                                                          {
00178     GUIParameterTableItemInterface *i = new GUIParameterTableItem<SUMOReal>(
00179         myTable, myCurrentPos++, name, dynamic, value);
00180     myItems.push_back(i);
00181 }

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
ValueSource< SUMOTime > *  src 
) throw ()

Adds a row which obtains its value from an SUMOTime-ValueSource.

Parameters:
[in] name The name of the row entry
[in] dynamic Information whether the entry is dynamic
[in] src The value source to use

Definition at line 166 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

00167                                                                     {
00168     GUIParameterTableItemInterface *i = new GUIParameterTableItem<SUMOTime>(
00169         myTable, myCurrentPos++, name, dynamic, src);
00170     myItems.push_back(i);
00171 }

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
ValueSource< SUMOReal > *  src 
) throw ()

Adds a row which obtains its value from an SUMOReal-ValueSource.

Parameters:
[in] name The name of the row entry
[in] dynamic Information whether the entry is dynamic
[in] src The value source to use

Definition at line 156 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

00157                                                                     {
00158     GUIParameterTableItemInterface *i = new GUIParameterTableItem<SUMOReal>(
00159         myTable, myCurrentPos++, name, dynamic, src);
00160     myItems.push_back(i);
00161 }

void GUIParameterTableWindow::mkItem ( const char *  name,
bool  dynamic,
ValueSource< unsigned > *  src 
) throw ()

Adds a row which obtains its value from an unsigned-ValueSource.

Parameters:
[in] name The name of the row entry
[in] dynamic Information whether the entry is dynamic
[in] src The value source to use

Definition at line 147 of file GUIParameterTableWindow.cpp.

References myCurrentPos, myItems, and myTable.

Referenced by GUIVehicle::getParameterWindow(), GUINet::getParameterWindow(), GUILaneWrapper::getParameterWindow(), GUILaneSpeedTrigger::getParameterWindow(), GUIInductLoop::MyWrapper::getParameterWindow(), GUIEdge::getParameterWindow(), GUIE3Collector::MyWrapper::getParameterWindow(), GUI_E2_ZS_CollectorOverLanes::MyWrapper::getParameterWindow(), and GUI_E2_ZS_Collector::MyWrapper::getParameterWindow().

00148                                                                     {
00149     GUIParameterTableItemInterface *i = new GUIParameterTableItem<unsigned>(
00150         myTable, myCurrentPos++, name, dynamic, src);
00151     myItems.push_back(i);
00152 }

long GUIParameterTableWindow::onRightButtonPress ( FXObject sender,
FXSelector  sel,
void *  data 
)

Shows a popup.

Callback for right-mouse-button pressing event. Obtains the selected row and determines whether it is dynamic. If so, a popup-menu which allows to open a tracker for this value is built and shown.

See also:
GUIParameterTableItemInterface

GUIParam_PopupMenuInterface

Definition at line 117 of file GUIParameterTableWindow.cpp.

References GUIParameterTableItemInterface::dynamic(), GUIParameterTableItemInterface::getName(), GUIParameterTableItemInterface::getSUMORealSourceCopy(), MID_OPENTRACKER, myApplication, myItems, myObject, and myTable.

00119                    {
00120     // check which value entry was pressed
00121     myTable->onLeftBtnPress(sender, sel, data);
00122     int row = myTable->getCurrentRow();
00123     if (row==-1||row>=myItems.size()) {
00124         return 1;
00125     }
00126     GUIParameterTableItemInterface *i = myItems[row];
00127     if (!i->dynamic()) {
00128         return 1;
00129     }
00130 
00131     GUIParam_PopupMenuInterface *p =
00132         new GUIParam_PopupMenuInterface(*myApplication, *this,
00133                                         *myObject, i->getName(), i->getSUMORealSourceCopy());
00134     new FXMenuCommand(p, "Open in new Tracker", 0, p, MID_OPENTRACKER);
00135     // set geometry
00136     p->setX(static_cast<FXEvent*>(data)->root_x);
00137     p->setY(static_cast<FXEvent*>(data)->root_y);
00138     p->create();
00139     // show
00140     p->show();
00141     return 1;
00142 }

long GUIParameterTableWindow::onSimStep ( FXObject ,
FXSelector  ,
void *   
)

Updates the table due to a simulation step.

Definition at line 97 of file GUIParameterTableWindow.cpp.

References updateTable().

00097                                                              {
00098     updateTable();
00099     update();
00100     return 1;
00101 }

long GUIParameterTableWindow::onTableDeselected ( FXObject ,
FXSelector  ,
void *   
)

Does nothing.

Todo:
Recheck whether this is needed (to override FXTable-behaviour?)

Definition at line 111 of file GUIParameterTableWindow.cpp.

00111                                                                      {
00112     return 1;
00113 }

long GUIParameterTableWindow::onTableSelected ( FXObject ,
FXSelector  ,
void *   
)

Does nothing.

Todo:
Recheck whether this is needed (to override FXTable-behaviour?)

Definition at line 105 of file GUIParameterTableWindow.cpp.

00105                                                                    {
00106     return 1;
00107 }

void GUIParameterTableWindow::updateTable (  )  throw () [protected]

Updates the table.

Goes through all entries and updates them using GUIParameterTableItemInterface::update.

See also:
GUIParameterTableItemInterface::update

Definition at line 214 of file GUIParameterTableWindow.cpp.

References myItems.

Referenced by onSimStep().

00214                                              {
00215     for (std::vector<GUIParameterTableItemInterface*>::iterator i=myItems.begin(); i!=myItems.end(); i++) {
00216         (*i)->update();
00217     }
00218 }


Field Documentation

The main application window.

Definition at line 214 of file GUIParameterTableWindow.h.

Referenced by closeBuilding(), onRightButtonPress(), and ~GUIParameterTableWindow().

The index of the next row to add - used while building.

Definition at line 220 of file GUIParameterTableWindow.h.

Referenced by mkItem().

The list of table rows.

Definition at line 217 of file GUIParameterTableWindow.h.

Referenced by mkItem(), onRightButtonPress(), updateTable(), and ~GUIParameterTableWindow().

The object to get the information from.

Definition at line 208 of file GUIParameterTableWindow.h.

Referenced by onRightButtonPress().

The table to display the information in.

Definition at line 211 of file GUIParameterTableWindow.h.

Referenced by mkItem(), and onRightButtonPress().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:44 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6