1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
8
using System.Drawing.Drawing2D;
11
using System.Xml.XPath;
13
using ICSharpCode.SharpDevelop;
14
using ICSharpCode.SharpDevelop.Dom;
15
using ICSharpCode.SharpDevelop.Project;
17
using System.Globalization;
20
using Tools.Diagrams.Drawables;
22
namespace ClassDiagram
24
// TODO - perhaps abandon this base class and implement styles mechanism instead?
25
public class EnumDelegateCanvasItem : ClassCanvasItem
27
public EnumDelegateCanvasItem (IClass ct) : base (ct) {}
29
private InteractiveItemsStack items = new InteractiveItemsStack();
31
public InteractiveItemsStack Items {
35
protected override DrawableRectangle InitContentBackground()
39
int radius = CornerRadius;
40
return new DrawableRectangle(ContentBG, null, 0, 0, radius, 0);
43
return new DrawableRectangle(ContentBG, null, 0, 0, 0, 0);
46
protected override DrawableItemsStack InitContentContainer(params IDrawableRectangle[] items)
48
DrawableItemsStack decorator = new DrawableItemsStack();
49
decorator.OrientationAxis = Axis.X;
50
DrawableRectangle rect;
53
int radius = CornerRadius;
54
rect = new DrawableRectangle(TitleBG, null, 0, 0, 0, radius);
58
rect = new DrawableRectangle(TitleBG, null, 0, 0, 0, 0);
64
decorator.Add(base.InitContentContainer(items));
68
protected override IDrawableRectangle InitContent()
71
items.OrientationAxis = Axis.Y;
76
public class DelegateCanvasItem : EnumDelegateCanvasItem
78
public DelegateCanvasItem (IClass ct) : base (ct) {}
80
static Color titlesBG = Color.FromArgb(255, 237, 219, 221);
81
protected override Color TitleBackground
83
get { return titlesBG; }
86
static Brush contentBG = new SolidBrush(Color.FromArgb(255, 247, 240, 240));
87
protected override Brush ContentBG
89
get { return contentBG; }
92
protected override void PrepareMembersContent()
95
IMethod invokeMethod = RepresentedClassType.SearchMember("Invoke", RepresentedClassType.ProjectContent.Language) as IMethod;
96
IAmbience ambience = GetAmbience();
97
foreach (IParameter par in invokeMethod.Parameters)
99
TextSegment ts = new TextSegment(Graphics, par.Name + " : " + ambience.Convert(par.ReturnType), MemberFont, true);
104
// TODO - remove - for debug only.
105
public override void DrawToGraphics(Graphics graphics)
107
base.DrawToGraphics(graphics);
110
protected override XmlElement CreateXmlElement(XmlDocument doc)
112
return doc.CreateElement("Delegate");
116
public delegate TestEnum TestDelegate (int num, string str);