-
Notifications
You must be signed in to change notification settings - Fork 1
/
NodeGraphLink.h
99 lines (79 loc) · 2.44 KB
/
NodeGraphLink.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
#ifndef GRAPH_NODE_LINK_H
#define GRAPH_NODE_LINK_H
#include <Urho3D/UI/BorderImage.h>
#include <Urho3D/UI/Button.h>
#include <Urho3D/Container/Vector.h>
using namespace Urho3D;
class NodeGraphLink;
class NodeGraphLinkDest;
class NodeGraphLinkSource : public Button
{
URHO3D_OBJECT(NodeGraphLinkSource, Button);
public:
static void RegisterObject(Context *context);
NodeGraphLinkSource(Context *context);
//NodeGraphLink *CreateLink(NodeGraphLinkDest *target);
void AddLink(NodeGraphLink *link);
void RemoveLink(NodeGraphLinkDest *target);
void RemoveLink(NodeGraphLink *link);
int GetNumLinks();
NodeGraphLink *GetLink(int which);
NodeGraphLink *GetLink(NodeGraphLinkDest *target);
void SetRoot(UIElement *root);
void ClearRoot();
UIElement *GetRoot();
protected:
Vector<SharedPtr<NodeGraphLink>> links_;
UIElement *root_;
};
class NodeGraphLinkDest : public Button
{
URHO3D_OBJECT(NodeGraphLinkDest, Button);
public:
static void RegisterObject(Context *context);
NodeGraphLinkDest(Context *context);
void SetLink(NodeGraphLink *link);
void ClearLink();
NodeGraphLink *GetLink();
protected:
WeakPtr<NodeGraphLink> link_;
};
class NodeGraphLink : public Object
{
URHO3D_OBJECT(NodeGraphLink, Object);
public:
static void RegisterObject(Context *context);
NodeGraphLink(Context *context);
void SetSource(NodeGraphLinkSource *src);
void ClearSource();
void SetTarget(NodeGraphLinkDest *dest);
void ClearTarget();
NodeGraphLinkSource *GetSource()
{
return source_;
}
NodeGraphLinkDest *GetTarget()
{
return target_;
}
//void GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor);
void GetBatch(UIBatch &batch);
void SetImageRect(IntRect &rect);
protected:
NodeGraphLinkSource *source_;
NodeGraphLinkDest *target_;
IntRect imageRect_;
};
class NodeGraphLinkPane : public BorderImage
{
URHO3D_OBJECT(NodeGraphLinkPane, BorderImage);
public:
static void RegisterObject(Context *context);
NodeGraphLinkPane(Context *context);
NodeGraphLink *CreateLink(NodeGraphLinkSource *source, NodeGraphLinkDest *target);
void RemoveLink(NodeGraphLink *link);
virtual void GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor) override;
protected:
Vector<SharedPtr<NodeGraphLink>> links_;
};
#endif