4 using System.Collections.Generic;
5 using System.Reflection;
7 using SiliconStudio.Core;
8 using SiliconStudio.Paradox.UI.Controls;
10 namespace SiliconStudio.
Paradox.UI.Renderers
15 internal class DefaultRenderersFactory : IElementRendererFactory
17 private readonly ElementRenderer defaultRenderer;
19 private readonly Dictionary<Type, ElementRenderer> typeToRenderers =
new Dictionary<Type, ElementRenderer>();
23 defaultRenderer =
new ElementRenderer(services);
24 typeToRenderers[typeof(
ImageElement)] =
new DefaultImageRenderer(services);
25 typeToRenderers[typeof(
Button)] =
new DefaultButtonRenderer(services);
26 typeToRenderers[typeof(
ImageButton)] =
new ElementRenderer(services);
27 typeToRenderers[typeof(
ToggleButton)] =
new ElementRenderer(services);
28 typeToRenderers[typeof(
TextBlock)] =
new DefaultTextBlockRenderer(services);
29 typeToRenderers[typeof(
ScrollingText)] =
new DefaultScrollingTextRenderer(services);
30 typeToRenderers[typeof(
ModalElement)] =
new DefaultModalElementRenderer(services);
31 typeToRenderers[typeof(
ScrollBar)] =
new DefaultScrollBarRenderer(services);
32 typeToRenderers[typeof(
EditText)] =
new DefaultEditTextRenderer(services);
33 typeToRenderers[typeof(
ContentDecorator)] =
new DefaultContentDecoratorRenderer(services);
34 typeToRenderers[typeof(
Border)] =
new DefaultBorderRenderer(services);
35 typeToRenderers[typeof(
ToggleButton)] =
new DefaultToggleButtonRenderer(services);
36 typeToRenderers[typeof(
Slider)] =
new DefaultSliderRenderer(services);
39 public ElementRenderer TryCreateRenderer(UIElement element)
42 var currentType = element.GetType();
43 while (currentType != null)
45 if (typeToRenderers.ContainsKey(currentType))
46 return typeToRenderers[currentType];
48 currentType = currentType.GetTypeInfo().BaseType;
51 return defaultRenderer;
A border element adds an uniform color border around its content.
Represents a modal element that puts an overlay upon the underneath elements and freeze their input...
A service registry is a IServiceProvider that provides methods to register and unregister services...
A ContentControl decorating its ContentControl.Content with a background image.
Represents a slider element.
A text viewer that scrolls automatically the text from right to left.
Represents a control that displays an image.
Provides a lightweight control for displaying small amounts of text.
Represent an edit text where the user can enter text.