aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/Menu.cs56
-rw-r--r--src/GraphicObjects/MenuItem.cs71
-rw-r--r--src/GraphicObjects/TemplatedGroup.cs15
3 files changed, 141 insertions, 1 deletions
diff --git a/src/GraphicObjects/Menu.cs b/src/GraphicObjects/Menu.cs
new file mode 100644
index 00000000..561db65c
--- /dev/null
+++ b/src/GraphicObjects/Menu.cs
@@ -0,0 +1,56 @@
+//
+// Menu.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace Crow
+{
+ public class Menu : TemplatedGroup
+ {
+ Orientation orientation;
+
+ [XmlAttributeAttribute()][DefaultValue(Orientation.Horizontal)]
+ public virtual Orientation Orientation {
+ get { return orientation; }
+ set {
+ if (orientation == value)
+ return;
+ orientation = value;
+ NotifyValueChanged ("Orientation", orientation);
+ }
+ }
+
+ public Menu () : base()
+ {
+ }
+
+ public override void AddItem (GraphicObject g)
+ {
+ base.AddItem (g);
+
+ if (orientation == Orientation.Horizontal)
+ g.NotifyValueChanged ("Orientation", Alignment.Bottom);
+ else
+ g.NotifyValueChanged ("Orientation", Alignment.Right);
+ }
+ }
+}
diff --git a/src/GraphicObjects/MenuItem.cs b/src/GraphicObjects/MenuItem.cs
new file mode 100644
index 00000000..591be2b0
--- /dev/null
+++ b/src/GraphicObjects/MenuItem.cs
@@ -0,0 +1,71 @@
+//
+// MenuItem.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace Crow
+{
+ public class MenuItem : TemplatedGroup
+ {
+ #region CTOR
+ public MenuItem () : base() {}
+ #endregion
+
+// public event EventHandler Pop;
+// public event EventHandler Unpop;
+
+ string caption;
+
+ [XmlAttributeAttribute][DefaultValue("MenuItem")]
+ public string Caption {
+ get { return caption; }
+ set {
+ if (caption == value)
+ return;
+ caption = value;
+ NotifyValueChanged ("Caption", caption);
+ }
+ }
+// [XmlIgnore]
+// public virtual Alignment Orientation {
+// get { return Parent is Menu ? (Parent as Menu).Orientation : (Parent as MenuItem); }
+// }
+
+ Menu MenuRoot {
+ get {
+ ILayoutable tmp = Parent;
+ while (tmp != null) {
+ if (tmp is Menu)
+ return tmp as Menu;
+ tmp = tmp.Parent;
+ }
+ return null;
+ }
+ }
+
+ public override void AddItem (GraphicObject g)
+ {
+ base.AddItem (g);
+ g.NotifyValueChanged ("Orientation", Alignment.Right);
+ }
+ }
+}
diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs
index 12448b82..cee4adea 100644
--- a/src/GraphicObjects/TemplatedGroup.cs
+++ b/src/GraphicObjects/TemplatedGroup.cs
@@ -38,7 +38,7 @@ namespace Crow
public virtual void AddItem(GraphicObject g){
items.AddChild (g);
- g.LogicalParent = this;
+ //g.LogicalParent = this;
}
public virtual void RemoveItem(GraphicObject g)
{
@@ -82,6 +82,19 @@ namespace Crow
}
return false;
}
+// public override void ClearBinding ()
+// {
+// if (items != null)
+// items.ClearBinding ();
+//
+// base.ClearBinding ();
+// }
+// public override void ResolveBindings ()
+// {
+// base.ResolveBindings ();
+// if (items != null)
+// items.ResolveBindings ();
+// }
#endregion
#region IXmlSerialisation Overrides