// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Widgets/IToolTip.h" #include "Widgets/SToolTip.h" class SGridPanel; namespace Insights { class FTable; class FTableColumn; } // namespace Insights class FTimerNode; //////////////////////////////////////////////////////////////////////////////////////////////////// /** Timers View Tooltip */ class STimersViewTooltip { public: STimersViewTooltip() = delete; static TSharedPtr GetTableTooltip(const Insights::FTable& Table); static TSharedPtr GetColumnTooltip(const Insights::FTableColumn& Column); static TSharedPtr GetRowTooltip(const TSharedPtr TreeNodePtr); private: static void AddStatsRow(TSharedPtr Grid, int32& Row, const FText& Name, const FText& Value1, const FText& Value2); }; //////////////////////////////////////////////////////////////////////////////////////////////////// class STimerTableRowToolTip: public IToolTip { public: STimerTableRowToolTip(const TSharedPtr InTreeNodePtr): TreeNodePtr(InTreeNodePtr) {} virtual ~STimerTableRowToolTip() {} virtual TSharedRef AsWidget() { CreateToolTipWidget(); return ToolTipWidget.ToSharedRef(); } virtual TSharedRef GetContentWidget() { CreateToolTipWidget(); return ToolTipWidget->GetContentWidget(); } virtual void SetContentWidget(const TSharedRef& InContentWidget) { CreateToolTipWidget(); ToolTipWidget->SetContentWidget(InContentWidget); } void InvalidateWidget() { ToolTipWidget.Reset(); } virtual bool IsEmpty() const { return false; } virtual bool IsInteractive() const { return false; } virtual void OnOpening() {} virtual void OnClosed() {} private: void CreateToolTipWidget() { if (!ToolTipWidget.IsValid()) { ToolTipWidget = STimersViewTooltip::GetRowTooltip(TreeNodePtr); } } private: TSharedPtr ToolTipWidget; const TSharedPtr TreeNodePtr; }; ////////////////////////////////////////////////////////////////////////////////////////////////////