1
2
3
4
5
6 using System;
7
8 namespace System.Windows
9 {
10 public abstract class Component
11 {
12 public nothrow Component() : container(null), nextSibling(null), prevSibling(null)
13 {
14 }
15 public virtual ~Component()
16 {
17 }
18 public inline nothrow Container* GetContainer() const
19 {
20 return container;
21 }
22 internal nothrow void SetContainer(Container* container_)
23 {
24 container = container_;
25 }
26 public inline nothrow Component* NextSibling() const
27 {
28 return nextSibling;
29 }
30 internal nothrow void SetNextSibling(Component* nextSibling_)
31 {
32 nextSibling = nextSibling_;
33 }
34 public inline nothrow Component* PrevSibling() const
35 {
36 return prevSibling;
37 }
38 internal nothrow void SetPrevSibling(Component* prevSibling_)
39 {
40 prevSibling = prevSibling_;
41 }
42 internal nothrow void LinkBefore(Component* component)
43 {
44 if (prevSibling != null)
45 {
46 prevSibling->nextSibling = component;
47 }
48 component->prevSibling = prevSibling;
49 component->nextSibling = this;
50 prevSibling = component;
51 }
52 internal nothrow void LinkAfter(Component* component)
53 {
54 if (nextSibling != null)
55 {
56 nextSibling->prevSibling = component;
57 }
58 component->prevSibling = this;
59 component->nextSibling = nextSibling;
60 nextSibling = component;
61 }
62 internal nothrow void Unlink()
63 {
64 if (prevSibling != null)
65 {
66 prevSibling->nextSibling = nextSibling;
67 }
68 if (nextSibling != null)
69 {
70 nextSibling->prevSibling = prevSibling;
71 }
72 }
73 private Container* container;
74 private Component* nextSibling;
75 private Component* prevSibling;
76 }
77 }