Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Remove IPalette and use PaletteBase instead #884

Merged
merged 1 commit into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,17 @@ Follow the links to see the different objects and layouts that this framework al
=======

# Breaking Changes

## V80.## (2023-11-xx - Build 2311 - November 2023)
There are list of changes that have occurred during the development of the V70.## version

### KryptonMessageBoxButtons
- https://github.com/Krypton-Suite/Standard-Toolkit/issues/728:
Bring MessageBox States inline with latest .Net 6 by using a new `KryptonMessageBoxButtons` type, which is effectively the same as .Net6 enum version of `MessageBoxButtons` but backward compatible with .net4.6.x onwards
Bring MessageBox States inline with latest .Net 6 by using a new `KryptonMessageBoxButtons` type, which is effectively the same as .Net6 enum version of `MessageBoxButtons` but backward compatible with .net4.6.x onwards.

### Palette usages
-`KryptonPalette` has become `KryptonCustomPaletteBase` to better signify it's usage.
- `IPalette` has been removed, and the usage of `PaletteBase` throughout the toolkit is used; to ensure consistent usage.

## V70.## (2022-11-08 - Build 2211 - November 2022)
There are list of changes that have occurred during the development of the V70.## version
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Coghlan/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Maximise/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Minimise/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Minimise/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wagnerp/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ public class ButtonSpecNavClose : ButtonSpecNavFixed
public ButtonSpecNavClose(KryptonNavigator navigator)
: base(navigator, PaletteButtonSpecStyle.Close)
{
}
}
#endregion

#region IButtonSpecValues
/// <summary>
/// Gets the button visible value.
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button visibiliy.</returns>
public override bool GetVisible(IPalette palette)
/// <returns>Button visibility.</returns>
public override bool GetVisible(PaletteBase palette)
{
switch (Navigator.Button.CloseButtonDisplay)
{
Expand All @@ -59,7 +59,7 @@ public override bool GetVisible(IPalette palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button enabled state.</returns>
public override ButtonEnabled GetEnabled(IPalette palette)
public override ButtonEnabled GetEnabled(PaletteBase palette)
{
switch (Navigator.Button.CloseButtonDisplay)
{
Expand All @@ -85,10 +85,10 @@ public override ButtonEnabled GetEnabled(IPalette palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button checked state.</returns>
public override ButtonCheckState GetChecked(IPalette palette) =>
public override ButtonCheckState GetChecked(PaletteBase palette) =>
// Close button is never shown as checked
ButtonCheckState.NotCheckButton;

#endregion
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ButtonSpecNavContext(KryptonNavigator navigator)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button visibiliy.</returns>
public override bool GetVisible(IPalette palette)
public override bool GetVisible(PaletteBase palette)
{
switch (Navigator.Button.ContextButtonDisplay)
{
Expand Down Expand Up @@ -76,7 +76,7 @@ public override bool GetVisible(IPalette palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button enabled state.</returns>
public override ButtonEnabled GetEnabled(IPalette palette)
public override ButtonEnabled GetEnabled(PaletteBase palette)
{
switch (Navigator.Button.ContextButtonDisplay)
{
Expand All @@ -103,7 +103,7 @@ public override ButtonEnabled GetEnabled(IPalette palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button checked state.</returns>
public override ButtonCheckState GetChecked(IPalette palette) =>
public override ButtonCheckState GetChecked(PaletteBase palette) =>
// Context button is never shown as checked
ButtonCheckState.NotCheckButton;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ protected ButtonSpecNavFixed(KryptonNavigator navigator,

// Default other properties
_location = HeaderLocation.PrimaryHeader;
}
#endregion
}
#endregion

#region IsDefault
/// <summary>
/// Gets a value indicating if all values are default.
/// </summary>
[Browsable(false)]
public override bool IsDefault => (base.IsDefault &&
public override bool IsDefault => (base.IsDefault &&
(HeaderLocation == HeaderLocation.PrimaryHeader));

#endregion
Expand Down Expand Up @@ -83,7 +83,7 @@ public HeaderLocation HeaderLocation
if (_location != value)
{
_location = value;
OnButtonSpecPropertyChanged("Location");
OnButtonSpecPropertyChanged(@"Location");
}
}
}
Expand All @@ -103,7 +103,7 @@ public void ResetHeaderLocation()
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button location.</returns>
public override HeaderLocation GetLocation(IPalette palette) =>
public override HeaderLocation GetLocation(PaletteBase palette) =>
// Ask the view builder to recover the correct location
Navigator.ViewBuilder.GetFixedButtonLocation(this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public ButtonSpecNavNext(KryptonNavigator navigator)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button visibiliy.</returns>
public override bool GetVisible(IPalette palette)
public override bool GetVisible(PaletteBase palette)
{
switch (Navigator.Button.NextButtonDisplay)
{
Expand Down Expand Up @@ -72,7 +72,7 @@ public override bool GetVisible(IPalette palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button enabled state.</returns>
public override ButtonEnabled GetEnabled(IPalette palette)
public override ButtonEnabled GetEnabled(PaletteBase palette)
{
switch (Navigator.Button.NextButtonDisplay)
{
Expand All @@ -98,7 +98,7 @@ public override ButtonEnabled GetEnabled(IPalette palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button checked state.</returns>
public override ButtonCheckState GetChecked(IPalette palette) =>
public override ButtonCheckState GetChecked(PaletteBase palette) =>
// Next button is never shown as checked
ButtonCheckState.NotCheckButton;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public ButtonSpecNavPrevious(KryptonNavigator navigator)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button visibiliy.</returns>
public override bool GetVisible(IPalette palette)
public override bool GetVisible(PaletteBase palette)
{
switch (Navigator.Button.PreviousButtonDisplay)
{
Expand Down Expand Up @@ -72,7 +72,7 @@ public override bool GetVisible(IPalette palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button enabled state.</returns>
public override ButtonEnabled GetEnabled(IPalette palette)
public override ButtonEnabled GetEnabled(PaletteBase palette)
{
switch (Navigator.Button.PreviousButtonDisplay)
{
Expand All @@ -97,7 +97,7 @@ public override ButtonEnabled GetEnabled(IPalette palette)
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button checked state.</returns>
public override ButtonCheckState GetChecked(IPalette palette) =>
public override ButtonCheckState GetChecked(PaletteBase palette) =>
// Previous button is never shown as checked
ButtonCheckState.NotCheckButton;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public enum ButtonSpecRemapTarget
/// <param name="target">Initial palette target for redirection.</param>
/// <param name="buttonSpec">Reference to button specification.</param>
/// <param name="remapTarget">Target for remapping the color onto.</param>
public ButtonSpecNavRemap(IPalette target,
public ButtonSpecNavRemap(PaletteBase target,
ButtonSpec buttonSpec,
ButtonSpecRemapTarget remapTarget)
: base(target)
Expand Down
26 changes: 13 additions & 13 deletions Source/Krypton Components/Krypton.Navigator/Dragging/DragManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Krypton.Navigator
/// <summary>
/// Specialise the generic collection with type specific rules for item accessor.
/// </summary>
public class DragTargetProviderCollection : TypedCollection<IDragTargetProvider> {}
public class DragTargetProviderCollection : TypedCollection<IDragTargetProvider> { }

/// <summary>
/// Manage a dragging operation.
Expand All @@ -29,8 +29,8 @@ public class DragManager : IDragPageNotify,
#endregion

#region Instance Fields
private IPalette _dragPalette;
private IPalette _localPalette;
private PaletteBase _dragPalette;
private PaletteBase _localPalette;
private IRenderer _dragRenderer;
private PaletteMode _paletteMode;
private readonly PaletteRedirect _redirector;
Expand Down Expand Up @@ -137,7 +137,7 @@ public PaletteMode PaletteMode
{
get => _paletteMode;

set
set
{
if (_paletteMode != value)
{
Expand All @@ -158,11 +158,11 @@ public PaletteMode PaletteMode
/// <summary>
/// Gets and sets the custom palette implementation.
/// </summary>
public IPalette Palette
public PaletteBase Palette
{
get => _localPalette;

set
set
{
if (_localPalette != value)
{
Expand All @@ -178,7 +178,7 @@ public IPalette Palette
public DragTargetProviderCollection DragTargetProviders { get; }

/// <summary>
/// Gets a value indicating if dragging is currently occuring.
/// Gets a value indicating if dragging is currently occurring.
/// </summary>
public bool IsDragging { get; private set; }

Expand All @@ -189,7 +189,7 @@ public bool DocumentCursor
{
get => _documentCursor;

set
set
{
if (IsDragging)
{
Expand All @@ -207,7 +207,7 @@ public bool DocumentCursor
/// </summary>
/// <param name="screenPt">Mouse screen point at start of drag.</param>
/// <param name="dragEndData">Data to be dropped at destination.</param>
/// <returns>True if dragging waas started; otherwise false.</returns>
/// <returns>True if dragging was started; otherwise false.</returns>
public virtual bool DragStart(Point screenPt, PageDragEndData dragEndData)
{
if (IsDisposed)
Expand All @@ -222,7 +222,7 @@ public virtual bool DragStart(Point screenPt, PageDragEndData dragEndData)

if (dragEndData == null)
{
throw new ArgumentNullException(nameof(dragEndData), "Cannot provide a null DragEndData.");
throw new ArgumentNullException(nameof(dragEndData), @"Cannot provide a null DragEndData.");
}

// Generate drag targets from the set of target provides
Expand Down Expand Up @@ -273,7 +273,7 @@ public virtual void DragMove(Point screenPt)
throw new InvalidOperationException("Cannot DragMove when DragStart has not been called.");
}

// Different feedback objects implement visual feeback differently and so only the feedback
// Different feedback objects implement visual feedback differently and so only the feedback
// instance knows the correct target to use for the given screen point and drag data.
_currentTarget = _dragFeedback.Feedback(screenPt, _currentTarget);

Expand All @@ -298,7 +298,7 @@ public virtual bool DragEnd(Point screenPt)
throw new InvalidOperationException("Cannot DragEnd when DragStart has not been called.");
}

// Different feedback objects implement visual feeback differently and so only the feedback
// Different feedback objects implement visual feedback differently and so only the feedback
// instance knows the correct target to use for the given screen point and drag data.
_currentTarget = _dragFeedback.Feedback(screenPt, _currentTarget);

Expand Down Expand Up @@ -456,7 +456,7 @@ private void ResolveDragFeedback()
if (dragFeedback == PaletteDragFeedback.Rounded)
{
// Rounded feedback uses a per-pixel alpha blending and so we need to be on a machine that supports
// more than 256 colors and also allows the layered windows feature. If not then revert to sqaures
// more than 256 colors and also allows the layered windows feature. If not then revert to squares
if ((OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows) == null) || (CommonHelper.ColorDepth() <= 8))
{
dragFeedback = PaletteDragFeedback.Square;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public KryptonPage(string text, string uniqueName)
public KryptonPage(string text, Bitmap imageSmall, string uniqueName)
: this(text, imageSmall, uniqueName, new Size(150, 50))
{

}

/// <summary>
Expand Down Expand Up @@ -286,7 +286,7 @@ public KryptonPage(string text, Bitmap imageSmall, string uniqueName, Size minSi
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new IPalette Palette
public new PaletteBase Palette
{
[DebuggerStepThrough]
get => base.Palette;
Expand Down Expand Up @@ -733,7 +733,7 @@ private void ResetToolTipShadow()
ToolTipShadow = true;
}
#endregion

/// <summary>
/// Gets and sets the unique name of the page.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public class PaletteRedirectRibbonTabContent : PaletteRedirect
/// Initialize a new instance of the PaletteRedirectRibbonDouble class.
/// </summary>
/// <param name="target">Initial palette target for redirection.</param>
public PaletteRedirectRibbonTabContent(IPalette target)
: this(target,
public PaletteRedirectRibbonTabContent(PaletteBase target)
: this(target,
null, null, null, null, null, null,
null, null, null, null, null, null,
null, null, null, null, null, null)
Expand Down Expand Up @@ -73,7 +73,7 @@ public PaletteRedirectRibbonTabContent(IPalette target)
/// <param name="trackingContent">Redirection for content tracking state requests.</param>
/// <param name="selectedContent">Redirection for content selected states requests.</param>
/// <param name="focusOverrideContent">Redirection for content focus override state requests.</param>
public PaletteRedirectRibbonTabContent(IPalette target,
public PaletteRedirectRibbonTabContent(PaletteBase target,
IPaletteRibbonBack disabledBack,
IPaletteRibbonBack normalBack,
IPaletteRibbonBack pressedBack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ButtonSpecExpandRibbon(KryptonRibbon ribbon)

// Fix the type
ProtectedType = PaletteButtonSpecStyle.RibbonExpand;
}
}
#endregion

#region AllowComponent
Expand Down Expand Up @@ -64,22 +64,22 @@ public PaletteButtonSpecStyle ButtonSpecType
/// Gets the button visible value.
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button visibiliy.</returns>
public override bool GetVisible(IPalette palette) => _ribbon.ShowMinimizeButton && _ribbon.MinimizedMode;
/// <returns>Button visibility.</returns>
public override bool GetVisible(PaletteBase palette) => _ribbon.ShowMinimizeButton && _ribbon.MinimizedMode;

/// <summary>
/// Gets the button enabled state.
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button enabled state.</returns>
public override ButtonEnabled GetEnabled(IPalette palette) => ButtonEnabled.True;
public override ButtonEnabled GetEnabled(PaletteBase palette) => ButtonEnabled.True;

/// <summary>
/// Gets the button checked state.
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button checked state.</returns>
public override ButtonCheckState GetChecked(IPalette palette) =>
public override ButtonCheckState GetChecked(PaletteBase palette) =>
// Close button is never shown as checked
ButtonCheckState.NotCheckButton;

Expand All @@ -88,11 +88,12 @@ public override ButtonCheckState GetChecked(IPalette palette) =>
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button style.</returns>
public override ButtonStyle GetStyle(IPalette palette) => ButtonStyle.ButtonSpec;
public override ButtonStyle GetStyle(PaletteBase palette) => ButtonStyle.ButtonSpec;

#endregion

#region Protected Overrides

/// <summary>
/// Raises the Click event.
/// </summary>
Expand Down
Loading