Skip to content

Commit

Permalink
* Underpinnings for #927
Browse files Browse the repository at this point in the history
  • Loading branch information
PWagner1 committed Feb 11, 2023
1 parent ea0da9b commit b3139b9
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#region BSD License
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2023. All rights reserved.
*
*/
#endregion

namespace Krypton.Navigator
{
public class ButtonSpecNavFormClose : ButtonSpecNavFixed
{
#region Instance Fields

private bool _enabled = true;

#endregion

#region Identity

/// <summary>Initializes a new instance of the <see cref="ButtonSpecNavFormClose" /> class.</summary>
/// <param name="navigator">The navigator.</param>
public ButtonSpecNavFormClose(KryptonNavigator navigator) : base(navigator, PaletteButtonSpecStyle.FormClose)
{
}

#endregion

#region Implementation

/*
/// <summary>
/// Form Close Button Enabled: This will also Disable the System Menu `Close` BUT NOT the `Alt+F4` key action
/// </summary>
[Category(@"Appearance")]
[DefaultValue(true)]
[Description("Form Close Button Enabled: This will also Disable the System Menu `Close` BUT NOT the `Alt+F4` key action")]
public bool Enabled
{
get => _enabled;
set
{
if (_enabled != value)
{
_enabled = value;
IntPtr hSystemMenu = PI.GetSystemMenu(KryptonForm.Handle, false);
if (hSystemMenu != IntPtr.Zero)
{
PI.EnableMenuItem(hSystemMenu, PI.SC_.CLOSE, _enabled ? PI.MF_.ENABLED : PI.MF_.DISABLED);
}
}
}
}
*/
#endregion

#region ButtonSpecNavFixed Implementation

public override bool GetVisible(PaletteBase palette)
{
throw new NotImplementedException();
}

public override ButtonCheckState GetChecked(PaletteBase palette)
{
throw new NotImplementedException();
}

public override ButtonEnabled GetEnabled(PaletteBase palette)
{
throw new NotImplementedException();
}

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#region BSD License
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2023. All rights reserved.
*
*/
#endregion

namespace Krypton.Navigator
{
public class ButtonSpecNavFormMaximize : ButtonSpecNavFixed
{
public ButtonSpecNavFormMaximize(KryptonNavigator navigator, PaletteButtonSpecStyle fixedStyle) : base(navigator, fixedStyle)
{
}

public override bool GetVisible(PaletteBase palette)
{
throw new NotImplementedException();
}

public override ButtonCheckState GetChecked(PaletteBase palette)
{
throw new NotImplementedException();
}

public override ButtonEnabled GetEnabled(PaletteBase palette)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#region BSD License
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2023. All rights reserved.
*
*/
#endregion

namespace Krypton.Navigator
{
public class ButtonSpecNavFormMinimize : ButtonSpecNavFixed
{
public ButtonSpecNavFormMinimize(KryptonNavigator navigator, PaletteButtonSpecStyle fixedStyle) : base(navigator, fixedStyle)
{
}

public override bool GetVisible(PaletteBase palette)
{
throw new NotImplementedException();
}

public override ButtonCheckState GetChecked(PaletteBase palette)
{
throw new NotImplementedException();
}

public override ButtonEnabled GetEnabled(PaletteBase palette)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#region BSD License
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2023. All rights reserved.
*
*/
#endregion

namespace Krypton.Navigator
{
public class ButtonSpecNavFormRestore : ButtonSpecNavFixed
{
public ButtonSpecNavFormRestore(KryptonNavigator navigator, PaletteButtonSpecStyle fixedStyle) : base(navigator, fixedStyle)
{
}

public override bool GetVisible(PaletteBase palette)
{
throw new NotImplementedException();
}

public override ButtonCheckState GetChecked(PaletteBase palette)
{
throw new NotImplementedException();
}

public override ButtonEnabled GetEnabled(PaletteBase palette)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ public ButtonSpecFormWindowClose(KryptonForm form)
public bool Enabled
{
get => _enabled;
set {
set
{
if (_enabled != value)
{
_enabled = value;
IntPtr hSystemMenu = PI.GetSystemMenu(KryptonForm.Handle, false);
if ( hSystemMenu != IntPtr.Zero)
if (hSystemMenu != IntPtr.Zero)
{
PI.EnableMenuItem(hSystemMenu, PI.SC_.CLOSE, _enabled ? PI.MF_.ENABLED:PI.MF_.DISABLED);
PI.EnableMenuItem(hSystemMenu, PI.SC_.CLOSE, _enabled ? PI.MF_.ENABLED : PI.MF_.DISABLED);
}
}
}
Expand Down Expand Up @@ -77,7 +78,7 @@ public override bool GetVisible(PaletteBase palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button enabled state.</returns>
public override ButtonEnabled GetEnabled(PaletteBase palette) => KryptonForm.CloseBox && Enabled ? ButtonEnabled.True: ButtonEnabled.False;
public override ButtonEnabled GetEnabled(PaletteBase palette) => KryptonForm.CloseBox && Enabled ? ButtonEnabled.True : ButtonEnabled.False;

/// <summary>
/// Gets the button checked state.
Expand Down

0 comments on commit b3139b9

Please sign in to comment.