ManaPlus
Public Member Functions | Protected Attributes
ToolTipListener Class Reference

#include <tooltiplistener.h>

Inheritance diagram for ToolTipListener:
MouseListener CheckBox HorizontContainer Label

Public Member Functions

 ToolTipListener ()
 
void setToolTip (const std::string &str)
 
std::string getToolTip () const
 
void mouseMoved (MouseEvent &event)
 
void mouseExited (MouseEvent &event)
 
- Public Member Functions inherited from MouseListener
virtual ~MouseListener ()
 
virtual void mouseEntered (MouseEvent &event)
 
virtual void mousePressed (MouseEvent &event)
 
virtual void mouseReleased (MouseEvent &event)
 
virtual void mouseClicked (MouseEvent &event)
 
virtual void mouseWheelMovedUp (MouseEvent &event)
 
virtual void mouseWheelMovedDown (MouseEvent &event)
 
virtual void mouseDragged (MouseEvent &event)
 

Protected Attributes

std::string mToolTip
 

Additional Inherited Members

- Protected Member Functions inherited from MouseListener
 MouseListener ()
 

Detailed Description

Definition at line 31 of file tooltiplistener.h.

Constructor & Destructor Documentation

◆ ToolTipListener()

ToolTipListener::ToolTipListener ( )

Definition at line 31 of file tooltiplistener.cpp.

31  :
32  MouseListener(),
33  mToolTip()
34 {
35 }
std::string mToolTip

Member Function Documentation

◆ getToolTip()

std::string ToolTipListener::getToolTip ( ) const
inline

Definition at line 41 of file tooltiplistener.h.

42  { return mToolTip; }

References mToolTip.

◆ mouseExited()

void ToolTipListener::mouseExited ( MouseEvent event)
virtual

Called when the mouse has exited the widget area.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 58 of file tooltiplistener.cpp.

59 {
60  if (mToolTip.empty() || (textBoxPopup == nullptr))
61  return;
62  textBoxPopup->hide();
63 }
void hide()
Definition: popup.cpp:265
TextBoxPopup * textBoxPopup

References Popup::hide(), mToolTip, and textBoxPopup.

Referenced by CheckBox::mouseExited().

◆ mouseMoved()

void ToolTipListener::mouseMoved ( MouseEvent event)
virtual

Called when the mouse has moved in the widget area and no mouse button has been pressed (i.e no widget is being dragged).

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 37 of file tooltiplistener.cpp.

38 {
39  if (mToolTip.empty() || (textBoxPopup == nullptr))
40  return;
41 
42  int x = 0;
43  int y = 0;
44  if (viewport != nullptr)
45  {
46  x = viewport->mMouseX;
47  y = viewport->mMouseY;
48  }
49  else
50  {
52  }
53 
54  event.consume();
56 }
static uint8_t getMouseState(int &x, int &y)
Definition: gui.cpp:1171
void show(const int x, const int y, const std::string &str)
int mMouseX
Definition: viewport.h:154
int mMouseY
Definition: viewport.h:155
Viewport * viewport
Definition: viewport.cpp:36

References Gui::getMouseState(), Viewport::mMouseX, Viewport::mMouseY, mToolTip, TextBoxPopup::show(), textBoxPopup, viewport, x, and y.

◆ setToolTip()

void ToolTipListener::setToolTip ( const std::string &  str)
inline

Field Documentation

◆ mToolTip

std::string ToolTipListener::mToolTip
protected

Definition at line 49 of file tooltiplistener.h.

Referenced by getToolTip(), mouseExited(), mouseMoved(), and setToolTip().


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