GUIGLObjectToolTip Class Reference

#include <GUIGLObjectToolTip.h>

Inheritance diagram for GUIGLObjectToolTip:

FXToolTip

Detailed Description

The tooltip class for displaying information about gl-objects.

Definition at line 51 of file GUIGLObjectToolTip.h.


Public Member Functions

FXint getDefaultHeight ()
FXint getDefaultWidth ()
 GUIGLObjectToolTip (FXWindow *a)
 Constructor.
long onPaint (FXObject *, FXSelector, void *ptr)
long onTipHide (FXObject *, FXSelector, void *)
long onTipShow (FXObject *, FXSelector, void *)
 ~GUIGLObjectToolTip ()
 Destructor.

Protected Member Functions

 GUIGLObjectToolTip ()
 FOX default constructor.

Private Member Functions

void eraseTip ()
 removes the tooltip (undisplays it)
void setObjectTip (GUIGlObject *object, FXint x, FXint y)
 sets the tooltip displaying information about the given object at the given position

Private Attributes

FXFont * myFont
 The used font.
FXint myHeight
FXint myLastXPos
 The last position of the tool tip.
FXint myLastYPos
GUIGlObjectmyObject
 The object for which the tool tip is displayed.
std::string myObjectName
 The name of the object currently displayed.
GUISUMOAbstractViewmyParent
 The parent window.
int myTextHeight
 The height of the displayed text.
FXint myWidth
 The current width and height.

Friends

class GUIRouterSUMOAbstractView
class GUISUMOAbstractView
 an abstract view may set or erase the tooltip

Constructor & Destructor Documentation

GUIGLObjectToolTip::GUIGLObjectToolTip ( FXWindow *  a  ) 

Constructor.

GUIGLObjectToolTip::~GUIGLObjectToolTip (  ) 

Destructor.

Definition at line 65 of file GUIGLObjectToolTip.cpp.

00065 {}

GUIGLObjectToolTip::GUIGLObjectToolTip (  )  [inline, protected]

FOX default constructor.

Definition at line 105 of file GUIGLObjectToolTip.h.

00105 { }


Member Function Documentation

void GUIGLObjectToolTip::eraseTip (  )  [private]

removes the tooltip (undisplays it)

FXint GUIGLObjectToolTip::getDefaultHeight (  ) 

Definition at line 128 of file GUIGLObjectToolTip.cpp.

References myHeight.

00128                                      {
00129     return myHeight;
00130 }

FXint GUIGLObjectToolTip::getDefaultWidth (  ) 

Definition at line 122 of file GUIGLObjectToolTip.cpp.

References myWidth.

00122                                     {
00123     return myWidth;
00124 }

long GUIGLObjectToolTip::onPaint ( FXObject ,
FXSelector  ,
void *  ptr 
)

Definition at line 103 of file GUIGLObjectToolTip.cpp.

References GUIGlObject::getFullName(), myFont, myObject, myObjectName, and myTextHeight.

00103                                                       {
00104     if (myObject==0) {
00105         return 1;
00106     }
00107     // Start drawing
00108     FXDCWindow dc(this);
00109     dc.setForeground(backColor);
00110     dc.fillRectangle(1, 1,
00111                      myFont->getTextWidth(myObjectName.c_str(), (FXuint) myObjectName.length())+4, myTextHeight+4);
00112     dc.setFont(myFont);
00113     dc.setForeground(0);
00114     dc.drawText(3, myTextHeight,
00115                 myObjectName.c_str(), (FXuint) myObject->getFullName().length());
00116     dc.drawRectangle(0, 0, myFont->getTextWidth(myObjectName.c_str(), (FXuint) myObjectName.length())+5, myTextHeight+5);
00117     return 1;
00118 }

long GUIGLObjectToolTip::onTipHide ( FXObject ,
FXSelector  ,
void *   
)

Definition at line 140 of file GUIGLObjectToolTip.cpp.

00140                                                         {
00141     return 1;
00142 }

long GUIGLObjectToolTip::onTipShow ( FXObject ,
FXSelector  ,
void *   
)

Definition at line 134 of file GUIGLObjectToolTip.cpp.

00134                                                         {
00135     return 1;
00136 }

void GUIGLObjectToolTip::setObjectTip ( GUIGlObject object,
FXint  x,
FXint  y 
) [private]

sets the tooltip displaying information about the given object at the given position

Definition at line 68 of file GUIGLObjectToolTip.cpp.

References myFont, myHeight, myLastXPos, myLastYPos, myObject, myObjectName, myTextHeight, and myWidth.

Referenced by GUISUMOAbstractView::onMouseLeft(), and GUISUMOAbstractView::showToolTipFor().

00069                                                    {
00070     // check whether the object has changed
00071     bool objectChanged = (myObject!=object);
00072     // save current object
00073     myObject = object;
00074     if (object==0) {
00075         // hide the tool tip if there is no object below
00076         hide();
00077         return;
00078     }
00079     // if the object has changed
00080     if (objectChanged) {
00081         // get the new name and width
00082         myObjectName = object->getFullName();
00083         label = myObjectName.c_str();
00084         myWidth = myFont->getTextWidth(myObjectName.c_str(), (FXuint) myObjectName.length())+6;
00085     }
00086     myHeight = myTextHeight+6;
00087     position(x+15, y-20, 1, 1);
00088     position(x+15, y-20, myWidth, myHeight);
00089     if (!shown()) {
00090         show();
00091     } else {
00092         if (objectChanged) {
00093             recalc();
00094         }
00095         update();
00096     }
00097     myLastXPos = x;
00098     myLastYPos = y;
00099 }


Friends And Related Function Documentation

friend class GUIRouterSUMOAbstractView [friend]

Definition at line 63 of file GUIGLObjectToolTip.h.

friend class GUISUMOAbstractView [friend]

an abstract view may set or erase the tooltip

Definition at line 62 of file GUIGLObjectToolTip.h.


Field Documentation

FXFont* GUIGLObjectToolTip::myFont [private]

The used font.

Definition at line 89 of file GUIGLObjectToolTip.h.

Referenced by onPaint(), and setObjectTip().

Definition at line 95 of file GUIGLObjectToolTip.h.

Referenced by getDefaultHeight(), and setObjectTip().

The last position of the tool tip.

Definition at line 98 of file GUIGLObjectToolTip.h.

Referenced by setObjectTip().

Definition at line 98 of file GUIGLObjectToolTip.h.

Referenced by setObjectTip().

The object for which the tool tip is displayed.

Definition at line 101 of file GUIGLObjectToolTip.h.

Referenced by onPaint(), and setObjectTip().

std::string GUIGLObjectToolTip::myObjectName [private]

The name of the object currently displayed.

Definition at line 92 of file GUIGLObjectToolTip.h.

Referenced by onPaint(), and setObjectTip().

The parent window.

Definition at line 83 of file GUIGLObjectToolTip.h.

The height of the displayed text.

Definition at line 86 of file GUIGLObjectToolTip.h.

Referenced by onPaint(), and setObjectTip().

FXint GUIGLObjectToolTip::myWidth [private]

The current width and height.

Definition at line 95 of file GUIGLObjectToolTip.h.

Referenced by getDefaultWidth(), and setObjectTip().


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

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