OpenCPN Partial API docs
Loading...
Searching...
No Matches
TooltipManager Class Reference

Coordinates tooltip display across OpenCPN components. More...

#include <tooltip.h>

Public Member Functions

void ShowTooltipForWindow (wxWindow *window, const wxString &text, bool hiviz=false)
 Show tooltip for a window using automatic positioning relative to the window.
 
void ShowTooltipAtPosition (wxWindow *parent, const wxString &text, const wxPoint &position, bool hiviz=false)
 Show tooltip at specified position in absolute screen coordinates (physical pixels).
 
void HideTooltip ()
 Hide the current tooltip.
 
void HideAllTooltips ()
 Hide all tooltips.
 
void SetColorScheme (ColorScheme cs)
 Set color scheme for all tooltips.
 
void EnableTooltips (bool enable)
 Enable or disable tooltip system.
 
bool AreTooltipsEnabled () const
 Check if tooltips are enabled.
 
bool IsShown () const
 Check if a tooltip is currently shown.
 
void SetShowDelay (int ms)
 Set delay before showing tooltips.
 
void SetHideDelay (int ms)
 Set delay before hiding tooltips.
 

Static Public Member Functions

static TooltipManagerGet ()
 Get the singleton instance.
 

Detailed Description

Coordinates tooltip display across OpenCPN components.

Ensures only one tooltip is shown at a time.

Developer usage:

  1. Standard UI widgets (buttons, checkboxes, dropdowns, etc.): Keep using: widget->SetToolTip("Help text"); These work automatically with existing wxWidgets tooltip system.
  2. Chart canvas and custom-drawn widgets: Use: TooltipManager::Get().ShowTooltipAtPosition(parent, "Text", screenPosition); Required for widgets that don't use standard wxWidgets painting, such as ChartCanvas where charts are rendered directly to device context.
    • screenPosition: Absolute screen coordinates (physical pixels)
    • Use wxGetMousePosition() to show tooltip at current mouse cursor

Definition at line 140 of file tooltip.h.

Member Function Documentation

◆ AreTooltipsEnabled()

bool TooltipManager::AreTooltipsEnabled ( ) const
inline

Check if tooltips are enabled.

Definition at line 183 of file tooltip.h.

◆ EnableTooltips()

void TooltipManager::EnableTooltips ( bool  enable)

Enable or disable tooltip system.

Definition at line 380 of file tooltip.cpp.

◆ Get()

TooltipManager & TooltipManager::Get ( )
static

Get the singleton instance.

Definition at line 308 of file tooltip.cpp.

◆ HideAllTooltips()

void TooltipManager::HideAllTooltips ( )

Hide all tooltips.

Definition at line 368 of file tooltip.cpp.

◆ HideTooltip()

void TooltipManager::HideTooltip ( )

Hide the current tooltip.

Definition at line 362 of file tooltip.cpp.

◆ IsShown()

bool TooltipManager::IsShown ( ) const

Check if a tooltip is currently shown.

Definition at line 387 of file tooltip.cpp.

◆ SetColorScheme()

void TooltipManager::SetColorScheme ( ColorScheme  cs)

Set color scheme for all tooltips.

Definition at line 373 of file tooltip.cpp.

◆ SetHideDelay()

void TooltipManager::SetHideDelay ( int  ms)
inline

Set delay before hiding tooltips.

Definition at line 191 of file tooltip.h.

◆ SetShowDelay()

void TooltipManager::SetShowDelay ( int  ms)
inline

Set delay before showing tooltips.

Definition at line 189 of file tooltip.h.

◆ ShowTooltipAtPosition()

void TooltipManager::ShowTooltipAtPosition ( wxWindow *  parent,
const wxString &  text,
const wxPoint &  position,
bool  hiviz = false 
)

Show tooltip at specified position in absolute screen coordinates (physical pixels).

Position (0,0) represents the top-left corner of the primary display. All coordinates are in physical pixels, which may differ from logical pixels on high-DPI displays. Use this when you need precise control over tooltip placement.

Parameters
parentParent window for the tooltip
textText to display in the tooltip
positionAbsolute screen position in physical pixels where tooltip should appear
hivizEnable high visibility mode for better contrast

Definition at line 315 of file tooltip.cpp.

◆ ShowTooltipForWindow()

void TooltipManager::ShowTooltipForWindow ( wxWindow *  window,
const wxString &  text,
bool  hiviz = false 
)

Show tooltip for a window using automatic positioning relative to the window.

The tooltip is positioned automatically next to the window (typically to the right) with automatic screen boundary detection. This is the recommended method for most use cases.

Parameters
windowWindow to show tooltip for (position calculated automatically)
textText to display in the tooltip
hivizEnable high visibility mode for better contrast

Definition at line 338 of file tooltip.cpp.


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