From: Jean-Philippe Bruyère Date: Thu, 22 Apr 2021 16:12:14 +0000 (+0200) Subject: IToggle for TemplatedGroup recursion, Popper without checkbox in template, commands... X-Git-Tag: v0.9.5-beta~20 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=a515e31998f64f537e29cd30fdb7e9bfc7d4a02f;p=jp%2Fcrow.git IToggle for TemplatedGroup recursion, Popper without checkbox in template, commands files split --- diff --git a/Crow/Templates/ComboBox.template b/Crow/Templates/ComboBox.template index 8e13b683..8e818d58 100644 --- a/Crow/Templates/ComboBox.template +++ b/Crow/Templates/ComboBox.template @@ -1,19 +1,15 @@ - - - - + + + + + diff --git a/Crow/src/Command.cs b/Crow/src/Command.cs deleted file mode 100644 index a185e1ad..00000000 --- a/Crow/src/Command.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System.Runtime.InteropServices.ComTypes; -// Copyright (c) 2013-2020 Jean-Philippe Bruyère -// -// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) - -using System; -using System.ComponentModel; -using System.Threading.Tasks; -using System.Collections; -using System.Collections.Generic; - -namespace Crow { - public abstract class CommandBase : IValueChange { - #region IValueChange implementation - public event EventHandler ValueChanged; - public virtual void NotifyValueChanged(string MemberName, object _value) - { - ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); - } - #endregion - - #region CTOR - protected CommandBase() {} - protected CommandBase (string _caption, string _icon = null) - { - caption = _caption; - icon = _icon; - } - #endregion - - string caption, icon; - - /// - /// label to display in the bound control - /// - [DefaultValue("Unamed Command")] - public virtual string Caption { - get => caption; - set { - if (caption == value) - return; - caption = value; - NotifyValueChanged ("Caption", caption); - - } - } - /// - /// Icon to display in the bound control - /// - public string Icon { - get => icon; - set { - if (icon == value) - return; - icon = value; - NotifyValueChanged ("Icon", icon); - } - } - internal virtual void raiseAllValuesChanged() { - NotifyValueChanged ("Icon", icon); - NotifyValueChanged ("Caption", caption); - } - } - public class CommandGroup : CommandBase, IEnumerable, IList - { - public ObservableList Commands = new ObservableList(); - - public CommandGroup () { } - public CommandGroup (string caption, string icon, params CommandBase[] commands) : - base (caption, icon) { - Commands.AddRange (commands); - } - public CommandGroup (string caption, params CommandBase[] commands) : - base (caption) { - Commands.AddRange (commands); - } - public CommandGroup (params CommandBase[] commands) { - Commands.AddRange (commands); - } - - - public int Count => Commands.Count; - - public bool IsReadOnly => false; - - public CommandBase this[int index] { get => Commands[index]; set => Commands[index] = value; } - - public IEnumerator GetEnumerator() => Commands.GetEnumerator (); - - public int IndexOf(CommandBase item) => Commands.IndexOf (item); - - public void Insert(int index, CommandBase item) => Commands.Insert(index, item); - - public void RemoveAt(int index) => Commands.RemoveAt(index); - - public void Add(CommandBase item) => Commands.Add (item); - - public void Clear() => Commands.Clear(); - - public bool Contains(CommandBase item) => Commands.Contains (item); - - public void CopyTo(CommandBase[] array, int arrayIndex) => Commands.CopyTo (array, arrayIndex); - - public bool Remove(CommandBase item) { - Commands.Remove (item); - return true; - } - - IEnumerator IEnumerable.GetEnumerator() - => Commands.GetEnumerator(); - } - - - /// - /// helper class to bind in one step icon, caption, action, and validity tests to a controls - /// - public class Command : CommandBase - { - - #region CTOR - public Command () {} - /// - /// Initializes a new instance of Command with the action passed as argument. - /// - /// action to excecute when command is triggered - public Command (Action _executeAction) { - execute = _executeAction; - } - /// - /// Initializes a new instance of Command with the action passed as argument. - /// - /// action to excecute when command is triggered - public Command (Action _executeAction) { - execute = _executeAction; - } - public Command (string caption, Action executeAction, string icon = null, bool _canExecute = true) - :base (caption, icon) - { - execute = executeAction; - canExecute = _canExecute; - } - public Command (string caption, Action executeAction, string icon = null, bool _canExecute = true) - :base (caption, icon) - { - execute = executeAction; - canExecute = _canExecute; - } - - #endregion - - Delegate execute; - - bool canExecute = true; - - /// - /// if true, action defined in this command may be executed, - /// - [DefaultValue(true)] - public virtual bool CanExecute { - get => canExecute; - set { - if (canExecute == value) - return; - canExecute = value; - NotifyValueChanged ("CanExecute", canExecute); - } - } - - /// - /// trigger the execution of the command - /// - public virtual void Execute (object sender = null){ - if (execute != null && CanExecute){ - Task task = (execute is Action a) ? - task = new Task(a) : - (execute is Action o) ? - task = new Task(o, sender) : throw new Exception("Invalid Delegate type in Crow.Command, expecting Action or Action"); - task.Start(); - } - } - - internal override void raiseAllValuesChanged() - { - base.raiseAllValuesChanged(); - NotifyValueChanged ("CanExecute", CanExecute); - } - } -} diff --git a/Crow/src/Command/Command.cs b/Crow/src/Command/Command.cs new file mode 100644 index 00000000..80bbf462 --- /dev/null +++ b/Crow/src/Command/Command.cs @@ -0,0 +1,84 @@ +// Copyright (c) 2013-2021 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; +using System.ComponentModel; +using System.Threading.Tasks; + +namespace Crow { + /// + /// helper class to bind in one step icon, caption, action, and validity tests to a controls + /// + public class Command : CommandBase + { + + #region CTOR + public Command () {} + /// + /// Initializes a new instance of Command with the action passed as argument. + /// + /// action to excecute when command is triggered + public Command (Action _executeAction) { + execute = _executeAction; + } + /// + /// Initializes a new instance of Command with the action passed as argument. + /// + /// action to excecute when command is triggered + public Command (Action _executeAction) { + execute = _executeAction; + } + public Command (string caption, Action executeAction, string icon = null, bool _canExecute = true) + :base (caption, icon) + { + execute = executeAction; + canExecute = _canExecute; + } + public Command (string caption, Action executeAction, string icon = null, bool _canExecute = true) + :base (caption, icon) + { + execute = executeAction; + canExecute = _canExecute; + } + + #endregion + + Delegate execute; + + bool canExecute = true; + + /// + /// if true, action defined in this command may be executed, + /// + [DefaultValue(true)] + public virtual bool CanExecute { + get => canExecute; + set { + if (canExecute == value) + return; + canExecute = value; + NotifyValueChanged ("CanExecute", canExecute); + } + } + + /// + /// trigger the execution of the command + /// + public virtual void Execute (object sender = null){ + if (execute != null && CanExecute){ + Task task = (execute is Action a) ? + task = new Task(a) : + (execute is Action o) ? + task = new Task(o, sender) : throw new Exception("Invalid Delegate type in Crow.Command, expecting Action or Action"); + task.Start(); + } + } + + internal override void raiseAllValuesChanged() + { + base.raiseAllValuesChanged(); + NotifyValueChanged ("CanExecute", CanExecute); + } + } +} diff --git a/Crow/src/Command/CommandBase.cs b/Crow/src/Command/CommandBase.cs new file mode 100644 index 00000000..41aef606 --- /dev/null +++ b/Crow/src/Command/CommandBase.cs @@ -0,0 +1,63 @@ +// Copyright (c) 2013-2021 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; +using System.ComponentModel; + +namespace Crow { + /// + /// Base class for Command and CommandGroup. + /// + public abstract class CommandBase : IValueChange { + #region IValueChange implementation + public event EventHandler ValueChanged; + public virtual void NotifyValueChanged(string MemberName, object _value) + { + ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); + } + #endregion + + #region CTOR + protected CommandBase() {} + protected CommandBase (string _caption, string _icon = null) + { + caption = _caption; + icon = _icon; + } + #endregion + + string caption, icon; + + /// + /// label to display in the bound control + /// + [DefaultValue("Unamed Command")] + public virtual string Caption { + get => caption; + set { + if (caption == value) + return; + caption = value; + NotifyValueChanged ("Caption", caption); + + } + } + /// + /// Icon to display in the bound control + /// + public string Icon { + get => icon; + set { + if (icon == value) + return; + icon = value; + NotifyValueChanged ("Icon", icon); + } + } + internal virtual void raiseAllValuesChanged() { + NotifyValueChanged ("Icon", icon); + NotifyValueChanged ("Caption", caption); + } + } +} diff --git a/Crow/src/Command/CommandGroup.cs b/Crow/src/Command/CommandGroup.cs new file mode 100644 index 00000000..ef4b0eff --- /dev/null +++ b/Crow/src/Command/CommandGroup.cs @@ -0,0 +1,57 @@ +// Copyright (c) 2013-2021 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System.Collections; +using System.Collections.Generic; + +namespace Crow { + public class CommandGroup : CommandBase, IEnumerable, IList + { + public List Commands = new List(); + + public CommandGroup () { } + public CommandGroup (string caption, string icon, params CommandBase[] commands) : + base (caption, icon) { + Commands.AddRange (commands); + } + public CommandGroup (string caption, params CommandBase[] commands) : + base (caption) { + Commands.AddRange (commands); + } + public CommandGroup (params CommandBase[] commands) { + Commands.AddRange (commands); + } + + + public int Count => Commands.Count; + + public bool IsReadOnly => false; + + public CommandBase this[int index] { get => Commands[index]; set => Commands[index] = value; } + + public IEnumerator GetEnumerator() => Commands.GetEnumerator (); + + public int IndexOf(CommandBase item) => Commands.IndexOf (item); + + public void Insert(int index, CommandBase item) => Commands.Insert(index, item); + + public void RemoveAt(int index) => Commands.RemoveAt(index); + + public void Add(CommandBase item) => Commands.Add (item); + + public void Clear() => Commands.Clear(); + + public bool Contains(CommandBase item) => Commands.Contains (item); + + public void CopyTo(CommandBase[] array, int arrayIndex) => Commands.CopyTo (array, arrayIndex); + + public bool Remove(CommandBase item) { + Commands.Remove (item); + return true; + } + + IEnumerator IEnumerable.GetEnumerator() + => Commands.GetEnumerator(); + } +} diff --git a/Crow/src/EventArgs/TreeExpandEventArg.cs b/Crow/src/EventArgs/TreeExpandEventArg.cs index 7641aa5d..feb3bad0 100644 --- a/Crow/src/EventArgs/TreeExpandEventArg.cs +++ b/Crow/src/EventArgs/TreeExpandEventArg.cs @@ -9,9 +9,8 @@ namespace Crow /// /// Source of the expand/collapse event /// - public Expandable SourceWidget; - public TreeExpandEventArg (Expandable sourceWidget) - { + public IToggle SourceWidget; + public TreeExpandEventArg (IToggle sourceWidget) { } } diff --git a/Crow/src/IToggle.cs b/Crow/src/IToggle.cs new file mode 100644 index 00000000..54564be4 --- /dev/null +++ b/Crow/src/IToggle.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2020-2021 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; + +namespace Crow +{ + public interface IToggle + { + event EventHandler ToggleOn; + event EventHandler ToggleOff; + BooleanTestOnInstance IsToggleable { get; set; } + + bool IsToggled { + get; + set; + } + + } +} diff --git a/Crow/src/Widgets/CheckBox.cs b/Crow/src/Widgets/CheckBox.cs index ccd1ee75..a51ff18c 100644 --- a/Crow/src/Widgets/CheckBox.cs +++ b/Crow/src/Widgets/CheckBox.cs @@ -46,6 +46,7 @@ namespace Crow public override void onMouseClick (object sender, MouseButtonEventArgs e) { IsChecked = !IsChecked; + e.Handled = true; base.onMouseClick (sender, e); } } diff --git a/Crow/src/Widgets/Expandable.cs b/Crow/src/Widgets/Expandable.cs index e656d771..e2a7818b 100644 --- a/Crow/src/Widgets/Expandable.cs +++ b/Crow/src/Widgets/Expandable.cs @@ -10,8 +10,8 @@ namespace Crow /// /// templated control whose content can be hidden and shown on demand /// - public class Expandable : TemplatedContainer - { + public class Expandable : TemplatedContainer, IToggle + { #region CTOR protected Expandable() : base(){} public Expandable (Interface iface) : base(iface){} @@ -33,6 +33,20 @@ namespace Crow public event EventHandler Collapse; #endregion + #region IToggle implementation + public event EventHandler ToggleOn; + public event EventHandler ToggleOff; + public BooleanTestOnInstance IsToggleable { get; set; } + public bool IsToggled { + get => _isExpanded; + set { + if (value == _isExpanded) + return; + IsExpanded = value; + } + } + #endregion + public BooleanTestOnInstance GetIsExpandable; /// @@ -55,11 +69,11 @@ namespace Crow } } [DefaultValue(false)] - public bool IsExpanded - { + public bool IsExpanded + { get { return _isExpanded; } - set - { + set + { if (value == _isExpanded) return; @@ -68,16 +82,17 @@ namespace Crow bool isExp = IsExpandable; NotifyValueChanged ("IsExpandable", isExp); if (!isExp) - _isExpanded = false; + _isExpanded = false; NotifyValueChangedAuto (_isExpanded); + NotifyValueChanged ("IsToggled",_isExpanded); if (_isExpanded) onExpand (this, null); else onCollapse (this, null); - } - } + } + } [XmlIgnore]public bool IsExpandable { get { try { @@ -88,6 +103,7 @@ namespace Crow } } } + #endregion public virtual void onExpand(object sender, EventArgs e) @@ -96,6 +112,7 @@ namespace Crow _contentContainer.IsVisible = true; Expand.Raise (this, e); + ToggleOn.Raise (this, null); } public virtual void onCollapse(object sender, EventArgs e) { @@ -103,6 +120,7 @@ namespace Crow _contentContainer.IsVisible = false; Collapse.Raise (this, e); + ToggleOff.Raise (this, null); } } } diff --git a/Crow/src/Widgets/GroupBase.cs b/Crow/src/Widgets/GroupBase.cs index 4c0267f8..5784bc29 100644 --- a/Crow/src/Widgets/GroupBase.cs +++ b/Crow/src/Widgets/GroupBase.cs @@ -175,11 +175,11 @@ namespace Crow return tmp; } - public override Widget FindByType () + public override T FindByType () { - if (this is T) - return this; - Widget tmp = null; + if (this is T t) + return t; + T tmp = default(T); childrenRWLock.EnterReadLock (); diff --git a/Crow/src/Widgets/Popper.cs b/Crow/src/Widgets/Popper.cs index 3e2f37cf..fff2729d 100644 --- a/Crow/src/Widgets/Popper.cs +++ b/Crow/src/Widgets/Popper.cs @@ -7,7 +7,7 @@ using System.ComponentModel; namespace Crow { - public class Popper : TemplatedContainer + public class Popper : TemplatedContainer, IToggle { #region CTOR protected Popper () {} @@ -110,6 +110,7 @@ namespace Crow _content.HorizontalAlignment = HorizontalAlignment.Left; _content.VerticalAlignment = VerticalAlignment.Top; _content.LayoutChanged += _content_LayoutChanged; + _content.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren); } } void positionContent(LayoutingType lt){ @@ -193,23 +194,24 @@ namespace Crow public virtual void onPop(object sender, EventArgs e) { - if (Content != null) { - Content.IsVisible = true; + if (Content != null) { if (Content.Parent == null) IFace.AddWidget (Content); + Content.IsVisible = true; //if (Content.LogicalParent != this) Content.LogicalParent = this; IFace.PutOnTop (Content, true); - _content_LayoutChanged (this, new LayoutingEventArgs (LayoutingType.Sizing)); + //_content_LayoutChanged (this, new LayoutingEventArgs (LayoutingType.Sizing)); } Popped.Raise (this, e); + ToggleOn.Raise (this, null); } public virtual void onUnpop(object sender, EventArgs e) { - if (Content != null) { - Content.IsVisible = false; - } + if (Content != null) + Content.IsVisible = false; Unpoped.Raise (this, e); + ToggleOff.Raise (this, null); } protected override void Dispose (bool disposing) @@ -220,5 +222,23 @@ namespace Crow } base.Dispose (disposing); } + public override void onMouseClick (object sender, MouseButtonEventArgs e) + { + IsPopped = !IsPopped; + base.onMouseClick (sender, e); + } + #region IToggle implementation + public event EventHandler ToggleOn; + public event EventHandler ToggleOff; + public BooleanTestOnInstance IsToggleable { get; set; } + public bool IsToggled { + get => _isPopped; + set { + if (value == _isPopped) + return; + IsPopped = value; + } + } + #endregion } } diff --git a/Crow/src/Widgets/PrivateContainer.cs b/Crow/src/Widgets/PrivateContainer.cs index 22a34f1c..c7daad57 100644 --- a/Crow/src/Widgets/PrivateContainer.cs +++ b/Crow/src/Widgets/PrivateContainer.cs @@ -81,12 +81,12 @@ namespace Crow return child == null ? null : child.FindByName (nameToFind); } - public override Widget FindByType () + public override T FindByType () { - if (this is T) - return this; + if (this is T t) + return t; - return child == null ? null : child.FindByType (); + return child == null ? default(T) : child.FindByType (); } public override bool Contains (Widget goToFind) { diff --git a/Crow/src/Widgets/TemplatedContainer.cs b/Crow/src/Widgets/TemplatedContainer.cs index b8d7a128..c51ea3eb 100644 --- a/Crow/src/Widgets/TemplatedContainer.cs +++ b/Crow/src/Widgets/TemplatedContainer.cs @@ -63,12 +63,12 @@ namespace Crow return Content == null ? null : Content.FindByName (nameToFind); } - public override Widget FindByType () + public override T FindByType () { - if (this is T) - return this; + if (this is T t) + return t; - return Content == null ? null : Content.FindByType (); + return Content == null ? default(T) : Content.FindByType (); } public override bool Contains (Widget goToFind) { diff --git a/Crow/src/Widgets/TemplatedControl.cs b/Crow/src/Widgets/TemplatedControl.cs index 5110d941..e971c20b 100644 --- a/Crow/src/Widgets/TemplatedControl.cs +++ b/Crow/src/Widgets/TemplatedControl.cs @@ -79,7 +79,7 @@ namespace Crow /// widget identified by name, or null if not found /// widget's name to find public override Widget FindByName (string nameToFind) => nameToFind == this.Name ? this : null; - public override Widget FindByType () => this is TemplatedControl ? this : null; + //public override T FindByType () => this is TemplatedControl tg ? tg : default (T); public Widget FindByNameInTemplate (string nameToFind) => child?.FindByName (nameToFind); /// ///onDraw is overrided to prevent default drawing of background, template top container diff --git a/Crow/src/Widgets/TemplatedGroup.cs b/Crow/src/Widgets/TemplatedGroup.cs index a1ac759c..67c1f0db 100644 --- a/Crow/src/Widgets/TemplatedGroup.cs +++ b/Crow/src/Widgets/TemplatedGroup.cs @@ -287,17 +287,17 @@ namespace Crow { } return null; } - public override Widget FindByType () + public override T FindByType () { - if (this is T) - return this; + if (this is T t) + return t; foreach (Widget w in Items) { - Widget r = w.FindByType (); + T r = w.FindByType (); if (r != null) return r; } - return null; + return default(T); } public override bool Contains (Widget goToFind) { @@ -333,8 +333,10 @@ namespace Crow { try { loadPage (data, itemsContainer, dataTest); } catch (Exception ex) { - if (Monitor.IsEntered (IFace.LayoutMutex)) - Monitor.Exit (IFace.LayoutMutex); + while (Monitor.IsEntered (IFace.UpdateMutex)) + Monitor.Exit (IFace.UpdateMutex); + while (Monitor.IsEntered (IFace.LayoutMutex)) + Monitor.Exit (IFace.LayoutMutex); System.Diagnostics.Debug.WriteLine ("loading thread aborted: " + ex.ToString()); } @@ -477,16 +479,17 @@ namespace Crow { Monitor.Exit (IFace.UpdateMutex); if (iTemp.Expand != null) { - Expandable e = g as Expandable; - if (e == null) - e = g.FindByType () as Expandable; + IToggle toggle = g as IToggle; + + if (toggle == null) + toggle = g.FindByType (); - if (e != null) { - e.Expand += iTemp.Expand; - if ((o as ICollection) == null) - e.GetIsExpandable = new BooleanTestOnInstance ((instance) => true); + if (toggle != null) { + toggle.ToggleOn += iTemp.Expand; + if (o is ICollection) + toggle.IsToggleable = iTemp.HasSubItems; else - e.GetIsExpandable = iTemp.HasSubItems; + toggle.IsToggleable = new BooleanTestOnInstance ((instance) => true); } } @@ -565,11 +568,6 @@ namespace Crow { base.Dispose (disposing); } - public override void OnDataSourceChanged (object sender, DataSourceChangeEventArgs e) - { - base.OnDataSourceChanged (sender, e); - } - public void OnInsertClick (object sender, MouseEventArgs e) { if (data is IObservableList) diff --git a/Crow/src/Widgets/TreeView.cs b/Crow/src/Widgets/TreeView.cs index 2993a12b..f01208e3 100644 --- a/Crow/src/Widgets/TreeView.cs +++ b/Crow/src/Widgets/TreeView.cs @@ -33,7 +33,7 @@ namespace Crow } - void onExpandAll_MouseClick (object sender, MouseButtonEventArgs e) + /*void onExpandAll_MouseClick (object sender, MouseButtonEventArgs e) { ExpandAll (); } @@ -41,23 +41,22 @@ namespace Crow public void ExpandAll(){ foreach (Group grp in itemsContainer.Children) { foreach (Widget go in grp.Children) { - Expandable exp = go as Expandable; - if (exp == null) - continue; - TreeView subTV = exp.FindByName ("List") as TreeView; - if (subTV == null) - continue; - EventHandler handler = null; - handler = delegate(object sender, EventArgs e) { - TreeView tv = sender as TreeView; - tv.Loaded -= handler; - tv.ExpandAll (); - }; - subTV.Loaded += handler; - exp.IsExpanded = true; + if (go is IToggle exp) { + TreeView subTV = exp.FindByName ("List") as TreeView; + if (subTV == null) + continue; + EventHandler handler = null; + handler = delegate(object sender, EventArgs e) { + TreeView tv = sender as TreeView; + tv.Loaded -= handler; + tv.ExpandAll (); + }; + subTV.Loaded += handler; + exp.IsToggled = true; + } } } - } + }*/ } } diff --git a/Crow/src/Widgets/Widget.cs b/Crow/src/Widgets/Widget.cs index c38f373b..6f0cd6c2 100644 --- a/Crow/src/Widgets/Widget.cs +++ b/Crow/src/Widgets/Widget.cs @@ -252,7 +252,7 @@ namespace Crow loadDefaultValues (); } #region private fields - LayoutingType registeredLayoutings;// = LayoutingType.All; + LayoutingType registeredLayoutings;// = LayoutingType.Sizing; ILayoutable logicalParent; ILayoutable parent; string name; @@ -1304,13 +1304,10 @@ namespace Crow } #endregion - public virtual Widget FindByName(string nameToFind){ - return string.Equals(nameToFind, name, StringComparison.Ordinal) ? this : null; - } - public virtual Widget FindByType () - { - return this is T ? this : null; - } + public virtual Widget FindByName(string nameToFind) + => string.Equals(nameToFind, name, StringComparison.Ordinal) ? this : null; + public virtual T FindByType () //where T : Widget + => this is T t? t : default(T); public virtual bool Contains(Widget goToFind){ return false; } diff --git a/Samples/DebugLogAnalyzer/ui/ComboBox.template b/Samples/DebugLogAnalyzer/ui/ComboBox.template deleted file mode 100644 index 1b8e439c..00000000 --- a/Samples/DebugLogAnalyzer/ui/ComboBox.template +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/Samples/DebugLogAnalyzer/ui/EnumSelector.template b/Samples/DebugLogAnalyzer/ui/EnumSelector.template index 2fffa3f8..01d04383 100644 --- a/Samples/DebugLogAnalyzer/ui/EnumSelector.template +++ b/Samples/DebugLogAnalyzer/ui/EnumSelector.template @@ -1,14 +1,10 @@ \ No newline at end of file diff --git a/Samples/DebugLogAnalyzer/ui/dbg.style b/Samples/DebugLogAnalyzer/ui/dbg.style index 90ec61da..33a5e9f4 100644 --- a/Samples/DebugLogAnalyzer/ui/dbg.style +++ b/Samples/DebugLogAnalyzer/ui/dbg.style @@ -22,10 +22,6 @@ DbgEventView { Height="Fit"; Width="150"; } -ComboBox { - Template="#Dbg.ComboBox.template"; - Background="Jet"; -} labWidgetRecordList { Font="mono, 11"; Background="Grey"; diff --git a/Samples/common/SampleBase.cs b/Samples/common/SampleBase.cs index 22d1fb0b..1e849d6f 100644 --- a/Samples/common/SampleBase.cs +++ b/Samples/common/SampleBase.cs @@ -47,26 +47,27 @@ namespace Crow #region Test values for Binding public CommandGroup Commands, AllCommands; public CommandGroup EditCommands = new CommandGroup("Edit Commands", - new Command("Edit command 1", () => Console.WriteLine("edit command1 pressed")), - new Command("Edit command 2", () => Console.WriteLine("edit command2 pressed")), - new Command("Edit command 3", () => Console.WriteLine("edit command3 pressed")) + new Command("Edit command 1", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "Edit comand 1 clicked")), + new Command("Edit command 2 a bit longer", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "Edit comand 2 clicked"), null, false), + new Command("Edit command three", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "Edit comand 3 clicked")) ); public CommandGroup FileCommands = new CommandGroup("File Commands", - new Command("File command 1", () => Console.WriteLine("File command1 pressed")), - new Command("File command 2", () => Console.WriteLine("File command2 pressed")), - new Command("File command 3", () => Console.WriteLine("File command3 pressed")) + new Command("File command 1", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "File comand 1 clicked")), + new Command("File command 2 a bit longer", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "File comand 2 clicked")), + new Command("File command three", (sender) => MessageBox.ShowModal((sender as Widget).IFace, MessageBox.Type.Information, "File comand 3 clicked")) ); void initCommands() { Commands = new CommandGroup("commands msg boxes", new Command("Action 1", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 1 clicked")), - new Command("Action 2", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 2 clicked")), - new Command("Action 3", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 3 clicked")) + new Command("Action two", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 2 clicked"), null, false), + new Command("Action three", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu 3 clicked")) ); AllCommands = new CommandGroup ("All Commands", - EditCommands, FileCommands, + EditCommands, + new CommandGroup ("Combined commands", FileCommands, EditCommands), new Command("Action A", () => MessageBox.ShowModal(this, MessageBox.Type.Information, "context menu A clicked")) ); } diff --git a/Samples/common/ui/Interfaces/Experimental/colorTable.crow b/Samples/common/ui/Interfaces/Experimental/colorTable.crow index 6da2b04a..29790261 100644 --- a/Samples/common/ui/Interfaces/Experimental/colorTable.crow +++ b/Samples/common/ui/Interfaces/Experimental/colorTable.crow @@ -1,6 +1,8 @@ - + diff --git a/Samples/common/ui/Interfaces/Experimental/fitPopup.crow b/Samples/common/ui/Interfaces/Experimental/fitPopup.crow new file mode 100644 index 00000000..44eef9fd --- /dev/null +++ b/Samples/common/ui/Interfaces/Experimental/fitPopup.crow @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Experimental/spinner.crow b/Samples/common/ui/Interfaces/Experimental/spinner.crow index ac32e78d..4b5e66f0 100644 --- a/Samples/common/ui/Interfaces/Experimental/spinner.crow +++ b/Samples/common/ui/Interfaces/Experimental/spinner.crow @@ -1,6 +1,6 @@