DDraceNetwork Documentation
Loading...
Searching...
No Matches
CTooltips Class Reference

#include <tooltips.h>

Inheritance diagram for CTooltips:
[legend]
Collaboration diagram for CTooltips:
[legend]

Public Member Functions

 CTooltips ()
int Sizeof () const override
void DoToolTip (const void *pId, const CUIRect *pNearRect, const char *pText, float WidthHint=-1.0f)
void OnReset () override
void OnRender () override
Public Member Functions inherited from CComponent
virtual void OnStateChange (int NewState, int OldState)
virtual void OnConsoleInit ()
virtual void OnInit ()
virtual void OnShutdown ()
virtual void OnWindowResize ()
virtual void OnUpdate ()
virtual void OnNewSnapshot ()
virtual void OnRelease ()
virtual void OnMapLoad ()
virtual void OnMessage (int Msg, void *pRawMsg)
virtual bool OnCursorMove (float x, float y, IInput::ECursorType CursorType)
virtual bool OnInput (const IInput::CEvent &Event)
virtual bool OnTouchState (const std::vector< IInput::CTouchFingerState > &vTouchFingerStates)
Public Member Functions inherited from CComponentInterfaces
virtual void OnInterfacesInit (CGameClient *pClient)
virtual ~CComponentInterfaces ()=default

Private Member Functions

void SetActiveTooltip (CTooltip &Tooltip)
void ClearActiveTooltip ()

Private Attributes

std::unordered_map< uintptr_t, CTooltipm_Tooltips
std::optional< std::reference_wrapper< CTooltip > > m_ActiveTooltip
std::optional< std::reference_wrapper< CTooltip > > m_PreviousTooltip
int64_t m_HoverTime

Additional Inherited Members

Protected Member Functions inherited from CComponentInterfaces
class CGameClientGameClient () const
class IClientClient () const
class IKernelKernel () const
class IEngineEngine () const
class IGraphicsGraphics () const
class ITextRenderTextRender () const
class IInputInput () const
class IStorageStorage () const
class CUiUi () const
class ISoundSound () const
class CRenderToolsRenderTools () const
class CRenderMapRenderMap () const
class IConfigManagerConfigManager () const
class CConfigConfig () const
class IConsoleConsole () const
class IDemoPlayerDemoPlayer () const
class IDemoRecorderDemoRecorder (int Recorder) const
class IFavoritesFavorites () const
class IServerBrowserServerBrowser () const
class CLayersLayers () const
class CCollisionCollision () const
int64_t time () const
float LocalTime () const
class IHttpHttp () const

Detailed Description

A component that manages and renders UI tooltips.

Should be among the last components to render.

Constructor & Destructor Documentation

◆ CTooltips()

CTooltips::CTooltips ( )

Member Function Documentation

◆ ClearActiveTooltip()

void CTooltips::ClearActiveTooltip ( )
inlineprivate

◆ DoToolTip()

void CTooltips::DoToolTip ( const void * pId,
const CUIRect * pNearRect,
const char * pText,
float WidthHint = -1.0f )

Adds the tooltip to a cache and renders it when active.

On the first call to this function, the data passed is cached, afterwards the calls are used to detect if the tooltip should be activated. If multiple tooltips cover the same rect or the rects intersect, then the tooltip that is added later has priority.

Parameters
pIdThe ID of the tooltip. Usually a reference to some g_Config value.
pNearRectPlace the tooltip near this rect.
pTextThe text to display in the tooltip.
WidthHintThe maximum width of the tooltip, or -1.0f for unlimited.

◆ OnRender()

void CTooltips::OnRender ( )
overridevirtual

Called when the component should get rendered.

The render order depends on the component insertion order.

Reimplemented from CComponent.

◆ OnReset()

void CTooltips::OnReset ( )
overridevirtual

Called to reset the component. This method is usually called on your component constructor to avoid code duplication.

See also
CHud::CHud()
CHud::OnReset()

Reimplemented from CComponent.

◆ SetActiveTooltip()

void CTooltips::SetActiveTooltip ( CTooltip & Tooltip)
private
Parameters
TooltipA reference to the tooltip that should be active.

◆ Sizeof()

int CTooltips::Sizeof ( ) const
inlineoverridevirtual

Gets the size of the non-abstract component.

Implements CComponent.

Member Data Documentation

◆ m_ActiveTooltip

std::optional<std::reference_wrapper<CTooltip> > CTooltips::m_ActiveTooltip
private

◆ m_HoverTime

int64_t CTooltips::m_HoverTime
private

◆ m_PreviousTooltip

std::optional<std::reference_wrapper<CTooltip> > CTooltips::m_PreviousTooltip
private

◆ m_Tooltips

std::unordered_map<uintptr_t, CTooltip> CTooltips::m_Tooltips
private

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