diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2017-01-27 00:21:48 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2017-01-27 00:21:48 +0100 |
| commit | 8a25a19ee73e8b7c0c9726bbb2ce4ec918f4e905 (patch) | |
| tree | 8098ec3d8137c0dcc569db78fbdb4d6921187e28 | |
| parent | a519d07929a490ac9bfade86355865744787f311 (diff) | |
icon menuitem, PopWidth and PopHeight, commands
| -rw-r--r-- | Crow.csproj | 7 | ||||
| -rw-r--r-- | Default.style | 6 | ||||
| -rw-r--r-- | Icons/copy-file.svg | 6 | ||||
| -rw-r--r-- | Icons/exit-symbol.svg | 6 | ||||
| -rw-r--r-- | Icons/open-file.svg | 6 | ||||
| -rw-r--r-- | Icons/paste-on-document.svg | 6 | ||||
| -rw-r--r-- | Icons/question.svg | 7 | ||||
| -rw-r--r-- | Icons/scissors.svg | 6 | ||||
| -rwxr-xr-x | Templates/DirectoryView.template | 4 | ||||
| -rw-r--r-- | Templates/MenuItem.template | 13 | ||||
| -rw-r--r-- | src/Command.cs | 34 | ||||
| -rw-r--r-- | src/GraphicObjects/Button.cs | 15 | ||||
| -rw-r--r-- | src/GraphicObjects/Image.cs | 79 | ||||
| -rw-r--r-- | src/GraphicObjects/Menu.cs | 6 | ||||
| -rw-r--r-- | src/GraphicObjects/MenuItem.cs | 67 | ||||
| -rw-r--r-- | src/GraphicObjects/Popper.cs | 33 |
16 files changed, 226 insertions, 75 deletions
diff --git a/Crow.csproj b/Crow.csproj index 25e7f10d..d74f12f2 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -185,6 +185,7 @@ <Folder Include="src\Input\" /> <Folder Include="src\rsvg\" /> <Folder Include="src\IML\" /> + <Folder Include="Icons\" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Images\Icons\updown.svg" /> @@ -294,6 +295,12 @@ <EmbeddedResource Include="Images\Icons\maximize.svg" /> <EmbeddedResource Include="Images\Icons\minimize.svg" /> <EmbeddedResource Include="Images\Icons\normalize.svg" /> + <EmbeddedResource Include="Icons\open-file.svg"/> + <EmbeddedResource Include="Icons\scissors.svg"/> + <EmbeddedResource Include="Icons\copy-file.svg"/> + <EmbeddedResource Include="Icons\exit-symbol.svg"/> + <EmbeddedResource Include="Icons\paste-on-document.svg"/> + <EmbeddedResource Include="Icons\question.svg"/> </ItemGroup> <ItemGroup> <None Include="README.md" /> diff --git a/Default.style b/Default.style index c4a8279e..89e54719 100644 --- a/Default.style +++ b/Default.style @@ -22,12 +22,10 @@ Menu { VerticalAlignment = Top; } MenuItem { - Height = Fit; - Width = Fit; Background = Transparent; Foreground = LightGray; - Open = {Background = Mantis;Foreground=Jet;} - Close = {Foreground=LightGray;Background=Transparent;} + MouseEnter = {Background = vgradient|0:UnitedNationsBlue|1:Onyx;Foreground=White;} + MouseLeave = {Foreground=LightGray;Background=Transparent;} } MessageBox { Width=200; diff --git a/Icons/copy-file.svg b/Icons/copy-file.svg new file mode 100644 index 00000000..63c2dd37 --- /dev/null +++ b/Icons/copy-file.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#FFFFFF" d="M13 3h-3l-3-3h-7v13h6v3h10v-10l-3-3zM7 1l2 2h-2v-2zM1 12v-11h5v3h3v8h-8zM15 15h-8v-2h3v-9h2v3h3v8zM13 6v-2l2 2h-2z"></path> +</svg> diff --git a/Icons/exit-symbol.svg b/Icons/exit-symbol.svg new file mode 100644 index 00000000..3fbaa0d2 --- /dev/null +++ b/Icons/exit-symbol.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#FFFFFF" d="M14 6h-1.7c-0.2 0-0.4-0.1-0.6-0.2l-1.3-1.3c-0.2-0.3-0.6-0.5-1.1-0.5h-0.3c1.1 0 2-0.9 2-2s-0.9-2-2-2-2 0.9-2 2c0 0.7 0.4 1.4 1 1.7l-0.2 0.3h-2c-1.1 0-2.3 0.5-3 1.5l-0.6 0.8c-0.4 0.4-0.2 1 0.2 1.3 0.4 0.2 0.9 0.1 1.2-0.3l0.5-0.7c0.3-0.4 0.7-0.6 1.2-0.6h0.8l-0.7 1.6c-0.3 0.6-0.4 1.2-0.4 1.9v2c0 0.3-0.2 0.5-0.5 0.5h-2.5c-0.6 0-1 0.4-1 1s0.4 1 1 1h3.5c0.8 0 1.5-0.7 1.5-1.5v-2.5l3.8 4.5c0.6 0.9 1.7 1.5 2.8 1.5h0.9l-5.4-6.7c-0.3-0.4-0.2-0.8 0-1.3l0.6-1.5 0.7 0.8c0.4 0.4 1 0.7 1.6 0.7h2c0.6 0 1-0.4 1-1s-0.4-1-1-1z"></path> +</svg> diff --git a/Icons/open-file.svg b/Icons/open-file.svg new file mode 100644 index 00000000..d5c6a84d --- /dev/null +++ b/Icons/open-file.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#FFFFFF" d="M 4.0527344 0.24023438 L 4.0527344 2.1777344 L 1.9316406 2.1777344 L 0.93164062 4.1777344 L -0.068359375 4.1777344 L -0.068359375 15.177734 L 13.931641 15.177734 L 15.931641 6.1777344 L 13.759766 6.1777344 L 13.759766 3.4746094 L 10.525391 0.24023438 L 4.0527344 0.24023438 z M 4.8613281 1.0488281 L 9.7148438 1.0488281 L 9.7148438 4.2851562 L 12.951172 4.2851562 L 12.951172 6.1777344 L 4.8613281 6.1777344 L 4.8613281 1.0488281 z M 10.525391 1.0488281 L 12.951172 3.4746094 L 10.525391 3.4746094 L 10.525391 1.0488281 z M 2.53125 3.1777344 L 4.0527344 3.1777344 L 4.0527344 6.1777344 L 2.9316406 6.1777344 L 0.93164062 12.078125 L 0.93164062 5.1777344 L 1.53125 5.1777344 L 2.53125 3.1777344 z M 3.6328125 7.1777344 L 14.832031 7.1777344 L 13.232422 14.177734 L 1.3320312 14.078125 L 3.6328125 7.1777344 z "/> +</svg> diff --git a/Icons/paste-on-document.svg b/Icons/paste-on-document.svg new file mode 100644 index 00000000..b0a705ee --- /dev/null +++ b/Icons/paste-on-document.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#FFFFFF" d="M13 4h-3v-4h-10v14h6v2h10v-9l-3-3zM3 1h4v1h-4v-1zM15 15h-8v-10h5v3h3v7zM13 7v-2l2 2h-2z"></path> +</svg> diff --git a/Icons/question.svg b/Icons/question.svg new file mode 100644 index 00000000..fb8e3d3f --- /dev/null +++ b/Icons/question.svg @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#FFFFFF" d="M9 11h-3c0-3 1.6-4 2.7-4.6 0.4-0.2 0.7-0.4 0.9-0.6 0.5-0.5 0.3-1.2 0.2-1.4-0.3-0.7-1-1.4-2.3-1.4-2.1 0-2.5 1.9-2.5 2.3l-3-0.4c0.2-1.7 1.7-4.9 5.5-4.9 2.3 0 4.3 1.3 5.1 3.2 0.7 1.7 0.4 3.5-0.8 4.7-0.5 0.5-1.1 0.8-1.6 1.1-0.9 0.5-1.2 1-1.2 2z"></path> +<path fill="#FFFFFF" d="M9.5 14c0 1.105-0.895 2-2 2s-2-0.895-2-2c0-1.105 0.895-2 2-2s2 0.895 2 2z"></path> +</svg> diff --git a/Icons/scissors.svg b/Icons/scissors.svg new file mode 100644 index 00000000..4b5a2255 --- /dev/null +++ b/Icons/scissors.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generated by IcoMoon.io --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> +<path fill="#FFFFFF" d="M16 3.1c0 0-2.1-1.1-3.5-1-0.3 0-0.5 0.1-0.7 0.2l-4.3 3.4-1.8-1.5c0.1-0.3 0.2-0.6 0.3-1 0.1-1.8-1.4-3.4-3.3-3.2-1.2 0.1-2.3 1-2.6 2.2-0.3 1.3 0.2 2.5 1.2 3.2l3.3 2.6-3.3 2.6c-1 0.7-1.5 1.9-1.2 3.2 0.3 1.2 1.4 2 2.6 2.2 1.9 0.2 3.4-1.4 3.2-3.2 0-0.3-0.1-0.7-0.3-1l1.8-1.5 4.3 3.4c0.2 0.1 0.4 0.2 0.7 0.2 1.4 0.1 3.5-1 3.5-1l-5.7-4.9 5.8-4.9zM2.8 4.6c-0.9-0.1-1.6-0.9-1.5-1.8s0.9-1.6 1.8-1.5c0.9 0.1 1.6 0.9 1.5 1.8 0 0.9-0.9 1.6-1.8 1.5zM3.1 14.7c-0.9 0.1-1.7-0.6-1.8-1.5s0.6-1.7 1.5-1.8c0.9-0.1 1.7 0.6 1.8 1.5s-0.6 1.7-1.5 1.8zM12.4 3.2c0 0 0.1 0 0.2 0 0.4 0 0.9 0.1 1.4 0.2l-6.8 5.7-0.9-1.1 6.1-4.8zM14 12.6c-0.5 0.2-1 0.3-1.4 0.2-0.1 0-0.2 0-0.2 0l-4-3.2 1-0.9 4.6 3.9z"></path> +</svg> diff --git a/Templates/DirectoryView.template b/Templates/DirectoryView.template index 55d652a9..f7c74a9d 100755 --- a/Templates/DirectoryView.template +++ b/Templates/DirectoryView.template @@ -6,7 +6,7 @@ <Image Margin="2" Width="14" Height="14" Path="#Crow.Images.Icons.file.svg"/> <Label Text="{Name}" Width="Stretched" - MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}" + MouseEnter="{Background=vgradient|0:White|0.05:UnitedNationsBlue|1:Jet}" MouseLeave="{Background=Transparent}"/> </HorizontalStack> </ItemTemplate> @@ -15,7 +15,7 @@ <Template> <VerticalStack> <HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand" - MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}" + MouseEnter="{Background=vgradient|0:White|0.05:UnitedNationsBlue|1:Jet}" MouseLeave="{Background=Transparent}"> <Container Margin="1" Width="10" Height="10" Focusable="true" MouseClick="./onClickForExpand" MouseEnter="{Background=LightGray}" diff --git a/Templates/MenuItem.template b/Templates/MenuItem.template index 2f4400ec..311cd3ef 100644 --- a/Templates/MenuItem.template +++ b/Templates/MenuItem.template @@ -11,13 +11,16 @@ MinimumSize = "60,0" Foreground="Transparent" Background="{./Background}"> - <Label Text="{./Caption}" - Foreground="{./Foreground}" - Margin="1" HorizontalAlignment="Left" - Font="{./Font}" /> + <HorizontalStack> + <Image Style="Icon" Picture="{../../../../Icon}"/> + <Label Text="{./Caption}" + Foreground="{./Foreground}" + Margin="3" HorizontalAlignment="Left" + Font="{./Font}" /> + </HorizontalStack> </Border> </Template> <Border Foreground="DimGray" Fit="true"> - <VerticalStack Name="ItemsContainer" Margin="2" Fit="true" Background="Onyx"/> + <VerticalStack Name="ItemsContainer" Margin="0" Fit="true" Background="Onyx"/> </Border> </Popper> 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); + } + } } diff --git a/src/GraphicObjects/Button.cs b/src/GraphicObjects/Button.cs index 1cfbe85c..c73062f0 100644 --- a/src/GraphicObjects/Button.cs +++ b/src/GraphicObjects/Button.cs @@ -26,7 +26,6 @@ namespace Crow public event EventHandler Pressed; public event EventHandler Released; - public event EventHandler Clicked; #region TemplatedContainer overrides public override GraphicObject Content { @@ -34,7 +33,7 @@ namespace Crow return _contentContainer == null ? null : _contentContainer.Child; } set { - if (_contentContainer != null) + if (_contentContainer != null) _contentContainer.SetChild(value); } } @@ -69,24 +68,24 @@ namespace Crow [XmlAttributeAttribute][DefaultValue("Button")] public string Caption { - get { return caption; } + get { return caption; } set { if (caption == value) return; - caption = value; + caption = value; NotifyValueChanged ("Caption", caption); } - } + } [XmlAttributeAttribute][DefaultValue("#Crow.Images.button.svg")] public string Image { - get { return image; } + get { return image; } set { if (image == value) return; - image = value; + image = value; NotifyValueChanged ("Image", image); } - } + } [XmlAttributeAttribute][DefaultValue(false)] public bool IsPressed { diff --git a/src/GraphicObjects/Image.cs b/src/GraphicObjects/Image.cs index fa036b97..281011ad 100644 --- a/src/GraphicObjects/Image.cs +++ b/src/GraphicObjects/Image.cs @@ -11,66 +11,81 @@ namespace Crow { Picture _pic; string _svgSub; - bool scaled; - [XmlAttributeAttribute()][DefaultValue(true)] + bool scaled, keepProps; + + #region Public properties + [XmlAttributeAttribute][DefaultValue(true)] public virtual bool Scaled { get { return scaled; } set { if (scaled == value) return; - scaled = value; + scaled = value; NotifyValueChanged ("Scaled", scaled); if (_pic == null) return; _pic.Scaled = scaled; RegisterForGraphicUpdate (); } - } - bool keepProps; - [XmlAttributeAttribute()][DefaultValue(true)] + } + [XmlAttributeAttribute][DefaultValue(true)] public virtual bool KeepProportions { get { return keepProps; } set { if (keepProps == value) return; - keepProps = value; + keepProps = value; NotifyValueChanged ("KeepProportions", keepProps); if (_pic == null) return; _pic.KeepProportions = keepProps; RegisterForGraphicUpdate (); } - } - [XmlAttributeAttribute("Path")] + } + [XmlAttributeAttribute] public string Path { - get { return _pic == null ? null : _pic.Path; } - set { + get { return _pic == null ? "" : _pic.Path; } + set { + if (value == Path) + return; try { - if (string.IsNullOrEmpty(value)){ - _pic = null; - return; - } - lock(CurrentInterface.LayoutMutex){ - LoadImage (value); - _pic.Scaled = scaled; - _pic.KeepProportions = keepProps; + if (string.IsNullOrEmpty(value)) + Picture = null; + else { + lock(CurrentInterface.LayoutMutex){ + LoadImage (value); + } } } catch (Exception ex) { Debug.WriteLine (ex.Message); _pic = null; } + NotifyValueChanged ("Path", Path); } } - - [XmlAttributeAttribute()][DefaultValue(null)] + [XmlAttributeAttribute] public string SvgSub { get { return _svgSub; } set { + if (_svgSub == value) + return; _svgSub = value; RegisterForGraphicUpdate (); } } - + [XmlAttributeAttribute] + public Picture Picture { + get { return _pic; } + set { + if (_pic == value) + return; + _pic = value; + NotifyValueChanged ("Picture", _pic); + RegisterForGraphicUpdate (); + } + } + #endregion + #region CTOR public Image () : base() { @@ -80,14 +95,17 @@ namespace Crow #region Image Loading public void LoadImage (string path) { + Picture pic; + if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture)) + pic = new SvgPicture (); + else + pic = new BmpPicture (); - if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture)) - _pic = new SvgPicture (); - else - _pic = new BmpPicture (); + pic.LoadImage (path); + pic.Scaled = scaled; + pic.KeepProportions = keepProps; - _pic.LoadImage (path); - RegisterForGraphicUpdate (); + Picture = pic; } #endregion @@ -95,12 +113,13 @@ namespace Crow protected override int measureRawSize (LayoutingType lt) { if (_pic == null) - _pic = "#Crow.Images.Icons.IconAlerte.svg"; + return 2 * Margin; + //_pic = "#Crow.Images.Icons.IconAlerte.svg"; //TODO:take scalling in account if (lt == LayoutingType.Width) return _pic.Dimensions.Width + 2 * Margin; else - return _pic.Dimensions.Height + 2 * Margin; + return _pic.Dimensions.Height + 2 * Margin; } protected override void onDraw (Context gr) { diff --git a/src/GraphicObjects/Menu.cs b/src/GraphicObjects/Menu.cs index 1a7a3f95..66d23194 100644 --- a/src/GraphicObjects/Menu.cs +++ b/src/GraphicObjects/Menu.cs @@ -31,8 +31,10 @@ namespace Crow #endregion Orientation orientation; + bool autoOpen = false; - [XmlAttributeAttribute()][DefaultValue(Orientation.Horizontal)] + #region Public properties + [XmlAttributeAttribute][DefaultValue(Orientation.Horizontal)] public Orientation Orientation { get { return orientation; } set { @@ -42,12 +44,12 @@ namespace Crow NotifyValueChanged ("Orientation", orientation); } } - bool autoOpen = false; [XmlIgnore]public bool AutomaticOpenning { get { return autoOpen; } set { autoOpen = value; } } + #endregion public override void AddItem (GraphicObject g) { diff --git a/src/GraphicObjects/MenuItem.cs b/src/GraphicObjects/MenuItem.cs index 80b5759d..adec326f 100644 --- a/src/GraphicObjects/MenuItem.cs +++ b/src/GraphicObjects/MenuItem.cs @@ -32,12 +32,14 @@ namespace Crow public event EventHandler Open; public event EventHandler Close; - public event EventHandler Execute; string caption; - Command command;//TODO + Command command; + Picture icon; bool isOpened; + Measure popWidth, popHeight; + #region Public properties [XmlAttributeAttribute][DefaultValue(false)] public bool IsOpened { get { return isOpened; } @@ -54,38 +56,87 @@ namespace Crow onClose (this, null); } } - [XmlAttributeAttribute][DefaultValue(null)] public virtual Command Command { get { return command; } set { if (command == value) return; + + if (command != null) { + command.raiseAllValuesChanged (); + command.ValueChanged -= Command_ValueChanged; + } + command = value; + + if (command != null) { + command.ValueChanged += Command_ValueChanged; + command.raiseAllValuesChanged (); + } + NotifyValueChanged ("Command", command); } } - [XmlAttributeAttribute][DefaultValue("MenuItem")] public string Caption { - get { return caption; } + get { return Command == null ? caption : Command.Caption; } set { if (caption == value) return; caption = value; - NotifyValueChanged ("Caption", caption); + + if (command == null)//raise value changed only if not bound to a command + NotifyValueChanged ("Caption", caption); + } + } + [XmlAttributeAttribute] + public Picture Icon { + get { return Command == null ? icon : Command.Icon;; } + set { + if (icon == value) + return; + icon = value; + if (command == null) + NotifyValueChanged ("Icon", icon); } } - + [XmlAttributeAttribute()][DefaultValue("Fit")] + public virtual Measure PopWidth { + get { return popWidth; } + set { + if (popWidth == value) + return; + popWidth = value; + NotifyValueChanged ("PopWidth", popWidth); + } + } + [XmlAttributeAttribute()][DefaultValue("Fit")] + public virtual Measure PopHeight { + get { return popHeight; } + set { + if (popHeight == value) + return; + popHeight = value; + NotifyValueChanged ("PopHeight", popHeight); + } + } + #endregion + public override void AddItem (GraphicObject g) { base.AddItem (g); g.NotifyValueChanged ("PopDirection", Alignment.Right); } + void Command_ValueChanged (object sender, ValueChangeEventArgs e) + { + NotifyValueChanged (e.MemberName, e.NewValue); + } void onMI_Click (object sender, MouseButtonEventArgs e) { - Execute.Raise (this, null); + if (command != null) + command.Execute (); if(!IsOpened) (LogicalParent as Menu).AutomaticOpenning = false; } diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index 84088355..8c79ce24 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -38,6 +38,7 @@ namespace Crow string caption; Alignment popDirection; GraphicObject _content; + Measure popWidth, popHeight; public event EventHandler Pop; public event EventHandler Unpop; @@ -53,6 +54,26 @@ namespace Crow NotifyValueChanged ("Caption", caption); } } + [XmlAttributeAttribute()][DefaultValue("Fit")] + public virtual Measure PopWidth { + get { return popWidth; } + set { + if (popWidth == value) + return; + popWidth = value; + NotifyValueChanged ("PopWidth", popWidth); + } + } + [XmlAttributeAttribute()][DefaultValue("Fit")] + public virtual Measure PopHeight { + get { return popHeight; } + set { + if (popHeight == value) + return; + popHeight = value; + NotifyValueChanged ("PopHeight", popHeight); + } + } [XmlAttributeAttribute()][DefaultValue(false)] public bool IsPopped { @@ -164,18 +185,6 @@ namespace Crow } #region GraphicObject overrides - public override void OnLayoutChanges (LayoutingType layoutType) - { - base.OnLayoutChanges (layoutType); - - if (_content == null) - return; - - if (layoutType == LayoutingType.Width) - _content.MinimumSize = new Size (this.Slot.Width, _content.MinimumSize.Height); - } - - public override void onMouseClick (object sender, MouseButtonEventArgs e) { if (_canPop) |