diff --git a/Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml b/Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml index 3b6cc99..eef96dc 100644 --- a/Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml +++ b/Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml @@ -1,30 +1,29 @@ - + \ No newline at end of file diff --git a/Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml.cs b/Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml.cs index 95ab83a..cc25abd 100644 --- a/Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml.cs +++ b/Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml.cs @@ -41,7 +41,7 @@ public partial class ImageButton : Button set => ButtonImage.Height = value; } - public double ImageQuadSize + public double ImageWeight { get => ButtonImage.Width; set => ButtonImage.Width = ButtonImage.Height = value; diff --git a/Pilz.UI.AvaloniaUI/Controls/ImageDropDownButton.axaml b/Pilz.UI.AvaloniaUI/Controls/ImageDropDownButton.axaml new file mode 100644 index 0000000..997800d --- /dev/null +++ b/Pilz.UI.AvaloniaUI/Controls/ImageDropDownButton.axaml @@ -0,0 +1,29 @@ + + + + + + + + + \ No newline at end of file diff --git a/Pilz.UI.AvaloniaUI/Controls/ImageDropDownButton.axaml.cs b/Pilz.UI.AvaloniaUI/Controls/ImageDropDownButton.axaml.cs new file mode 100644 index 0000000..186a865 --- /dev/null +++ b/Pilz.UI.AvaloniaUI/Controls/ImageDropDownButton.axaml.cs @@ -0,0 +1,59 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Media; + +namespace Pilz.UI.AvaloniaUI.Controls; + +public partial class ImageDropDownButton : DropDownButton +{ + protected override Type StyleKeyOverride => typeof(SplitButton); + + public ImageDropDownButton() + { + InitializeComponent(); + } + + public string? Text + { + get => ButtonText.Text; + set => ButtonText.Text = value; + } + + public IImage? ImageSource + { + get => ButtonImage.Source; + set + { + ButtonImage.Source = value; + ButtonImage.IsVisible = value != null; + } + } + + public double ImageWidth + { + get => ButtonImage.Width; + set => ButtonImage.Width = value; + } + + public double ImageHeight + { + get => ButtonImage.Height; + set => ButtonImage.Height = value; + } + + public double ImageWeight + { + get => ButtonImage.Width; + set => ButtonImage.Width = ButtonImage.Height = value; + } + + public Size ImageSize + { + get => new(ButtonImage.Width, ButtonImage.Height); + set + { + ButtonImage.Width = value.Width; + ButtonImage.Height = value.Height; + } + } +} diff --git a/Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml b/Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml index d86ad4d..0d8c79b 100644 --- a/Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml +++ b/Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml @@ -1,30 +1,29 @@ - - + + - + Spacing="6"> + - + Width="{x:Static symbols:SymbolGlobals.DefaultImageSmallSize}" + Height="{x:Static symbols:SymbolGlobals.DefaultImageSmallSize}" + IsVisible="False"/> + + VerticalAlignment="Center"/> - + \ No newline at end of file diff --git a/Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml.cs b/Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml.cs index c30d0e7..7ed3ea1 100644 --- a/Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml.cs +++ b/Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml.cs @@ -41,7 +41,7 @@ public partial class ImageSplitButton : SplitButton set => ButtonImage.Height = value; } - public double ImageQuadSize + public double ImageWeight { get => ButtonImage.Width; set => ButtonImage.Width = ButtonImage.Height = value; diff --git a/Pilz.UI.AvaloniaUI/Dialogs/AvaloniaFlyoutBase.axaml b/Pilz.UI.AvaloniaUI/Dialogs/AvaloniaFlyoutBase.axaml index 275601e..bbadf6d 100644 --- a/Pilz.UI.AvaloniaUI/Dialogs/AvaloniaFlyoutBase.axaml +++ b/Pilz.UI.AvaloniaUI/Dialogs/AvaloniaFlyoutBase.axaml @@ -28,6 +28,7 @@ x:Name="ImageTitle" HorizontalAlignment="Left" VerticalAlignment="Center" + Width="16" /> - 1.2.8 + 1.2.9 @@ -24,6 +24,10 @@ ImageSplitButton.axaml + + ImageDropDownButton.axaml + Code + diff --git a/Pilz.UI/Pilz.UI.csproj b/Pilz.UI/Pilz.UI.csproj index 5d0cf6e..e8dc162 100644 --- a/Pilz.UI/Pilz.UI.csproj +++ b/Pilz.UI/Pilz.UI.csproj @@ -8,7 +8,7 @@ - 3.1.1 + 3.1.2 diff --git a/Pilz.UI/Symbols/BaseSymbolFactory.cs b/Pilz.UI/Symbols/BaseSymbolFactory.cs index 29a33f9..4fef8c4 100644 --- a/Pilz.UI/Symbols/BaseSymbolFactory.cs +++ b/Pilz.UI/Symbols/BaseSymbolFactory.cs @@ -13,9 +13,9 @@ public abstract class BaseSymbolFactory : IBaseSymbolFactory return size switch { SymbolSize.Default => Size.Empty, - SymbolSize.Small => new Size(16, 16), - SymbolSize.Medium => new Size(20, 20), - SymbolSize.Large => new Size(32, 32), + SymbolSize.Small => new Size(SymbolGlobals.DefaultImageSmallSize, SymbolGlobals.DefaultImageSmallSize), + SymbolSize.Medium => new Size(SymbolGlobals.DefaultImageMediumSize, SymbolGlobals.DefaultImageMediumSize), + SymbolSize.Large => new Size(SymbolGlobals.DefaultImageLargeSize, SymbolGlobals.DefaultImageLargeSize), _ => new Size((int)size, (int)size), }; } diff --git a/Pilz.UI/Symbols/SymbolGlobals.cs b/Pilz.UI/Symbols/SymbolGlobals.cs new file mode 100644 index 0000000..b732183 --- /dev/null +++ b/Pilz.UI/Symbols/SymbolGlobals.cs @@ -0,0 +1,8 @@ +namespace Pilz.UI.Symbols; + +public static class SymbolGlobals +{ + public static int DefaultImageSmallSize { get;} = 16; + public static int DefaultImageMediumSize { get;} = 20; + public static int DefaultImageLargeSize { get;} = 32; +} \ No newline at end of file diff --git a/Pilz.UI/Symbols/SymbolSize.cs b/Pilz.UI/Symbols/SymbolSize.cs index 85efff1..caefe93 100644 --- a/Pilz.UI/Symbols/SymbolSize.cs +++ b/Pilz.UI/Symbols/SymbolSize.cs @@ -8,17 +8,14 @@ public enum SymbolSize Default, /// /// Resizes the symbol to 16 x 16 pixels. - ///
Deprecated! This is just present due legacy reasons. Use instead. ///
Small, /// /// Resizes the symbol to 20 x 20 pixels. - ///
Deprecated! This is just present due legacy reasons. Use instead. ///
Medium, /// /// Resizes the symbol to 32 x 32 pixels. - ///
Deprecated! This is just present due legacy reasons. Use instead. ///
Large, ///