1 | using System;
|
---|
2 | using System.Xml;
|
---|
3 |
|
---|
4 | using SharpVectors.Dom.Css;
|
---|
5 |
|
---|
6 | namespace SharpVectors.Dom.Svg
|
---|
7 | {
|
---|
8 | public sealed class SvgLinearGradientElement : SvgGradientElement, ISvgLinearGradientElement
|
---|
9 | {
|
---|
10 | private ISvgAnimatedLength x1;
|
---|
11 | private ISvgAnimatedLength y1;
|
---|
12 | private ISvgAnimatedLength x2;
|
---|
13 | private ISvgAnimatedLength y2;
|
---|
14 |
|
---|
15 | public SvgLinearGradientElement(string prefix, string localname, string ns, SvgDocument doc)
|
---|
16 | : base(prefix, localname, ns, doc)
|
---|
17 | {
|
---|
18 | }
|
---|
19 |
|
---|
20 | #region ISvgLinearGradientElement Members
|
---|
21 |
|
---|
22 | public ISvgAnimatedLength X1
|
---|
23 | {
|
---|
24 | get
|
---|
25 | {
|
---|
26 | if (!HasAttribute("x1") && ReferencedElement != null)
|
---|
27 | {
|
---|
28 | return ReferencedElement.X1;
|
---|
29 | }
|
---|
30 | else
|
---|
31 | {
|
---|
32 | if (x1 == null)
|
---|
33 | {
|
---|
34 | x1 = new SvgAnimatedLength(this, "x1", SvgLengthDirection.Horizontal, "0%");
|
---|
35 | }
|
---|
36 |
|
---|
37 | return x1;
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | public ISvgAnimatedLength Y1
|
---|
43 | {
|
---|
44 | get
|
---|
45 | {
|
---|
46 | if (!HasAttribute("y1") && ReferencedElement != null)
|
---|
47 | {
|
---|
48 | return ReferencedElement.Y1;
|
---|
49 | }
|
---|
50 | else
|
---|
51 | {
|
---|
52 |
|
---|
53 | if (y1 == null)
|
---|
54 | {
|
---|
55 | y1 = new SvgAnimatedLength(this, "y1", SvgLengthDirection.Vertical, "0%");
|
---|
56 | }
|
---|
57 |
|
---|
58 | return y1;
|
---|
59 | }
|
---|
60 | }
|
---|
61 | }
|
---|
62 |
|
---|
63 | public ISvgAnimatedLength X2
|
---|
64 | {
|
---|
65 | get
|
---|
66 | {
|
---|
67 | if (!HasAttribute("x2") && ReferencedElement != null)
|
---|
68 | {
|
---|
69 | return ReferencedElement.X2;
|
---|
70 | }
|
---|
71 | else
|
---|
72 | {
|
---|
73 |
|
---|
74 | if (x2 == null)
|
---|
75 | {
|
---|
76 | x2 = new SvgAnimatedLength(this, "x2", SvgLengthDirection.Horizontal, "100%");
|
---|
77 | }
|
---|
78 |
|
---|
79 | return x2;
|
---|
80 | }
|
---|
81 | }
|
---|
82 | }
|
---|
83 |
|
---|
84 | public ISvgAnimatedLength Y2
|
---|
85 | {
|
---|
86 | get
|
---|
87 | {
|
---|
88 | if (!HasAttribute("y2") && ReferencedElement != null)
|
---|
89 | {
|
---|
90 | return ReferencedElement.Y2;
|
---|
91 | }
|
---|
92 | else
|
---|
93 | {
|
---|
94 | if (y2 == null)
|
---|
95 | {
|
---|
96 | y2 = new SvgAnimatedLength(this, "y2", SvgLengthDirection.Vertical, "0%");
|
---|
97 | }
|
---|
98 |
|
---|
99 | return y2;
|
---|
100 | }
|
---|
101 | }
|
---|
102 | }
|
---|
103 | #endregion
|
---|
104 |
|
---|
105 | #region ISvgURIReference Members
|
---|
106 |
|
---|
107 | public new SvgLinearGradientElement ReferencedElement
|
---|
108 | {
|
---|
109 | get
|
---|
110 | {
|
---|
111 | return base.ReferencedElement as SvgLinearGradientElement;
|
---|
112 | }
|
---|
113 | }
|
---|
114 |
|
---|
115 | #endregion
|
---|
116 |
|
---|
117 | #region Update handling
|
---|
118 | /*public override void OnAttributeChange(XmlNodeChangedAction action, XmlAttribute attribute)
|
---|
119 | {
|
---|
120 | base.OnAttributeChange(action, attribute);
|
---|
121 |
|
---|
122 | if(attribute.NamespaceURI.Length == 0)
|
---|
123 | {
|
---|
124 | switch(attribute.LocalName)
|
---|
125 | {
|
---|
126 | case "x1":
|
---|
127 | x1 = null;
|
---|
128 | break;
|
---|
129 | case "y1":
|
---|
130 | y1 = null;
|
---|
131 | break;
|
---|
132 | case "x2":
|
---|
133 | x2 = null;
|
---|
134 | break;
|
---|
135 | case "y2":
|
---|
136 | y2 = null;
|
---|
137 | break;
|
---|
138 | }
|
---|
139 | }
|
---|
140 | }*/
|
---|
141 | #endregion
|
---|
142 | }
|
---|
143 | }
|
---|