From 8a25a19ee73e8b7c0c9726bbb2ce4ec918f4e905 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Fri, 27 Jan 2017 00:21:48 +0100 Subject: icon menuitem, PopWidth and PopHeight, commands --- src/Command.cs | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/Command.cs') diff --git a/src/Command.cs b/src/Command.cs index 35a7facc..f7a12465 100644 --- a/src/Command.cs +++ b/src/Command.cs @@ -35,16 +35,20 @@ namespace Crow #endregion #region CTOR - public Command () + public Command (Action _executeAction) { + execute = _executeAction; } #endregion + Action execute; + string caption; + Picture icon; bool isEnabled; - - [XmlAttributeAttribute()][DefaultValue(true)] + #region Public properties + [XmlAttributeAttribute][DefaultValue(true)] public virtual bool IsEnabled { get { return isEnabled; } set { @@ -54,7 +58,7 @@ namespace Crow NotifyValueChanged ("IsEnabled", isEnabled); } } - [XmlAttributeAttribute()][DefaultValue("Unamed Command")] + [XmlAttributeAttribute][DefaultValue("Unamed Command")] public virtual string Caption { get { return caption; } set { @@ -65,5 +69,27 @@ namespace Crow } } + [XmlAttributeAttribute] + public Picture Icon { + get { return icon; } + set { + if (icon == value) + return; + icon = value; + NotifyValueChanged ("Icon", icon); + } + } + #endregion + + public void Execute(){ + if (execute != null) + execute (); + } + internal void raiseAllValuesChanged(){ + NotifyValueChanged ("IsEnabled", isEnabled); + NotifyValueChanged ("Icon", icon); + NotifyValueChanged ("Caption", caption); + } + } } -- cgit v1.3.1-4-g156e