xoreos  0.0.5
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Engines::NWN::Tooltip Class Reference

A tooltip. More...

#include <tooltip.h>

Inheritance diagram for Engines::NWN::Tooltip:
Inheritance graph
[legend]
Collaboration diagram for Engines::NWN::Tooltip:
Collaboration graph
[legend]

Classes

struct  Line
 

Public Types

enum  Type { kTypeHelp, kTypeFeedback, kTypeSpeech }
 

Public Member Functions

 Tooltip (Type type)
 
 Tooltip (Type type, Widget &parent)
 
 Tooltip (Type type, Graphics::Aurora::Model &parent)
 
 ~Tooltip ()
 
void clearLines ()
 
void clearPortrait ()
 
void addLine (const Common::UString &text, float r, float g, float b, float a)
 
void setPortrait (const Common::UString &image)
 
void setAlign (float align)
 
void updatePosition ()
 
void setPosition (float x, float y, float z)
 
void show (uint32 delay, uint32 timeOut=0)
 Show the tooltip. More...
 
void hide ()
 Hide the tooltip again. More...
 
- Public Member Functions inherited from Events::Notifyable
 Notifyable ()
 
virtual ~Notifyable ()
 

Static Public Member Functions

static uint32 getDefaultDelay ()
 Returns the configured default delay, in ms, before a tooltip appears. More...
 

Protected Member Functions

void notifyCameraMoved ()
 

Private Member Functions

void getSize (float &width, float &height)
 
void checkEmpty ()
 
void redoLines (bool force=false)
 
void redoBubble ()
 
void redoLayout ()
 
bool createTexts (float width, size_t maxLines=0)
 
void deleteTexts ()
 
uint32 doShow (uint32 oldInterval)
 
uint32 doHide (uint32 oldInterval)
 
void doShow ()
 
void doHide ()
 
void getFeedbackMode (bool &showBubble, bool &showText, bool &showPortrait) const
 
bool getParentPosition (float &x, float &y, float &z) const
 

Static Private Member Functions

static Common::UString getFontName ()
 
static Common::UString getBubbleModel (uint32 lines, float width)
 

Private Attributes

Type _type
 
Widget_parentWidget
 
Graphics::Aurora::Model_parentModel
 
bool _empty
 
bool _visible
 
float _align
 
bool _showText
 
bool _showBubble
 
bool _showPortrait
 
Common::ScopedPtr< Graphics::Aurora::Model_bubble
 
Common::ScopedPtr< Portrait_portrait
 
std::vector< Line_lines
 
Common::PtrVector< Graphics::Aurora::Text_texts
 
bool _offscreen
 
float _x
 
float _y
 
float _z
 
float _lineHeight
 
float _lineSpacing
 
float _width
 
float _height
 
Common::UString _font
 
Events::TimerHandle _timerShow
 
Events::TimerHandle _timerHide
 
bool _needCamera
 
bool _detectEdge
 
Common::Mutex _mutex
 

Detailed Description

A tooltip.

Definition at line 50 of file tooltip.h.

Member Enumeration Documentation

◆ Type

Enumerator
kTypeHelp 

Help string when mousing over a GUI widget.

kTypeFeedback 

Name and/or portrait of an object in the 3D world.

kTypeSpeech 

A scripted speech line on an object.

Definition at line 52 of file tooltip.h.

Constructor & Destructor Documentation

◆ Tooltip() [1/3]

Engines::NWN::Tooltip::Tooltip ( Type  type)

Definition at line 49 of file tooltip.cpp.

References _showBubble, _showPortrait, _showText, and getFeedbackMode().

Here is the call graph for this function:

◆ Tooltip() [2/3]

Engines::NWN::Tooltip::Tooltip ( Type  type,
Widget parent 
)

Definition at line 59 of file tooltip.cpp.

References _showBubble, _showPortrait, _showText, and getFeedbackMode().

Here is the call graph for this function:

◆ Tooltip() [3/3]

Engines::NWN::Tooltip::Tooltip ( Type  type,
Graphics::Aurora::Model parent 
)

Definition at line 69 of file tooltip.cpp.

References _showBubble, _showPortrait, _showText, and getFeedbackMode().

Here is the call graph for this function:

◆ ~Tooltip()

Engines::NWN::Tooltip::~Tooltip ( )

Definition at line 79 of file tooltip.cpp.

References deleteTexts(), and hide().

Here is the call graph for this function:

Member Function Documentation

◆ addLine()

void Engines::NWN::Tooltip::addLine ( const Common::UString text,
float  r,
float  g,
float  b,
float  a 
)

Definition at line 101 of file tooltip.cpp.

References _lines, Common::UString::empty(), hide(), redoLines(), and Common::UString::split().

Here is the call graph for this function:

◆ checkEmpty()

void Engines::NWN::Tooltip::checkEmpty ( )
private

Definition at line 305 of file tooltip.cpp.

References _empty, _lines, and _portrait.

Referenced by redoLayout().

Here is the caller graph for this function:

◆ clearLines()

void Engines::NWN::Tooltip::clearLines ( )

Definition at line 85 of file tooltip.cpp.

References _lines, hide(), and redoLines().

Here is the call graph for this function:

◆ clearPortrait()

void Engines::NWN::Tooltip::clearPortrait ( )

Definition at line 93 of file tooltip.cpp.

References _portrait, hide(), and redoLayout().

Here is the call graph for this function:

◆ createTexts()

bool Engines::NWN::Tooltip::createTexts ( float  width,
size_t  maxLines = 0 
)
private

Definition at line 313 of file tooltip.cpp.

References _font, _lines, _showBubble, _showPortrait, _texts, deleteTexts(), FontMan, Graphics::Aurora::FontHandle::getFont(), and Graphics::Font::split().

Referenced by redoLines().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteTexts()

void Engines::NWN::Tooltip::deleteTexts ( )
private

Definition at line 309 of file tooltip.cpp.

References _texts, and Common::PtrVector< T, Deallocator >::clear().

Referenced by createTexts(), and ~Tooltip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ doHide() [1/2]

uint32 Engines::NWN::Tooltip::doHide ( uint32  oldInterval)
private

Definition at line 462 of file tooltip.cpp.

References _mutex, _timerShow, _visible, doHide(), and TimerMan.

Here is the call graph for this function:

◆ doHide() [2/2]

void Engines::NWN::Tooltip::doHide ( )
private

Definition at line 442 of file tooltip.cpp.

References _bubble, _portrait, _texts, and GfxMan.

Referenced by doHide(), hide(), show(), and updatePosition().

Here is the caller graph for this function:

◆ doShow() [1/2]

uint32 Engines::NWN::Tooltip::doShow ( uint32  oldInterval)
private

Definition at line 456 of file tooltip.cpp.

References _mutex, and doShow().

Here is the call graph for this function:

◆ doShow() [2/2]

void Engines::NWN::Tooltip::doShow ( )
private

Definition at line 424 of file tooltip.cpp.

References _bubble, _empty, _offscreen, _portrait, _showBubble, _showPortrait, _showText, _texts, _visible, and GfxMan.

Referenced by doShow(), show(), and updatePosition().

Here is the caller graph for this function:

◆ getBubbleModel()

Common::UString Engines::NWN::Tooltip::getBubbleModel ( uint32  lines,
float  width 
)
staticprivate

Definition at line 503 of file tooltip.cpp.

References Common::UString::format().

Referenced by redoBubble().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDefaultDelay()

uint32 Engines::NWN::Tooltip::getDefaultDelay ( )
static

Returns the configured default delay, in ms, before a tooltip appears.

Definition at line 539 of file tooltip.cpp.

References ConfigMan.

Referenced by Engines::NWN::NWNWidget::enter(), and Engines::NWN::Object::showFeedbackTooltip().

Here is the caller graph for this function:

◆ getFeedbackMode()

void Engines::NWN::Tooltip::getFeedbackMode ( bool &  showBubble,
bool &  showText,
bool &  showPortrait 
) const
private

Definition at line 476 of file tooltip.cpp.

References _type, ConfigMan, kTypeHelp, and kTypeSpeech.

Referenced by redoLines(), and Tooltip().

Here is the caller graph for this function:

◆ getFontName()

Common::UString Engines::NWN::Tooltip::getFontName ( )
staticprivate

Definition at line 499 of file tooltip.cpp.

References ConfigMan.

Referenced by redoLayout(), and redoLines().

Here is the caller graph for this function:

◆ getParentPosition()

bool Engines::NWN::Tooltip::getParentPosition ( float &  x,
float &  y,
float &  z 
) const
private

Definition at line 147 of file tooltip.cpp.

References _parentModel, _parentWidget, Engines::Widget::getPosition(), Graphics::Aurora::Model::getTooltipAnchor(), and GfxMan.

Referenced by updatePosition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSize()

void Engines::NWN::Tooltip::getSize ( float &  width,
float &  height 
)
private

Definition at line 289 of file tooltip.cpp.

References _lineHeight, _lineSpacing, _portrait, _texts, and MAX().

Referenced by redoLayout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hide()

void Engines::NWN::Tooltip::hide ( )

Hide the tooltip again.

Definition at line 275 of file tooltip.cpp.

References _mutex, _timerHide, _timerShow, _visible, doHide(), and TimerMan.

Referenced by addLine(), clearLines(), clearPortrait(), setAlign(), setPortrait(), setPosition(), and ~Tooltip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notifyCameraMoved()

void Engines::NWN::Tooltip::notifyCameraMoved ( )
protectedvirtual

Reimplemented from Events::Notifyable.

Definition at line 143 of file tooltip.cpp.

References updatePosition().

Here is the call graph for this function:

◆ redoBubble()

void Engines::NWN::Tooltip::redoBubble ( )
private

Definition at line 373 of file tooltip.cpp.

References _bubble, _height, _lineHeight, _lineSpacing, _showBubble, _width, Common::UString::c_str(), getBubbleModel(), Engines::loadModelGUI(), Common::ScopedPtrBase< T, Deallocator >::reset(), and warning().

Referenced by redoLayout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ redoLayout()

void Engines::NWN::Tooltip::redoLayout ( )
private

◆ redoLines()

void Engines::NWN::Tooltip::redoLines ( bool  force = false)
private

Definition at line 334 of file tooltip.cpp.

References _font, _height, _lineHeight, _lineSpacing, _showBubble, _showPortrait, _showText, _width, createTexts(), FontMan, getFeedbackMode(), Graphics::Aurora::FontHandle::getFont(), getFontName(), Graphics::Font::getHeight(), Graphics::Font::getLineSpacing(), and redoLayout().

Referenced by addLine(), clearLines(), and show().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAlign()

void Engines::NWN::Tooltip::setAlign ( float  align)

Definition at line 136 of file tooltip.cpp.

References _align, hide(), and redoLayout().

Here is the call graph for this function:

◆ setPortrait()

void Engines::NWN::Tooltip::setPortrait ( const Common::UString image)

Definition at line 125 of file tooltip.cpp.

References _portrait, hide(), Engines::NWN::Portrait::kSizeTiny, and redoLayout().

Here is the call graph for this function:

◆ setPosition()

void Engines::NWN::Tooltip::setPosition ( float  x,
float  y,
float  z 
)

Definition at line 248 of file tooltip.cpp.

References _x, _y, _z, hide(), and updatePosition().

Here is the call graph for this function:

◆ show()

void Engines::NWN::Tooltip::show ( uint32  delay,
uint32  timeOut = 0 
)

Show the tooltip.

Parameters
delayTime in ms to wait before the tooltip appears. If delay is 0, the tooltip will appear immediately.
timeOutTime in ms, after the tooltip appeared, before it will be automatically hidden again. If timeOut is 0, the tooltip will not be automatically hidden at all. To hide it, hide() has to be called.

Definition at line 258 of file tooltip.cpp.

References _empty, _timerHide, _timerShow, _visible, doHide(), doShow(), redoLines(), and TimerMan.

Here is the call graph for this function:

◆ updatePosition()

void Engines::NWN::Tooltip::updatePosition ( )

Definition at line 170 of file tooltip.cpp.

References _align, _bubble, _detectEdge, _empty, _height, _lineHeight, _lineSpacing, _mutex, _offscreen, _portrait, _showBubble, _showPortrait, _texts, _width, _x, _y, _z, doHide(), doShow(), getParentPosition(), MAX(), and WindowMan.

Referenced by notifyCameraMoved(), redoLayout(), and setPosition().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _align

float Engines::NWN::Tooltip::_align
private

Definition at line 109 of file tooltip.h.

Referenced by setAlign(), and updatePosition().

◆ _bubble

Common::ScopedPtr<Graphics::Aurora::Model> Engines::NWN::Tooltip::_bubble
private

Definition at line 115 of file tooltip.h.

Referenced by doHide(), doShow(), redoBubble(), and updatePosition().

◆ _detectEdge

bool Engines::NWN::Tooltip::_detectEdge
private

Definition at line 140 of file tooltip.h.

Referenced by updatePosition().

◆ _empty

bool Engines::NWN::Tooltip::_empty
private

Definition at line 106 of file tooltip.h.

Referenced by checkEmpty(), doShow(), redoLayout(), show(), and updatePosition().

◆ _font

Common::UString Engines::NWN::Tooltip::_font
private

Definition at line 134 of file tooltip.h.

Referenced by createTexts(), redoLayout(), and redoLines().

◆ _height

float Engines::NWN::Tooltip::_height
private

Definition at line 132 of file tooltip.h.

Referenced by redoBubble(), redoLayout(), redoLines(), and updatePosition().

◆ _lineHeight

float Engines::NWN::Tooltip::_lineHeight
private

Definition at line 128 of file tooltip.h.

Referenced by getSize(), redoBubble(), redoLayout(), redoLines(), and updatePosition().

◆ _lines

std::vector<Line> Engines::NWN::Tooltip::_lines
private

Definition at line 119 of file tooltip.h.

Referenced by addLine(), checkEmpty(), clearLines(), and createTexts().

◆ _lineSpacing

float Engines::NWN::Tooltip::_lineSpacing
private

Definition at line 129 of file tooltip.h.

Referenced by getSize(), redoBubble(), redoLayout(), redoLines(), and updatePosition().

◆ _mutex

Common::Mutex Engines::NWN::Tooltip::_mutex
private

Definition at line 142 of file tooltip.h.

Referenced by doHide(), doShow(), hide(), and updatePosition().

◆ _needCamera

bool Engines::NWN::Tooltip::_needCamera
private

Definition at line 139 of file tooltip.h.

◆ _offscreen

bool Engines::NWN::Tooltip::_offscreen
private

Definition at line 122 of file tooltip.h.

Referenced by doShow(), and updatePosition().

◆ _parentModel

Graphics::Aurora::Model* Engines::NWN::Tooltip::_parentModel
private

Definition at line 104 of file tooltip.h.

Referenced by getParentPosition().

◆ _parentWidget

Widget* Engines::NWN::Tooltip::_parentWidget
private

Definition at line 103 of file tooltip.h.

Referenced by getParentPosition().

◆ _portrait

Common::ScopedPtr<Portrait> Engines::NWN::Tooltip::_portrait
private

Definition at line 117 of file tooltip.h.

Referenced by checkEmpty(), clearPortrait(), doHide(), doShow(), getSize(), setPortrait(), and updatePosition().

◆ _showBubble

bool Engines::NWN::Tooltip::_showBubble
private

Definition at line 112 of file tooltip.h.

Referenced by createTexts(), doShow(), redoBubble(), redoLines(), Tooltip(), and updatePosition().

◆ _showPortrait

bool Engines::NWN::Tooltip::_showPortrait
private

Definition at line 113 of file tooltip.h.

Referenced by createTexts(), doShow(), redoLines(), Tooltip(), and updatePosition().

◆ _showText

bool Engines::NWN::Tooltip::_showText
private

Definition at line 111 of file tooltip.h.

Referenced by doShow(), redoLines(), and Tooltip().

◆ _texts

Common::PtrVector<Graphics::Aurora::Text> Engines::NWN::Tooltip::_texts
private

Definition at line 120 of file tooltip.h.

Referenced by createTexts(), deleteTexts(), doHide(), doShow(), getSize(), and updatePosition().

◆ _timerHide

Events::TimerHandle Engines::NWN::Tooltip::_timerHide
private

Definition at line 137 of file tooltip.h.

Referenced by hide(), and show().

◆ _timerShow

Events::TimerHandle Engines::NWN::Tooltip::_timerShow
private

Definition at line 136 of file tooltip.h.

Referenced by doHide(), hide(), and show().

◆ _type

Type Engines::NWN::Tooltip::_type
private

Definition at line 101 of file tooltip.h.

Referenced by getFeedbackMode().

◆ _visible

bool Engines::NWN::Tooltip::_visible
private

Definition at line 107 of file tooltip.h.

Referenced by doHide(), doShow(), hide(), and show().

◆ _width

float Engines::NWN::Tooltip::_width
private

Definition at line 131 of file tooltip.h.

Referenced by redoBubble(), redoLayout(), redoLines(), and updatePosition().

◆ _x

float Engines::NWN::Tooltip::_x
private

Definition at line 124 of file tooltip.h.

Referenced by setPosition(), and updatePosition().

◆ _y

float Engines::NWN::Tooltip::_y
private

Definition at line 125 of file tooltip.h.

Referenced by setPosition(), and updatePosition().

◆ _z

float Engines::NWN::Tooltip::_z
private

Definition at line 126 of file tooltip.h.

Referenced by setPosition(), and updatePosition().


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