-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added AbstractThemePlugin to make plugin implementations more error p…
…roof (#29)
- Loading branch information
1 parent
314d303
commit 3f842bc
Showing
7 changed files
with
50 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
WinFormsThemes/WinFormsThemes/Themes/AbstractThemePlugin.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
namespace WinFormsThemes.Themes | ||
{ | ||
/// <summary> | ||
/// helper implementation to make implementing <see cref="IThemePlugin"/> easier | ||
/// </summary> | ||
/// <typeparam name="T">the control type this plugin supports</typeparam> | ||
public abstract class AbstractThemePlugin<T> : IThemePlugin where T : Control | ||
{ | ||
public void Apply(Control control, AbstractTheme theme) | ||
{ | ||
ApplyPlugin((T)control, theme); | ||
} | ||
|
||
/// <summary> | ||
/// should be implemented by the plugin to style the given control | ||
/// </summary> | ||
/// <param name="control">the control to style</param> | ||
/// <param name="theme">the theme to be applied</param> | ||
protected abstract void ApplyPlugin(T control, AbstractTheme theme); | ||
|
||
public Type GetSupportedType() | ||
{ | ||
return typeof(T); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters