using System.Windows; using System.Windows.Media; namespace MPF.UI { /// /// Represents all required mapping values for the UI /// public abstract class Theme { #region Application-Wide /// /// SolidColorBrush used to paint the active window's border. /// public SolidColorBrush? ActiveBorderBrush { get; protected set; } /// /// SolidColorBrush that paints the face of a three-dimensional display element. /// public SolidColorBrush? ControlBrush { get; protected set; } /// /// SolidColorBrush that paints text in a three-dimensional display element. /// public SolidColorBrush? ControlTextBrush { get; protected set; } /// /// SolidColorBrush that paints disabled text. /// public SolidColorBrush? GrayTextBrush { get; protected set; } /// /// SolidColorBrush that paints the background of a window's client area. /// public SolidColorBrush? WindowBrush { get; protected set; } /// /// SolidColorBrush that paints the text in the client area of a window. /// public SolidColorBrush? WindowTextBrush { get; protected set; } #endregion #region Button /// /// Brush for the Button.Disabled.Background resource /// public Brush? Button_Disabled_Background { get; protected set; } /// /// Brush for the Button.MouseOver.Background resource /// public Brush? Button_MouseOver_Background { get; protected set; } /// /// Brush for the Button.Pressed.Background resource /// public Brush? Button_Pressed_Background { get; protected set; } /// /// Brush for the Button.Static.Background resource /// public Brush? Button_Static_Background { get; protected set; } #endregion #region ComboBox /// /// Brush for the ComboBox.Disabled.Background resource /// public Brush? ComboBox_Disabled_Background { get; protected set; } /// /// Brush for the ComboBox.Disabled.Editable.Background resource /// public Brush? ComboBox_Disabled_Editable_Background { get; protected set; } /// /// Brush for the ComboBox.Disabled.Editable.Button.Background resource /// public Brush? ComboBox_Disabled_Editable_Button_Background { get; protected set; } /// /// Brush for the ComboBox.MouseOver.Background resource /// public Brush? ComboBox_MouseOver_Background { get; protected set; } /// /// Brush for the ComboBox.MouseOver.Editable.Background resource /// public Brush? ComboBox_MouseOver_Editable_Background { get; protected set; } /// /// Brush for the ComboBox.MouseOver.Editable.Button.Background resource /// public Brush? ComboBox_MouseOver_Editable_Button_Background { get; protected set; } /// /// Brush for the ComboBox.Pressed.Background resource /// public Brush? ComboBox_Pressed_Background { get; protected set; } /// /// Brush for the ComboBox.Pressed.Editable.Background resource /// public Brush? ComboBox_Pressed_Editable_Background { get; protected set; } /// /// Brush for the ComboBox.Pressed.Editable.Button.Background resource /// public Brush? ComboBox_Pressed_Editable_Button_Background { get; protected set; } /// /// Brush for the ComboBox.Static.Background resource /// public Brush? ComboBox_Static_Background { get; protected set; } /// /// Brush for the ComboBox.Static.Editable.Background resource /// public Brush? ComboBox_Static_Editable_Background { get; protected set; } /// /// Brush for the ComboBox.Static.Editable.Button.Background resource /// public Brush? ComboBox_Static_Editable_Button_Background { get; protected set; } #endregion #region CustomMessageBox /// /// Brush for the CustomMessageBox.Static.Background resource /// public Brush? CustomMessageBox_Static_Background { get; protected set; } #endregion #region MenuItem /// /// Brush for the MenuItem.SubMenu.Background resource /// public Brush? MenuItem_SubMenu_Background { get; protected set; } /// /// Brush for the MenuItem.SubMenu.Border resource /// public Brush? MenuItem_SubMenu_Border { get; protected set; } #endregion #region ProgressBar /// /// Brush for the ProgressBar.Background resource /// public Brush? ProgressBar_Background { get; protected set; } #endregion #region ScrollViewer /// /// Brush for the ScrollViewer.ScrollBar.Background resource /// public Brush? ScrollViewer_ScrollBar_Background { get; protected set; } #endregion #region TabItem /// /// Brush for the TabItem.Selected.Background resource /// public Brush? TabItem_Selected_Background { get; protected set; } /// /// Brush for the TabItem.Static.Background resource /// public Brush? TabItem_Static_Background { get; protected set; } /// /// Brush for the TabItem.Static.Border resource /// public Brush? TabItem_Static_Border { get; protected set; } #endregion #region TextBox /// /// Brush for the TextBox.Static.Background resource /// public Brush? TextBox_Static_Background { get; protected set; } #endregion /// /// Apply the theme to the current application /// public void Apply() { // Handle application-wide resources Application.Current.Resources[SystemColors.ActiveBorderBrushKey] = this.ActiveBorderBrush; Application.Current.Resources[SystemColors.ControlBrushKey] = this.ControlBrush; Application.Current.Resources[SystemColors.ControlTextBrushKey] = this.ControlTextBrush; Application.Current.Resources[SystemColors.GrayTextBrushKey] = this.GrayTextBrush; Application.Current.Resources[SystemColors.WindowBrushKey] = this.WindowBrush; Application.Current.Resources[SystemColors.WindowTextBrushKey] = this.WindowTextBrush; // Handle Button-specific resources Application.Current.Resources["Button.Disabled.Background"] = this.Button_Disabled_Background; Application.Current.Resources["Button.MouseOver.Background"] = this.Button_MouseOver_Background; Application.Current.Resources["Button.Pressed.Background"] = this.Button_Pressed_Background; Application.Current.Resources["Button.Static.Background"] = this.Button_Static_Background; // Handle ComboBox-specific resources Application.Current.Resources["ComboBox.Disabled.Background"] = this.ComboBox_Disabled_Background; Application.Current.Resources["ComboBox.Disabled.Editable.Background"] = this.ComboBox_Disabled_Editable_Background; Application.Current.Resources["ComboBox.Disabled.Editable.Button.Background"] = this.ComboBox_Disabled_Editable_Button_Background; Application.Current.Resources["ComboBox.MouseOver.Background"] = this.ComboBox_MouseOver_Background; Application.Current.Resources["ComboBox.MouseOver.Editable.Background"] = this.ComboBox_MouseOver_Editable_Background; Application.Current.Resources["ComboBox.MouseOver.Editable.Button.Background"] = this.ComboBox_MouseOver_Editable_Button_Background; Application.Current.Resources["ComboBox.Pressed.Background"] = this.ComboBox_Pressed_Background; Application.Current.Resources["ComboBox.Pressed.Editable.Background"] = this.ComboBox_Pressed_Editable_Background; Application.Current.Resources["ComboBox.Pressed.Editable.Button.Background"] = this.ComboBox_Pressed_Editable_Button_Background; Application.Current.Resources["ComboBox.Static.Background"] = this.ComboBox_Static_Background; Application.Current.Resources["ComboBox.Static.Editable.Background"] = this.ComboBox_Static_Editable_Background; Application.Current.Resources["ComboBox.Static.Editable.Button.Background"] = this.ComboBox_Static_Editable_Button_Background; // Handle CustomMessageBox-specific resources Application.Current.Resources["CustomMessageBox.Static.Background"] = this.CustomMessageBox_Static_Background; // Handle MenuItem-specific resources Application.Current.Resources["MenuItem.SubMenu.Background"] = this.MenuItem_SubMenu_Background; Application.Current.Resources["MenuItem.SubMenu.Border"] = this.MenuItem_SubMenu_Border; // Handle ProgressBar-specific resources Application.Current.Resources["ProgressBar.Background"] = this.ProgressBar_Background; // Handle ScrollViewer-specific resources Application.Current.Resources["ScrollViewer.ScrollBar.Background"] = this.ScrollViewer_ScrollBar_Background; // Handle TabItem-specific resources Application.Current.Resources["TabItem.Selected.Background"] = this.TabItem_Selected_Background; Application.Current.Resources["TabItem.Static.Background"] = this.TabItem_Static_Background; Application.Current.Resources["TabItem.Static.Border"] = this.TabItem_Static_Border; // Handle TextBox-specific resources Application.Current.Resources["TextBox.Static.Background"] = this.TextBox_Static_Background; } } }