diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-19 22:44:48 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-09-01 12:44:38 +0200 |
| commit | befffb69eaebf2e607d88cd3ffc956a708d5734e (patch) | |
| tree | 5b28b58db0171f026e1ea3681fb86b005b4f8c81 /src/GraphicObjects/Menu.cs | |
| parent | 9c3fd3b6b218de51177bef7d481e411e365b6ef3 (diff) | |
Menu and MenuItem classes, templates, styles and tests
modifié : Crow.csproj
modifié : Default.style
modifié : Style.cs
nouveau fichier : Templates/Menu.template
nouveau fichier : Templates/MenuItem.template
modifié : Tests/Interfaces/TemplatedGroup/0.crow
nouveau fichier : Tests/Interfaces/TemplatedGroup/1.crow
nouveau fichier : Tests/Interfaces/TemplatedGroup/2.crow
modifié : Tests/Tests.csproj
nouveau fichier : src/GraphicObjects/Menu.cs
nouveau fichier : src/GraphicObjects/MenuItem.cs
modifié : src/GraphicObjects/TemplatedGroup.cs
Diffstat (limited to 'src/GraphicObjects/Menu.cs')
| -rw-r--r-- | src/GraphicObjects/Menu.cs | 56 |
1 files changed, 56 insertions, 0 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); + } + } +} |