diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs
index 5127a768f..4483d3a95 100644
--- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs
+++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs
@@ -29,7 +29,6 @@ public ButtonSpecNavFormClose(KryptonNavigator navigator) : base(navigator, Pale
#region Implementation
- /*
///
/// Form Close Button Enabled: This will also Disable the System Menu `Close` BUT NOT the `Alt+F4` key action
///
@@ -44,7 +43,7 @@ public bool Enabled
if (_enabled != value)
{
_enabled = value;
- IntPtr hSystemMenu = PI.GetSystemMenu(KryptonForm.Handle, false);
+ IntPtr hSystemMenu = PI.GetSystemMenu(Navigator.Owner!.Handle, false);
if (hSystemMenu != IntPtr.Zero)
{
PI.EnableMenuItem(hSystemMenu, PI.SC_.CLOSE, _enabled ? PI.MF_.ENABLED : PI.MF_.DISABLED);
@@ -52,25 +51,27 @@ public bool Enabled
}
}
}
- */
+
#endregion
#region ButtonSpecNavFixed Implementation
public override bool GetVisible(PaletteBase palette)
{
- throw new NotImplementedException();
- }
+ // We do not show if the custom chrome is combined with composition,
+ // in which case the form buttons are handled by the composition
+ if (Navigator.Owner!.ApplyComposition && Navigator.Owner.ApplyCustomChrome)
+ {
+ return false;
+ }
- public override ButtonCheckState GetChecked(PaletteBase palette)
- {
- throw new NotImplementedException();
+ // Have all buttons been turned off?
+ return Navigator.Owner.ControlBox && Navigator.Owner.CloseBox;
}
- public override ButtonEnabled GetEnabled(PaletteBase palette)
- {
- throw new NotImplementedException();
- }
+ public override ButtonCheckState GetChecked(PaletteBase palette) => ButtonCheckState.NotCheckButton;
+
+ public override ButtonEnabled GetEnabled(PaletteBase palette) => Navigator.Owner!.CloseBox && Enabled ? ButtonEnabled.True : ButtonEnabled.False;
#endregion
}
diff --git a/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs b/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs
index bedc6c28e..ba3a27b73 100644
--- a/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs
@@ -43,6 +43,7 @@ public class KryptonNavigator : VisualSimple,
private VisualPopupPage? _visualPopupPage;
private VisualPopupToolTip? _visualPopupToolTip;
private KryptonPage[]? _dragPages;
+ private KryptonForm? _owner;
private bool _forcedLayout;
private bool _layingOut;
private bool _pageDragging;
@@ -50,6 +51,7 @@ public class KryptonNavigator : VisualSimple,
private bool _allowTabFocus;
private bool _allowTabSelect;
private bool _tabHoverStarted;
+ private bool _controlKryptonFormFeatures;
private int _cachePageCount;
private int _cachePageVisibleCount;
@@ -507,6 +509,10 @@ public KryptonPage? SelectedPage
}
}
+ public KryptonForm? Owner { get => _owner; set => _owner = value ?? null; }
+
+ public bool ControlKryptonFormFeatures { get => _controlKryptonFormFeatures; set => _controlKryptonFormFeatures = value; }
+
///
/// Gets access to the bar specific settings.
///
@@ -1204,8 +1210,8 @@ protected override void OnMouseDown(MouseEventArgs e)
ViewBase? element = ViewManager?.Root?.ViewFromPoint(new Point(e.X, e.Y));
// Ask the view builder if pressing the element needs to give us focus
- if (ViewBuilder != null
- && element != null
+ if (ViewBuilder != null
+ && element != null
&& ViewBuilder.GiveNavigatorFocus(element)
)
{
@@ -1237,7 +1243,7 @@ protected override bool ProcessKeyPreview(ref Message m)
if (CommonHelper.IsShiftKeyPressed)
{
// If the focus has been moved to a page that does not have the focus
- if (SelectedPage is { ContainsFocus: false } )
+ if (SelectedPage is { ContainsFocus: false })
{
// We need to force another TAB+SHIFT to move the focus backwards
foreach (KryptonPage page in Pages)
@@ -1292,7 +1298,7 @@ protected override bool ProcessDialogKey(Keys keyData)
{
// CONTROL tabbing around the pages in the navigator
// is handled in a view specific way
- if (ViewBuilder != null)
+ if (ViewBuilder != null)
handled = ViewBuilder.ProcessDialogKey(keyData);
}
}
@@ -2190,6 +2196,8 @@ private void AssignDefaultFields()
_allowTabFocus = true;
_allowTabSelect = true;
UseMnemonic = true;
+ _owner = null;
+ _controlKryptonFormFeatures = false;
}
private void CreatePageCollection()
@@ -2896,7 +2904,7 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e)
{
// Do not show tooltips when the form we are in does not have focus
Form? topForm = FindForm();
- if (topForm is { ContainsFocus: false } )
+ if (topForm is { ContainsFocus: false })
{
return;
}
@@ -2995,7 +3003,7 @@ private void OnStartHover(object sender, ToolTipEventArgs e)
{
// We do not provide hover support when the form does not have the focus
Form? topForm = FindForm();
- if (topForm is { ContainsFocus: false } )
+ if (topForm is { ContainsFocus: false })
{
return;
}
@@ -3133,9 +3141,9 @@ internal bool SelectNextPageControl(bool forward, bool onlyCurrentPage)
else
{
// We can only be the next control if we accept the focus
- if (ViewBuilder != null
- && ((next != this)
- || ((next == this)
+ if (ViewBuilder != null
+ && ((next != this)
+ || ((next == this)
&& ViewBuilder.CanFocus)
)
)
@@ -3221,7 +3229,7 @@ private bool NextOnUnselectedKryptonPage(Control? next)
next = next.Parent;
// Keep going until we reach the top of the parent chain
- }
+ }
// Did not find the control is on a KryptonPage, so definitely not on an unselected KryptonPage
return false;
diff --git a/Source/Krypton Components/Krypton.Navigator/Global/GlobalDeclarations.cs b/Source/Krypton Components/Krypton.Navigator/Global/GlobalDeclarations.cs
index 26f145ba3..23b83efa0 100644
--- a/Source/Krypton Components/Krypton.Navigator/Global/GlobalDeclarations.cs
+++ b/Source/Krypton Components/Krypton.Navigator/Global/GlobalDeclarations.cs
@@ -42,4 +42,4 @@
[assembly: Dependency(nameof(System), LoadHint.Always)]
[assembly: Dependency("System.Drawing", LoadHint.Always)]
[assembly: Dependency("System.Windows.Forms", LoadHint.Always)]
-[assembly: Dependency("Krypton.Toolkit", LoadHint.Always)]
+[assembly: Dependency("Krypton.Toolkit", LoadHint.Always)]
\ No newline at end of file
diff --git a/Source/Krypton Components/Krypton.Ribbon/Global/GlobalDeclarations.cs b/Source/Krypton Components/Krypton.Ribbon/Global/GlobalDeclarations.cs
index ac29fc41e..474280cb2 100644
--- a/Source/Krypton Components/Krypton.Ribbon/Global/GlobalDeclarations.cs
+++ b/Source/Krypton Components/Krypton.Ribbon/Global/GlobalDeclarations.cs
@@ -47,3 +47,4 @@
[assembly: Dependency(@"System.Drawing", LoadHint.Always)]
[assembly: Dependency(@"System.Windows.Forms", LoadHint.Always)]
[assembly: Dependency(@"Krypton.Toolkit", LoadHint.Always)]
+[assembly: InternalsVisibleTo(@"Krypton.Toolkit, PublicKey=a87e673e9ecb6e8e", AllInternalsVisible = true)]
diff --git a/Source/Krypton Components/Krypton.Toolkit/Global/GlobalDeclarations.cs b/Source/Krypton Components/Krypton.Toolkit/Global/GlobalDeclarations.cs
index 761d1135a..384d24c7f 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Global/GlobalDeclarations.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Global/GlobalDeclarations.cs
@@ -57,4 +57,5 @@
[assembly: Dependency(nameof(System), LoadHint.Always)]
[assembly: Dependency(@"System.Drawing", LoadHint.Always)]
[assembly: Dependency(@"System.Windows.Forms", LoadHint.Always)]
-
+[assembly: InternalsVisibleTo(@"Krypton.Navigator, PublicKey=a87e673e9ecb6e8e", AllInternalsVisible = true)]
+[assembly: InternalsVisibleTo(@"Krypton.Ribbon, PublicKey=a87e673e9ecb6e8e", AllInternalsVisible = true)]
\ No newline at end of file
diff --git a/Source/Krypton Components/Krypton.Toolkit/Rendering/ThemeManager.cs b/Source/Krypton Components/Krypton.Toolkit/Rendering/ThemeManager.cs
index 0e690c101..245c646b8 100644
--- a/Source/Krypton Components/Krypton.Toolkit/Rendering/ThemeManager.cs
+++ b/Source/Krypton Components/Krypton.Toolkit/Rendering/ThemeManager.cs
@@ -106,20 +106,14 @@ private static PaletteMode ReturnPaletteMode(string themeName)
/// Returns the palette mode.
/// The palette mode manager.
/// The selected .
- private static PaletteMode ReturnPaletteMode(PaletteMode paletteMode)
- {
- return paletteMode;
- }
+ private static PaletteMode ReturnPaletteMode(PaletteMode paletteMode) => paletteMode;
///
/// Applies the theme.
///
/// Name of the theme.
/// The manager.
- public static void ApplyTheme(string themeName, KryptonManager manager)
- {
- ApplyTheme(_supportedThemes.GetByFirst(themeName), manager);
- }
+ public static void ApplyTheme(string themeName, KryptonManager manager) => ApplyTheme(_supportedThemes.GetByFirst(themeName), manager);
///
/// Sets the theme.
@@ -143,14 +137,14 @@ public static void SetTheme(string themeName, KryptonManager manager)
///
/// Returns the palette mode manager as string.
///
- /// The palette mode manager.
+ /// The palette mode manager.
/// The manager.
/// The chosen theme as a string.
- public static string ReturnPaletteModeAsString(PaletteMode PaletteMode, KryptonManager manager = null)
+ public static string ReturnPaletteModeAsString(PaletteMode paletteMode, KryptonManager? manager)
{
- var paletteMode = manager?.GlobalPaletteMode ?? PaletteMode;
+ var mode = manager?.GlobalPaletteMode ?? paletteMode;
- return _supportedThemes.GetBySecond(paletteMode);
+ return _supportedThemes.GetBySecond(mode);
}
///
@@ -213,12 +207,12 @@ public static string ReturnPaletteModeAsString(PaletteMode paletteMode)
/// Applies the global theme.
///
/// The manager.
- /// The palette mode manager.
- public static void ApplyGlobalTheme(KryptonManager manager, PaletteMode PaletteMode)
+ /// The palette mode manager.
+ public static void ApplyGlobalTheme(KryptonManager manager, PaletteMode paletteMode)
{
try
{
- manager.GlobalPaletteMode = PaletteMode;
+ manager.GlobalPaletteMode = paletteMode;
}
catch (Exception exc)
{
@@ -231,10 +225,7 @@ public static void ApplyGlobalTheme(KryptonManager manager, PaletteMode PaletteM
///
/// The target.
/// do not include any string containing
- public static void PropagateThemeSelector(KryptonComboBox target, params string[] excludePartials)
- {
- AddToCollection(target.Items, excludePartials);
- }
+ public static void PropagateThemeSelector(KryptonComboBox target, params string[] excludePartials) => AddToCollection(target.Items, excludePartials);
private static void AddToCollection(IList target, string[] excludes)
{