87 lines
2.2 KiB
C
87 lines
2.2 KiB
C
|
|
// 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;
|
||
|
|
class FTableTreeNode;
|
||
|
|
|
||
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
|
|
||
|
|
/** Tooltip for STableTreeView widget. */
|
||
|
|
class STableTreeViewTooltip
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
STableTreeViewTooltip() = delete;
|
||
|
|
|
||
|
|
static TSharedPtr<SToolTip> GetTableTooltip(const FTable& Table);
|
||
|
|
static TSharedPtr<SToolTip> GetColumnTooltip(const FTableColumn& Column);
|
||
|
|
static TSharedPtr<SToolTip> GetRowTooltip(const TSharedPtr<FTableTreeNode> TreeNodePtr);
|
||
|
|
|
||
|
|
private:
|
||
|
|
static void AddGridRow(TSharedPtr<SGridPanel> Grid, int32& Row, const FText& Name, const FText& Value);
|
||
|
|
};
|
||
|
|
|
||
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
|
|
||
|
|
class STableTreeRowToolTip: public IToolTip
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
STableTreeRowToolTip(const TSharedPtr<FTableTreeNode> InTreeNodePtr): TreeNodePtr(InTreeNodePtr) {}
|
||
|
|
virtual ~STableTreeRowToolTip() {}
|
||
|
|
|
||
|
|
virtual TSharedRef<class SWidget> AsWidget()
|
||
|
|
{
|
||
|
|
CreateToolTipWidget();
|
||
|
|
return ToolTipWidget.ToSharedRef();
|
||
|
|
}
|
||
|
|
|
||
|
|
virtual TSharedRef<SWidget> GetContentWidget()
|
||
|
|
{
|
||
|
|
CreateToolTipWidget();
|
||
|
|
return ToolTipWidget->GetContentWidget();
|
||
|
|
}
|
||
|
|
|
||
|
|
virtual void SetContentWidget(const TSharedRef<SWidget>& 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 = STableTreeViewTooltip::GetRowTooltip(TreeNodePtr);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private:
|
||
|
|
TSharedPtr<SToolTip> ToolTipWidget;
|
||
|
|
const TSharedPtr<FTableTreeNode> TreeNodePtr;
|
||
|
|
};
|
||
|
|
|
||
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
|
|
||
|
|
} // namespace Insights
|