4 using System.Diagnostics;
6 using SiliconStudio.Core;
7 using SiliconStudio.Core.Mathematics;
9 namespace SiliconStudio.
Paradox.UI.Controls
14 [DebuggerDisplay(
"ContentControl - Name={Name}")]
28 private Matrix contentWorldMatrix;
35 ContentPresenter.Name =
"of '" + Name +
"'";
43 get {
return contentPresenter; }
46 if (value == contentPresenter)
49 VisualContent = value;
50 contentPresenter = value;
60 get {
return content; }
71 if (contentPresenter == null)
72 VisualContent = content;
74 ContentPresenter.Content = value;
88 get {
return visualContent; }
91 if (VisualContent != null)
92 SetVisualParent(VisualContent, null);
94 visualContent = value;
96 if (VisualContent != null)
97 SetVisualParent(visualContent,
this);
106 var childDesiredSizeWithMargins = Vector3.Zero;
107 if (VisualContent != null)
110 var childAvailableSizeWithMargins = CalculateSizeWithoutThickness(ref availableSizeWithoutMargins, ref padding);
112 VisualContent.Measure(childAvailableSizeWithMargins);
113 childDesiredSizeWithMargins = VisualContent.DesiredSizeWithMargins;
117 var desiredSizeWithPadding = CalculateSizeWithThickness(ref childDesiredSizeWithMargins, ref padding);
119 return desiredSizeWithPadding;
125 if (VisualContent != null)
128 var childSizeWithoutPadding = CalculateSizeWithoutThickness(ref finalSizeWithoutMargins, ref padding);
131 VisualContent.Arrange(childSizeWithoutPadding, IsCollapsed);
134 var childOffsets =
new Vector3(Padding.Left, Padding.Top, Padding.Back) - finalSizeWithoutMargins/2;
137 VisualContent.DependencyProperties.Set(ContentArrangeMatrixPropertyKey, Matrix.Translation(childOffsets));
140 return finalSizeWithoutMargins;
145 var contentMatrixChanged = parentWorldChanged || ArrangeChanged || LocalMatrixChanged;
147 base.UpdateWorldMatrix(ref parentWorldMatrix, parentWorldChanged);
149 if (VisualContent != null)
151 if (contentMatrixChanged)
153 var contentMatrix = VisualContent.DependencyProperties.Get(ContentArrangeMatrixPropertyKey);
154 Matrix.Multiply(ref contentMatrix, ref WorldMatrixInternal, out contentWorldMatrix);
157 ((
IUIElementUpdate)VisualContent).UpdateWorldMatrix(ref contentWorldMatrix, contentMatrixChanged);
Provides a base class for all the User Interface elements in Paradox applications.
override Vector3 ArrangeOverride(Vector3 finalSizeWithoutMargins)
When overridden in a derived class, positions possible child elements and determines a size for a UIE...
Represents the base class for user interface (UI) controls.
Interface for the update of the UIElements.
Represents a three dimensional mathematical vector.
override void OnNameChanged()
This method is call when the name of the UIElement changes. This method can be overridden in inherite...
Represents a control with a single piece of content of any type.
override void UpdateWorldMatrix(ref Matrix parentWorldMatrix, bool parentWorldChanged)
Method called by IUIElementUpdate.UpdateWorldMatrix. Parents are in charge of recursively calling thi...
override Vector3 MeasureOverride(Vector3 availableSizeWithoutMargins)
When overridden in a derived class, measures the size in layout required for possible child elements ...
A class aiming at presenting another UIElement.
Only valid for a property / field that has a class or struct type. When restored, instead of recreati...
SiliconStudio.Core.Mathematics.Vector3 Vector3
A class that represents a tag propety.
Represents a 4x4 mathematical matrix.