Skip to content

Commit

Permalink
- Remove IPalette and use PaletteBase instead
Browse files Browse the repository at this point in the history
- Fix fallout in abstract class useage
- Rename `KryptonPalette` to `KryptonCustomPaletteBase` to reflect usage
- Start to sort out code in `ThemeManager`
- Some spelling mistake fixes

#Krypton-Suite/Standard-Toolkit#827
  • Loading branch information
Smurf-IV committed Dec 23, 2022
1 parent 6cdd3ef commit 3fc274c
Show file tree
Hide file tree
Showing 24 changed files with 163 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void ContentPropertyGrid_Load(object sender, EventArgs e)
private void OnGlobalPaletteChanged(object sender, EventArgs e)
{
// Use the current font from the global palette
IPalette palette = KryptonManager.CurrentGlobalPalette;
var palette = KryptonManager.CurrentGlobalPalette;
Font font = palette.GetContentShortTextFont(PaletteContentStyle.LabelNormalControl, PaletteState.Normal);
propertyGrid1.Font = font;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void ContentPropertyGrid_Load(object sender, EventArgs e)
private void OnGlobalPaletteChanged(object sender, EventArgs e)
{
// Use the current font from the global palette
IPalette palette = KryptonManager.CurrentGlobalPalette;
var palette = KryptonManager.CurrentGlobalPalette;
Font font = palette.GetContentShortTextFont(PaletteContentStyle.LabelNormalControl, PaletteState.Normal);
propertyGrid1.Font = font;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void ContentPropertyGrid_Load(object sender, EventArgs e)
private void OnGlobalPaletteChanged(object sender, EventArgs e)
{
// Use the current font from the global palette
IPalette palette = KryptonManager.CurrentGlobalPalette;
var palette = KryptonManager.CurrentGlobalPalette;
Font font = palette.GetContentShortTextFont(PaletteContentStyle.LabelNormalControl, PaletteState.Normal);
propertyGrid1.Font = font;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void ContentPropertyGrid_Load(object sender, EventArgs e)
private void OnGlobalPaletteChanged(object sender, EventArgs e)
{
// Use the current font from the global palette
IPalette palette = KryptonManager.CurrentGlobalPalette;
var palette = KryptonManager.CurrentGlobalPalette;
Font font = palette.GetContentShortTextFont(PaletteContentStyle.LabelNormalControl, PaletteState.Normal);
propertyGrid1.Font = font;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MyUserControl : UserControl
{
private bool _mouseOver;
private bool _mouseDown;
private IPalette _palette;
private PaletteBase _palette;

public MyUserControl()
{
Expand All @@ -37,11 +37,11 @@ public MyUserControl()
// Hook into palette events
if (_palette != null)
{
_palette.PalettePaint += new EventHandler<PaletteLayoutEventArgs>(OnPalettePaint);
_palette.PalettePaint += OnPalettePaint;
}

// We want to be notified whenever the global palette changes
KryptonManager.GlobalPaletteChanged += new EventHandler(OnGlobalPaletteChanged);
KryptonManager.GlobalPaletteChanged += OnGlobalPaletteChanged;
}

protected override void Dispose(bool disposing)
Expand All @@ -51,12 +51,12 @@ protected override void Dispose(bool disposing)
// Unhook from the palette events
if (_palette != null)
{
_palette.PalettePaint -= new EventHandler<PaletteLayoutEventArgs>(OnPalettePaint);
_palette.PalettePaint -= OnPalettePaint;
_palette = null;
}

// Unhook from the static events, otherwise we cannot be garbage collected
KryptonManager.GlobalPaletteChanged -= new EventHandler(OnGlobalPaletteChanged);
KryptonManager.GlobalPaletteChanged -= OnGlobalPaletteChanged;
}

base.Dispose(disposing);
Expand Down Expand Up @@ -220,16 +220,16 @@ private void OnGlobalPaletteChanged(object sender, EventArgs e)
// Unhook events from old palette
if (_palette != null)
{
_palette.PalettePaint -= new EventHandler<PaletteLayoutEventArgs>(OnPalettePaint);
_palette.PalettePaint -= OnPalettePaint;
}

// Cache the new IPalette that is the global palette
// Cache the new PaletteBase that is the global palette
_palette = KryptonManager.CurrentGlobalPalette;

// Hook into events for the new palette
if (_palette != null)
{
_palette.PalettePaint += new EventHandler<PaletteLayoutEventArgs>(OnPalettePaint);
_palette.PalettePaint += OnPalettePaint;
}

// Change of palette means we should repaint to show any changes
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3fc274c

Please sign in to comment.