aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-12 17:17:05 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-08-12 17:17:05 +0200
commit86acbb4902a25100a183da7ce9e7a5662de8b4cb (patch)
tree6fb2b3897704267d3fdb5b260df51b29135577f2 /src/GraphicObjects
parented815a31113235890cf6c902c754fb3dc7536708 (diff)
default template searched in embedded resources with .template extension
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/AnalogMeter.cs1
-rw-r--r--src/GraphicObjects/Button.cs7
-rw-r--r--src/GraphicObjects/CheckBox.cs1
-rw-r--r--src/GraphicObjects/ComboBox.cs1
-rw-r--r--src/GraphicObjects/DirectoryView.cs1
-rw-r--r--src/GraphicObjects/DummyTemplate.cs1
-rw-r--r--src/GraphicObjects/Expandable.cs1
-rw-r--r--src/GraphicObjects/GroupBox.cs1
-rw-r--r--src/GraphicObjects/ListBox.cs1
-rw-r--r--src/GraphicObjects/MessageBox.cs1
-rw-r--r--src/GraphicObjects/Popper.cs1
-rw-r--r--src/GraphicObjects/RadioButton.cs1
-rw-r--r--src/GraphicObjects/ScrollBar.cs1
-rw-r--r--src/GraphicObjects/Spinner.cs1
-rw-r--r--src/GraphicObjects/TabItem.cs1
-rw-r--r--src/GraphicObjects/TemplatedControl.cs26
-rw-r--r--src/GraphicObjects/TreeView.cs1
-rw-r--r--src/GraphicObjects/Window.cs1
18 files changed, 6 insertions, 43 deletions
diff --git a/src/GraphicObjects/AnalogMeter.cs b/src/GraphicObjects/AnalogMeter.cs
index 80e0e850..1d60850c 100644
--- a/src/GraphicObjects/AnalogMeter.cs
+++ b/src/GraphicObjects/AnalogMeter.cs
@@ -5,7 +5,6 @@ using Cairo;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.AnalogMeter0.goml")]
public class AnalogMeter : NumericControl
{
#region CTOR
diff --git a/src/GraphicObjects/Button.cs b/src/GraphicObjects/Button.cs
index 92238e69..59762182 100644
--- a/src/GraphicObjects/Button.cs
+++ b/src/GraphicObjects/Button.cs
@@ -12,7 +12,6 @@ using System.ComponentModel;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.Button.crow")]
public class Button : TemplatedContainer
{
string caption;
@@ -74,7 +73,7 @@ namespace Crow
}
#endregion
- [XmlAttributeAttribute()][DefaultValue("Button")]
+ [XmlAttributeAttribute][DefaultValue("Button")]
public string Caption {
get { return caption; }
set {
@@ -84,7 +83,7 @@ namespace Crow
NotifyValueChanged ("Caption", caption);
}
}
- [XmlAttributeAttribute()][DefaultValue("#Crow.Images.button.svg")]
+ [XmlAttributeAttribute][DefaultValue("#Crow.Images.button.svg")]
public string Image {
get { return image; }
set {
@@ -94,7 +93,7 @@ namespace Crow
NotifyValueChanged ("Image", image);
}
}
- [XmlAttributeAttribute()][DefaultValue(false)]
+ [XmlAttributeAttribute][DefaultValue(false)]
public bool IsPressed
{
get { return isPressed; }
diff --git a/src/GraphicObjects/CheckBox.cs b/src/GraphicObjects/CheckBox.cs
index 61b581ed..46d77e76 100644
--- a/src/GraphicObjects/CheckBox.cs
+++ b/src/GraphicObjects/CheckBox.cs
@@ -25,7 +25,6 @@ using System.Xml.Serialization;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.CheckBox.goml")]
public class CheckBox : TemplatedControl
{
string caption;
diff --git a/src/GraphicObjects/ComboBox.cs b/src/GraphicObjects/ComboBox.cs
index d2b0567e..becee3ce 100644
--- a/src/GraphicObjects/ComboBox.cs
+++ b/src/GraphicObjects/ComboBox.cs
@@ -24,7 +24,6 @@ using System.Xml.Serialization;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.ComboBox.goml")]
public class ComboBox : ListBox
{
#region CTOR
diff --git a/src/GraphicObjects/DirectoryView.cs b/src/GraphicObjects/DirectoryView.cs
index ac53ee8b..586b1b26 100644
--- a/src/GraphicObjects/DirectoryView.cs
+++ b/src/GraphicObjects/DirectoryView.cs
@@ -25,7 +25,6 @@ using System.IO;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.DirectoryView.crow")]
public class DirectoryView : TemplatedControl
{
#region CTOR
diff --git a/src/GraphicObjects/DummyTemplate.cs b/src/GraphicObjects/DummyTemplate.cs
index 68597d18..891499ff 100644
--- a/src/GraphicObjects/DummyTemplate.cs
+++ b/src/GraphicObjects/DummyTemplate.cs
@@ -22,7 +22,6 @@ using System;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.Dummy.goml")]
public class DummyTemplate : TemplatedControl
{
public DummyTemplate () : base()
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs
index 819987eb..059cab8b 100644
--- a/src/GraphicObjects/Expandable.cs
+++ b/src/GraphicObjects/Expandable.cs
@@ -25,7 +25,6 @@ using System.Xml.Serialization;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.Expandable.goml")]
public class Expandable : TemplatedContainer
{
#region CTOR
diff --git a/src/GraphicObjects/GroupBox.cs b/src/GraphicObjects/GroupBox.cs
index 886e7964..db457282 100644
--- a/src/GraphicObjects/GroupBox.cs
+++ b/src/GraphicObjects/GroupBox.cs
@@ -25,7 +25,6 @@ using System.ComponentModel;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.GroupBox.goml")]
public class GroupBox : TemplatedContainer
{
string caption;
diff --git a/src/GraphicObjects/ListBox.cs b/src/GraphicObjects/ListBox.cs
index ab349ed4..e1b82f19 100644
--- a/src/GraphicObjects/ListBox.cs
+++ b/src/GraphicObjects/ListBox.cs
@@ -30,7 +30,6 @@ using System.Threading;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.ListBox.goml")]
public class ListBox : TemplatedControl
{
#region CTOR
diff --git a/src/GraphicObjects/MessageBox.cs b/src/GraphicObjects/MessageBox.cs
index 550f5b72..dbca769d 100644
--- a/src/GraphicObjects/MessageBox.cs
+++ b/src/GraphicObjects/MessageBox.cs
@@ -23,7 +23,6 @@ using System.ComponentModel;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.MessageBox.goml")]
public class MessageBox : Window
{
public MessageBox ():base(){}
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index ea11435a..029a9837 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -26,7 +26,6 @@ using OpenTK.Input;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.Popper.goml")]
public class Popper : TemplatedContainer
{
#region CTOR
diff --git a/src/GraphicObjects/RadioButton.cs b/src/GraphicObjects/RadioButton.cs
index 35c96c30..ede16475 100644
--- a/src/GraphicObjects/RadioButton.cs
+++ b/src/GraphicObjects/RadioButton.cs
@@ -25,7 +25,6 @@ using System.Xml.Serialization;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.RadioButton.goml")]
public class RadioButton : TemplatedControl
{
string caption;
diff --git a/src/GraphicObjects/ScrollBar.cs b/src/GraphicObjects/ScrollBar.cs
index 017b50ac..5660c00b 100644
--- a/src/GraphicObjects/ScrollBar.cs
+++ b/src/GraphicObjects/ScrollBar.cs
@@ -5,7 +5,6 @@ using OpenTK.Input;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.ScrollBar.goml")]
public class ScrollBar : NumericControl
{
Orientation _orientation;
diff --git a/src/GraphicObjects/Spinner.cs b/src/GraphicObjects/Spinner.cs
index 0806d4d3..7fc34ae8 100644
--- a/src/GraphicObjects/Spinner.cs
+++ b/src/GraphicObjects/Spinner.cs
@@ -22,7 +22,6 @@ using System;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.Spinner.goml")]
public class Spinner : NumericControl
{
#region CTOR
diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs
index 2d2ba453..c06a43a9 100644
--- a/src/GraphicObjects/TabItem.cs
+++ b/src/GraphicObjects/TabItem.cs
@@ -25,7 +25,6 @@ using System.Diagnostics;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.TabItem.crow")]
public class TabItem : TemplatedContainer
{
#region Private fields
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs
index 422a45ec..4745b87b 100644
--- a/src/GraphicObjects/TemplatedControl.cs
+++ b/src/GraphicObjects/TemplatedControl.cs
@@ -31,27 +31,6 @@ using System.Reflection;
namespace Crow
{
- [AttributeUsage(AttributeTargets.Class)]
- public class TemplateAttribute : Attribute
- {
- public string Path = "";
- public TemplateAttribute(string path)
- {
- Path = path;
- }
- }
-
- [AttributeUsage(AttributeTargets.Class)]
- public class DefaultTemplate : TemplateAttribute
- {
- public DefaultTemplate(string path) : base(path){}
- }
- [AttributeUsage(AttributeTargets.Class)]
- public class DefaultItemTemplate : TemplateAttribute
- {
- public DefaultItemTemplate(string path) : base(path){}
- }
-
public abstract class TemplatedControl : PrivateContainer, IXmlSerializable
{
#region CTOR
@@ -116,8 +95,9 @@ namespace Crow
protected virtual void loadTemplate(GraphicObject template = null)
{
if (template == null) {
- DefaultTemplate dt = (DefaultTemplate)this.GetType ().GetCustomAttributes (typeof(DefaultTemplate), true).FirstOrDefault();
- this.SetChild (Interface.Load (dt.Path));
+ if (!Interface.DefaultTemplates.ContainsKey (this.GetType ().FullName))
+ throw new Exception (string.Format ("No default template found for '{0}'", this.GetType ().FullName));
+ this.SetChild (Interface.Load (Interface.DefaultTemplates[this.GetType ().FullName]));
}else
this.SetChild (template);
diff --git a/src/GraphicObjects/TreeView.cs b/src/GraphicObjects/TreeView.cs
index 51080281..b7de4b69 100644
--- a/src/GraphicObjects/TreeView.cs
+++ b/src/GraphicObjects/TreeView.cs
@@ -27,7 +27,6 @@ namespace Crow
{
//treeview expect expandable child (or not)
//if their are expandable, some functions and events are added
- [DefaultTemplate("#Crow.Templates.TreeView.crow")]
public class TreeView : ListBox
{
GraphicObject selectedItemContainer = null;
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs
index be482e43..9fb6bd29 100644
--- a/src/GraphicObjects/Window.cs
+++ b/src/GraphicObjects/Window.cs
@@ -26,7 +26,6 @@ using System.Diagnostics;
namespace Crow
{
- [DefaultTemplate("#Crow.Templates.Window.goml")]
public class Window : TemplatedContainer
{
enum Direction