Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ITemplateProvider.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections.Generic;
5 using System.Windows;
6 
7 namespace SiliconStudio.Presentation.View
8 {
9  /// <summary>
10  /// This enum describes how an <see cref="ITemplateProvider"/> should override other providers that matches the same object.
11  /// </summary>
12  public enum OverrideRule
13  {
14  /// <summary>
15  /// The <see cref="ITemplateProvider"/> will override providers whose name is in its <see cref="ITemplateProvider.OverriddenProviderNames"/> collection.
16  /// </summary>
17  Some,
18  /// <summary>
19  /// The <see cref="ITemplateProvider"/> will never override other providers.
20  /// </summary>
21  None,
22  /// <summary>
23  /// The <see cref="ITemplateProvider"/> will override other providers unless they have the <see cref="All"/> or <see cref="Most"/> rule, or they have the <see cref="Some"/> rule and override this provider specifically.
24  /// </summary>
25  Most,
26  /// <summary>
27  /// The <see cref="ITemplateProvider"/> will always override other providers.
28  /// </summary>
29  All,
30  }
31 
32  /// <summary>
33  /// An interface for a class that can provide a template for a given object that matches some prerequisites.
34  /// </summary>
35  public interface ITemplateProvider : IComparable<ITemplateProvider>
36  {
37  /// <summary>
38  /// Gets an identifier name for this instance of <see cref="ITemplateProvider"/>.
39  /// </summary>
40  string Name { get; }
41 
42  /// <summary>
43  /// Gets or sets the template associated with this <see cref="ITemplateProvider"/>
44  /// </summary>
45  DataTemplate Template { get; set; }
46 
47  /// <summary>
48  /// Gets or sets the rule to use when this provider can potentially override other providers that matches the same object.
49  /// </summary>
50  /// <remarks>If two providers should override each other, an exception will be thrown in the related template selector.</remarks>
51  OverrideRule OverrideRule { get; set; }
52 
53  /// <summary>
54  /// Gets the collection of names of <see cref="ITemplateProvider"/> to override when they matches the same object
55  /// than this provider, when <see cref="OverrideRule"/> is <see cref="SiliconStudio.Presentation.View.OverrideRule.Some"/>.
56  /// </summary>
57  List<string> OverriddenProviderNames { get; }
58 
59  /// <summary>
60  /// Indicates whether this instance of <see cref="ITemplateProvider"/> can provide a template for the given object.
61  /// </summary>
62  /// <param name="obj">The object to test.</param>
63  /// <returns><c>true</c> if this template provider can provide a template for the given object, <c>false</c> otherwise.</returns>
64  bool Match(object obj);
65  }
66 }
OverrideRule
This enum describes how an ITemplateProvider should override other providers that matches the same ob...
The ITemplateProvider will override other providers unless they have the All or Most rule...
The ITemplateProvider will override providers whose name is in its ITemplateProvider.OverriddenProviderNames collection.
An interface for a class that can provide a template for a given object that matches some prerequisit...