-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathClassInstanceNode.cs
More file actions
86 lines (68 loc) · 2.25 KB
/
ClassInstanceNode.cs
File metadata and controls
86 lines (68 loc) · 2.25 KB
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
using System;
using System.Drawing;
using ReClassNET.Controls;
using ReClassNET.UI;
namespace ReClassNET.Nodes
{
public class ClassInstanceNode : BaseClassWrapperNode
{
public override int MemorySize => InnerNode.MemorySize;
protected override bool PerformCycleCheck => true;
public override void GetUserInterfaceInfo(out string name, out Image icon)
{
name = "Class Instance";
icon = Properties.Resources.B16x16_Button_Class_Instance;
}
public override Size Draw(DrawContext context, int x, int y)
{
if (IsHidden && !IsWrapped)
{
return DrawHidden(context, x, y);
}
var origX = x;
var origY = y;
AddSelection(context, x, y, context.Font.Height);
x = AddOpenCloseIcon(context, x, y);
x = AddIcon(context, x, y, context.IconProvider.Class, HotSpot.NoneId, HotSpotType.None);
var tx = x;
x = AddAddressOffset(context, x, y);
x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Instance") + context.Font.Width;
if (!IsWrapped)
{
x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width;
}
x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + context.Font.Width;
x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeClassType) + context.Font.Width;
x = AddComment(context, x, y);
DrawInvalidMemoryIndicatorIcon(context, y);
AddContextDropDownIcon(context, y);
AddDeleteIcon(context, y);
y += context.Font.Height;
var size = new Size(x - origX, y - origY);
if (LevelsOpen[context.Level])
{
var innerContext = context.Clone();
innerContext.Address = context.Address + Offset;
innerContext.Memory = context.Memory.Clone();
innerContext.Memory.Offset += Offset;
var innerSize = InnerNode.Draw(innerContext, tx, y);
size.Width = Math.Max(size.Width, innerSize.Width + tx - origX);
size.Height += innerSize.Height;
}
return size;
}
public override int CalculateDrawnHeight(DrawContext context)
{
if (IsHidden && !IsWrapped)
{
return HiddenHeight;
}
var height = context.Font.Height;
if (LevelsOpen[context.Level])
{
height += InnerNode.CalculateDrawnHeight(context);
}
return height;
}
}
}