Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IObservableNode.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.Input;
6 
7 namespace SiliconStudio.Presentation.Quantum
8 {
9  public interface IObservableNode
10  {
11  /// <summary>
12  /// Gets the <see cref="ObservableViewModel"/> that owns this node.
13  /// </summary>
14  ObservableViewModel Owner { get; }
15 
16  /// <summary>
17  /// Gets or sets the name of this node. Note that the name can be used to access this node from its parent using a dynamic object.
18  /// </summary>
19  string Name { get; }
20 
21  /// <summary>
22  /// Gets or sets the name used to display the node to the user.
23  /// </summary>
24  string DisplayName { get; set; }
25 
26  /// <summary>
27  /// Gets the path of this node. The path is constructed from the name of all node from the root to this one, separated by periods.
28  /// </summary>
29  string Path { get; }
30 
31  /// <summary>
32  /// Gets or the parent of this node.
33  /// </summary>
34  IObservableNode Parent { get; }
35 
36  /// <summary>
37  /// Gets the root of this node.
38  /// </summary>
39  IObservableNode Root { get; }
40 
41  /// <summary>
42  /// Gets the expected type of <see cref="Value"/>.
43  /// </summary>
44  Type Type { get; }
45 
46  /// <summary>
47  /// Gets or sets whether this node should be displayed in the view.
48  /// </summary>
49  bool IsVisible { get; set; }
50 
51  /// <summary>
52  /// Gets or sets whether this node can be modified in the view.
53  /// </summary>
54  bool IsReadOnly { get; set; }
55 
56  /// <summary>
57  /// Gets whether this node contains a primitive value. A primitive value has no children node and does not need to refresh its hierarchy when its value is modified.
58  /// </summary>
59  bool IsPrimitive { get; }
60 
61  /// <summary>
62  /// Gets or sets the value.
63  /// </summary>
64  object Value { get; set; }
65 
66  /// <summary>
67  /// Gets or sets the index of this node, relative to its parent node when its contains a collection. Can be null of this node is not in a collection.
68  /// </summary>
69  object Index { get; }
70 
71  /// <summary>
72  /// Gets a unique identifier associated to this node.
73  /// </summary>
74  Guid Guid { get; }
75 
76  /// <summary>
77  /// Gets the list of children nodes.
78  /// </summary>
79  IReadOnlyCollection<IObservableNode> Children { get; }
80 
81  /// <summary>
82  /// Gets the list of commands available in this node.
83  /// </summary>
85 
86  /// <summary>
87  /// Gets additional data associated to this content. This can be used when the content itself does not contain enough information to be used as a view model.
88  /// </summary>
89  IDictionary<string, object> AssociatedData { get; }
90 
91  /// <summary>
92  /// Gets the order number of this node in its parent.
93  /// </summary>
94  int? Order { get; }
95 
96  /// <summary>
97  /// Gets whether this node contains a list
98  /// </summary>
99  bool HasList { get; }
100 
101  /// <summary>
102  /// Gets whether this node contains a dictionary
103  /// </summary>
104  bool HasDictionary { get; }
105 
106  /// <summary>
107  /// Returns the child node with the matching name.
108  /// </summary>
109  /// <param name="name">The name of the <see cref="ObservableNode"/> to look for.</param>
110  /// <returns>The corresponding child node, or <c>null</c> if no child with the given name exists.</returns>
111  ObservableNode GetChild(string name);
112 
113  /// <summary>
114  /// Returns the command with the matching name.
115  /// </summary>
116  /// <param name="name">The name of the command to look for.</param>
117  /// <returns>The corresponding command, or <c>null</c> if no command with the given name exists.</returns>
118  ICommand GetCommand(string name);
119 
120  /// <summary>
121  /// Indicates whether this node can be moved.
122  /// </summary>
123  /// <param name="newParent">The new parent of the node once moved.</param>
124  /// <returns><c>true</c> if the node can be moved, <c>fals</c> otherwise.</returns>
125  bool CanMove(IObservableNode newParent);
126 
127  /// <summary>
128  /// Moves the node by setting it a new parent.
129  /// </summary>
130  /// <param name="newParent">The new parent of the node once moved.</param>
131  /// <param name="newName">The new name to give to the node once moved. This will modify its path. If <c>null</c>, it does not modify the name.</param>
132  void Move(IObservableNode newParent, string newName = null);
133  }
134 }