-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathSJavascriptGraphNodeComment.h
124 lines (93 loc) · 4.4 KB
/
SJavascriptGraphNodeComment.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Styling/SlateColor.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Layout/SlateRect.h"
#include "Input/Reply.h"
#include "SNodePanel.h"
#include "SGraphNodeResizable.h"
#include "JavascriptGraphEdNode_Comment.h"
class SCommentBubble;
class SJavascriptGraphNodeComment : public SGraphNodeResizable
{
public:
SLATE_BEGIN_ARGS(SJavascriptGraphNodeComment) {}
SLATE_END_ARGS()
//~ Begin SWidget Interface
virtual FReply OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent) override;
virtual FReply OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
virtual FReply OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
virtual void OnDragEnter(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) override;
//~ End SWidget Interface
//~ Begin SNodePanel::SNode Interface
virtual const FSlateBrush* GetShadowBrush(bool bSelected) const override;
virtual void GetOverlayBrushes(bool bSelected, const FVector2D WidgetSize, TArray<FOverlayBrushInfo>& Brushes) const override;
virtual bool ShouldAllowCulling() const override { return false; }
virtual int32 GetSortDepth() const override;
virtual void EndUserInteraction() const override;
virtual FString GetNodeComment() const override;
//~ End SNodePanel::SNode Interface
//~ Begin SPanel Interface
virtual FVector2D ComputeDesiredSize(float) const override;
//~ End SPanel Interface
//~ Begin SGraphNode Interface
virtual bool IsNameReadOnly() const override;
virtual FSlateColor GetCommentColor() const override { return GetCommentBodyColor(); }
//~ End SGraphNode Interface
void Construct(const FArguments& InArgs, UJavascriptGraphEdNode_Comment* InNode);
/** return if the node can be selected, by pointing given location */
virtual bool CanBeSelected(const FVector2D& MousePositionInNode) const override;
/** return size of the title bar */
virtual FVector2D GetDesiredSizeForMarquee() const override;
/** return rect of the title bar */
virtual FSlateRect GetTitleRect() const override;
protected:
//~ Begin SGraphNode Interface
virtual void UpdateGraphNode() override;
virtual void PopulateMetaTag(class FGraphNodeMetaData* TagMeta) const override;
/**
* Helper method to update selection state of comment and any nodes 'contained' within it
* @param bSelected If true comment is being selected, false otherwise
* @param bUpdateNodesUnderComment If true then force the rebuild of the list of nodes under the comment
*/
void HandleSelection(bool bIsSelected, bool bUpdateNodesUnderComment = false) const;
/** Helper function to determine if a node is under this comment widget or not */
virtual bool IsNodeUnderComment(UJavascriptGraphEdNode_Comment* InCommentNode, const TSharedRef<SGraphNode> InNodeWidget) const;
/** called when user is moving the comment node */
virtual void MoveTo(const FVector2D& NewPosition, FNodeSet& NodeFilter, bool bMarkDirty = true) override;
//~ Begin SGraphNodeResizable Interface
virtual float GetTitleBarHeight() const override;
virtual FSlateRect GetHitTestingBorder() const override;
virtual FVector2D GetNodeMaximumSize() const override;
//~ Begin SGraphNodeResizable Interface
private:
/** @return the color to tint the comment body */
FSlateColor GetCommentBodyColor() const;
/** @return the color to tint the title bar */
FSlateColor GetCommentTitleBarColor() const;
/** @return the color to tint the comment bubble */
FSlateColor GetCommentBubbleColor() const;
/** Returns the width to wrap the text of the comment at */
float GetWrapAt() const;
private:
/** The comment bubble widget (used when zoomed out) */
TSharedPtr<SCommentBubble> CommentBubble;
/** Was the bubble desired to be visible last frame? */
mutable bool bCachedBubbleVisibility;
/** The current selection state of the comment */
mutable bool bIsSelected;
/** the title bar, needed to obtain it's height */
TSharedPtr<SBorder> TitleBar;
protected:
/** cached comment title */
FString CachedCommentTitle;
private:
/** cached comment title */
int32 CachedWidth;
/** cached font size */
int32 CachedFontSize;
/** Local copy of the comment style */
FInlineEditableTextBlockStyle CommentStyle;
};