GUIDialog_GLObjChooser Class Reference

#include <GUIDialog_GLObjChooser.h>

Inheritance diagram for GUIDialog_GLObjChooser:

FXMainWindow

Detailed Description

Instances of this class are windows that display the list of instances from a given artifact like vehicles, edges or junctions and allow one of their items

Definition at line 55 of file GUIDialog_GLObjChooser.h.


Public Member Functions

GUIGlObjectgetObject () const throw ()
 Returns the chosen (selected) object.
 GUIDialog_GLObjChooser (GUISUMOViewParent *parent, FXIcon *icon, const FXString &title, GUIGlObjectType type, GUIGlObjectStorage &glStorage)
 Constructor.
long onChgText (FXObject *, FXSelector, void *)
 Callback: Something has been typed into the the field.
long onCmdCenter (FXObject *, FXSelector, void *)
 Callback: The selected item shall be centered within the calling view.
long onCmdClose (FXObject *, FXSelector, void *)
 Callback: The dialog shall be closed.
long onCmdText (FXObject *, FXSelector, void *)
 Callback: Selects to current item if enter is pressed.
long onListKeyPress (FXObject *, FXSelector, void *)
 Callback: Selects to current item if enter is pressed.
 ~GUIDialog_GLObjChooser ()
 Destructor.

Protected Member Functions

 GUIDialog_GLObjChooser ()
 FOX needs this.

Private Attributes

FXList * myList
 The list that holds the ids.
GUIGlObjectType myObjectType
 The artifact to choose.
GUISUMOViewParentmyParent
 The parent window.
GUIGlObjectmySelected
 The chosen id.
FXTextFieldmyTextEntry
 The text field.

Constructor & Destructor Documentation

GUIDialog_GLObjChooser::GUIDialog_GLObjChooser ( GUISUMOViewParent parent,
FXIcon *  icon,
const FXString &  title,
GUIGlObjectType  type,
GUIGlObjectStorage glStorage 
)

Constructor.

Parameters:
[in] parent The calling view
[in] icon The icon to use
[in] title The title to use
[in] type The type of gl-objects to show instances of
[in] glStorage The storage to retrieve ids from

GUIDialog_GLObjChooser::~GUIDialog_GLObjChooser (  ) 

Destructor.

Definition at line 154 of file GUIDialog_GLObjChooser.cpp.

References GUISUMOViewParent::getParent(), myParent, and GUIMainWindow::removeChild().

00154                                                 {
00155     myParent->getParent()->removeChild(this);
00156 }

GUIDialog_GLObjChooser::GUIDialog_GLObjChooser (  )  [inline, protected]

FOX needs this.

Definition at line 118 of file GUIDialog_GLObjChooser.h.

00118 { }


Member Function Documentation

GUIGlObject* GUIDialog_GLObjChooser::getObject (  )  const throw () [inline]

Returns the chosen (selected) object.

Returns:
The selected object

Definition at line 78 of file GUIDialog_GLObjChooser.h.

References mySelected.

00078                                            {
00079         return static_cast<GUIGlObject*>(mySelected);
00080     }

long GUIDialog_GLObjChooser::onChgText ( FXObject ,
FXSelector  ,
void *   
)

Callback: Something has been typed into the the field.

Definition at line 180 of file GUIDialog_GLObjChooser.cpp.

References myList, and myTextEntry.

00180                                                             {
00181     int id = myList->findItem(myTextEntry->getText(), -1, SEARCH_PREFIX);
00182     if (id<0) {
00183         return 1;
00184     }
00185     myList->deselectItem(myList->getCurrentItem());
00186     myList->makeItemVisible(id);
00187     myList->selectItem(id);
00188     myList->setCurrentItem(id, true);
00189     return 1;
00190 }

long GUIDialog_GLObjChooser::onCmdCenter ( FXObject ,
FXSelector  ,
void *   
)

Callback: The selected item shall be centered within the calling view.

Definition at line 160 of file GUIDialog_GLObjChooser.cpp.

References myList, myParent, mySelected, and GUISUMOViewParent::setView().

00160                                                               {
00161     int selected = myList->getCurrentItem();
00162     if (selected>=0) {
00163         mySelected = static_cast<GUIGlObject*>(myList->getItemData(selected));
00164     } else {
00165         mySelected = 0;
00166     }
00167     myParent->setView(mySelected);
00168     return 1;
00169 }

long GUIDialog_GLObjChooser::onCmdClose ( FXObject ,
FXSelector  ,
void *   
)

Callback: The dialog shall be closed.

Definition at line 173 of file GUIDialog_GLObjChooser.cpp.

00173                                                              {
00174     close(true);
00175     return 1;
00176 }

long GUIDialog_GLObjChooser::onCmdText ( FXObject ,
FXSelector  ,
void *   
)

Callback: Selects to current item if enter is pressed.

Definition at line 194 of file GUIDialog_GLObjChooser.cpp.

References myList, myParent, mySelected, and GUISUMOViewParent::setView().

00194                                                             {
00195     int selected = myList->getCurrentItem();
00196     if (selected>=0) {
00197         mySelected = static_cast<GUIGlObject*>(myList->getItemData(selected));
00198         myParent->setView(mySelected);
00199     }
00200     return 1;
00201 }

long GUIDialog_GLObjChooser::onListKeyPress ( FXObject ,
FXSelector  ,
void *  ptr 
)

Callback: Selects to current item if enter is pressed.

Definition at line 205 of file GUIDialog_GLObjChooser.cpp.

References myList, myParent, mySelected, and GUISUMOViewParent::setView().

00205                                                                     {
00206     FXEvent* event=(FXEvent*)ptr;
00207     switch (event->code) {
00208     case KEY_Return: {
00209         int current = myList->getCurrentItem();
00210         if (current>=0&&myList->isItemSelected(current)) {
00211             mySelected = static_cast<GUIGlObject*>(myList->getItemData(current));
00212             myParent->setView(mySelected);
00213         }
00214     }
00215     }
00216     return 1;
00217 }


Field Documentation

FXList* GUIDialog_GLObjChooser::myList [private]

The list that holds the ids.

Definition at line 101 of file GUIDialog_GLObjChooser.h.

Referenced by onChgText(), onCmdCenter(), onCmdText(), and onListKeyPress().

The artifact to choose.

Definition at line 104 of file GUIDialog_GLObjChooser.h.

The parent window.

Definition at line 107 of file GUIDialog_GLObjChooser.h.

Referenced by onCmdCenter(), onCmdText(), onListKeyPress(), and ~GUIDialog_GLObjChooser().

The chosen id.

Definition at line 110 of file GUIDialog_GLObjChooser.h.

Referenced by getObject(), onCmdCenter(), onCmdText(), and onListKeyPress().

The text field.

Definition at line 113 of file GUIDialog_GLObjChooser.h.

Referenced by onChgText().


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

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