From cd2190f6caa16e8d909aa1d662996d690772a67f Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 27 Jun 2017 20:07:09 -0400 Subject: [PATCH] Multistate title button skinning. --- ShiftOS.WinForms/WindowBorder.Designer.cs | 12 + ShiftOS.WinForms/WindowBorder.cs | 108 ++++++++ ShiftOS_TheReturn/Skinning.cs | 292 +++++++++++++++------- 3 files changed, 326 insertions(+), 86 deletions(-) diff --git a/ShiftOS.WinForms/WindowBorder.Designer.cs b/ShiftOS.WinForms/WindowBorder.Designer.cs index e862c35..490e1fb 100644 --- a/ShiftOS.WinForms/WindowBorder.Designer.cs +++ b/ShiftOS.WinForms/WindowBorder.Designer.cs @@ -107,6 +107,10 @@ namespace ShiftOS.WinForms this.pnlminimize.Size = new System.Drawing.Size(24, 24); this.pnlminimize.TabIndex = 3; this.pnlminimize.Click += new System.EventHandler(this.pnlminimize_Click); + this.pnlminimize.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pnlminimize_MouseDown); + this.pnlminimize.MouseEnter += new System.EventHandler(this.pnlminimize_MouseEnter); + this.pnlminimize.MouseLeave += new System.EventHandler(this.pnlminimize_MouseLeave); + this.pnlminimize.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pnlminimize_MouseUp); // // pnlmaximize // @@ -117,6 +121,10 @@ namespace ShiftOS.WinForms this.pnlmaximize.Size = new System.Drawing.Size(24, 24); this.pnlmaximize.TabIndex = 2; this.pnlmaximize.Click += new System.EventHandler(this.pnlmaximize_Click); + this.pnlmaximize.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pnlmaximize_MouseDown); + this.pnlmaximize.MouseEnter += new System.EventHandler(this.pnlmaximize_MouseEnter); + this.pnlmaximize.MouseLeave += new System.EventHandler(this.pnlmaximize_MouseLeave); + this.pnlmaximize.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pnlmaximize_MouseUp); // // pnlclose // @@ -127,6 +135,10 @@ namespace ShiftOS.WinForms this.pnlclose.Size = new System.Drawing.Size(24, 24); this.pnlclose.TabIndex = 1; this.pnlclose.Click += new System.EventHandler(this.pnlclose_Click); + this.pnlclose.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pnlclose_MouseDown); + this.pnlclose.MouseEnter += new System.EventHandler(this.pnlclose_MouseEnter); + this.pnlclose.MouseLeave += new System.EventHandler(this.pnlclose_MouseLeave); + this.pnlclose.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pnlclose_MouseUp); // // pnltitleleft // diff --git a/ShiftOS.WinForms/WindowBorder.cs b/ShiftOS.WinForms/WindowBorder.cs index 0ee1289..e056350 100644 --- a/ShiftOS.WinForms/WindowBorder.cs +++ b/ShiftOS.WinForms/WindowBorder.cs @@ -686,5 +686,113 @@ namespace ShiftOS.WinForms } } + + private void pnlclose_MouseDown(object sender, MouseEventArgs e) + { + pnlclose.BackColor = LoadedSkin.CloseButtonDownColor; + if(LoadedSkin.CloseButtonDownImage != null) + { + pnlclose.BackgroundImage = GetImage("closebuttondown"); + pnlclose.BackgroundImageLayout = GetImageLayout("closebuttondown"); + } + } + + private void pnlclose_MouseEnter(object sender, EventArgs e) + { + pnlclose.BackColor = LoadedSkin.CloseButtonOverColor; + if (LoadedSkin.CloseButtonOverImage != null) + { + pnlclose.BackgroundImage = GetImage("closebuttonover"); + pnlclose.BackgroundImageLayout = GetImageLayout("closebuttonover"); + } + + } + + private void pnlclose_MouseLeave(object sender, EventArgs e) + { + pnlclose.BackColor = LoadedSkin.CloseButtonColor; + pnlclose.BackgroundImage = GetImage("closebutton"); + pnlclose.BackgroundImageLayout = GetImageLayout("closebutton"); + } + + private void pnlclose_MouseUp(object sender, MouseEventArgs e) + { + pnlclose.BackColor = LoadedSkin.CloseButtonColor; + pnlclose.BackgroundImage = GetImage("closebutton"); + pnlclose.BackgroundImageLayout = GetImageLayout("closebutton"); + + } + + private void pnlmaximize_MouseDown(object sender, MouseEventArgs e) + { + + pnlmaximize.BackColor = LoadedSkin.MaximizeButtonDownColor; + if (LoadedSkin.MaximizeButtonDownImage != null) + { + pnlmaximize.BackgroundImage = GetImage("maximizebuttondown"); + pnlmaximize.BackgroundImageLayout = GetImageLayout("maximizebuttondown"); + } + } + + private void pnlmaximize_MouseEnter(object sender, EventArgs e) + { + pnlmaximize.BackColor = LoadedSkin.MaximizeButtonOverColor; + if (LoadedSkin.MaximizeButtonOverImage != null) + { + pnlmaximize.BackgroundImage = GetImage("maximizebuttonover"); + pnlmaximize.BackgroundImageLayout = GetImageLayout("maximizebuttonover"); + } + + } + + private void pnlmaximize_MouseLeave(object sender, EventArgs e) + { + pnlmaximize.BackColor = LoadedSkin.MaximizeButtonColor; + pnlmaximize.BackgroundImage = GetImage("maximizebutton"); + pnlmaximize.BackgroundImageLayout = GetImageLayout("maximizebutton"); + } + + private void pnlmaximize_MouseUp(object sender, MouseEventArgs e) + { + pnlmaximize.BackColor = LoadedSkin.MaximizeButtonColor; + pnlmaximize.BackgroundImage = GetImage("maximizebutton"); + pnlmaximize.BackgroundImageLayout = GetImageLayout("maximizebutton"); + } + + private void pnlminimize_MouseDown(object sender, MouseEventArgs e) + { + + pnlminimize.BackColor = LoadedSkin.MinimizeButtonDownColor; + if (LoadedSkin.MinimizeButtonDownImage != null) + { + pnlminimize.BackgroundImage = GetImage("minimizebuttondown"); + pnlminimize.BackgroundImageLayout = GetImageLayout("minimizebuttondown"); + } + } + + private void pnlminimize_MouseEnter(object sender, EventArgs e) + { + pnlminimize.BackColor = LoadedSkin.MinimizeButtonOverColor; + if (LoadedSkin.MinimizeButtonOverImage != null) + { + pnlminimize.BackgroundImage = GetImage("minimizebuttonover"); + pnlminimize.BackgroundImageLayout = GetImageLayout("minimizebuttonover"); + } + + } + + private void pnlminimize_MouseLeave(object sender, EventArgs e) + { + pnlminimize.BackColor = LoadedSkin.MinimizeButtonColor; + pnlminimize.BackgroundImage = GetImage("minimizebutton"); + pnlminimize.BackgroundImageLayout = GetImageLayout("minimizebutton"); + } + + private void pnlminimize_MouseUp(object sender, MouseEventArgs e) + { + pnlminimize.BackColor = LoadedSkin.MinimizeButtonColor; + pnlminimize.BackgroundImage = GetImage("minimizebutton"); + pnlminimize.BackgroundImageLayout = GetImageLayout("minimizebutton"); + } } } diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index e7ebbc7..59c7132 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -679,7 +679,7 @@ namespace ShiftOS.Engine [ShifterDescription("The background color for the bottom right border when the window is inactive.")] public Color BorderInactiveBottomRightBackground = DefaultBackground; - + #region Windows -> Title Buttons -> Idle -> Colors [ShifterMeta("Windows")] [ShifterCategory("Title Buttons")] [ShifterName("Close Button Color")] @@ -694,15 +694,64 @@ namespace ShiftOS.Engine [ShifterDescription("The maximize button color")] public Color MaximizeButtonColor = Accent1; - [ShifterHidden] - public CommandParser CurrentParser = CommandParser.GenerateSample(); - [ShifterMeta("Windows")] [ShifterCategory("Title Buttons")] [ShifterName("Minimize Button Color")] [RequiresUpgrade("shift_title_buttons")] [ShifterDescription("The minimize button color")] public Color MinimizeButtonColor = Accent1; + #endregion + + #region Windows -> Title Buttons -> Over -> Colors + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Close Button Mouse Over Color")] + [RequiresUpgrade("shift_title_buttons;shift_states")] + [ShifterDescription("The close button color when the mouse hovers over it.")] + public Color CloseButtonOverColor = Color.FromArgb(0x80, 0, 0); + + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Maximize Button Mouse Over Color")] + [RequiresUpgrade("shift_title_buttons;shift_states")] + [ShifterDescription("The maximize button color when the mouse hovers over it.")] + public Color MaximizeButtonOverColor = Accent1; + + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Minimize Button Mouse Over Color")] + [RequiresUpgrade("shift_title_buttons;shift_states")] + [ShifterDescription("The minimize button color when the mouse hovers over it")] + public Color MinimizeButtonOverColor = Accent1; + #endregion + + #region Windows -> Title Buttons -> Down -> Colors + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Close Button Mouse Down Color")] + [RequiresUpgrade("shift_title_buttons;shift_states")] + [ShifterDescription("The close button color when the mouse clicks it.")] + public Color CloseButtonDownColor = Color.FromArgb(0x80, 0, 0); + + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Maximize Button Mouse Down Color")] + [RequiresUpgrade("shift_title_buttons;shift_states")] + [ShifterDescription("The maximize button color when the mouse clicks it.")] + public Color MaximizeButtonDownColor = Accent1; + + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Minimize Button Mouse Down Color")] + [RequiresUpgrade("shift_title_buttons;shift_states")] + [ShifterDescription("The minimize button color when the mouse clicks it")] + public Color MinimizeButtonDownColor = Accent1; + #endregion + + + [ShifterHidden] + public CommandParser CurrentParser = CommandParser.GenerateSample(); + [ShifterMeta("Desktop")] [ShifterCategory("Desktop Panel")] @@ -825,6 +874,32 @@ namespace ShiftOS.Engine [ShifterDescription("The background color of the desktop.")] public Color DesktopColor = DesktopBG; + #region Menus -> Toolbars + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Toolbar Border")] + public Color Menu_ToolStripBorder = TitleBG; + + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Dropdown background")] + public Color Menu_ToolStripDropDownBackground = DefaultBackground; + + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Toolbar gradient start")] + public Color Menu_ToolStripGradientBegin = TitleBG; + + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Toolbar gradient middle")] + public Color Menu_ToolStripGradientMiddle = TitleBG; + + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Toolbar gradient end")] + public Color Menu_ToolStripGradientEnd = TitleBG; + [ShifterMeta("Menus")] [ShifterCategory("Toolbars")] [ShifterName("Button select highlight")] @@ -909,6 +984,38 @@ namespace ShiftOS.Engine [ShifterCategory("Toolbars")] [ShifterName("Button pressed gradient end")] public Color Menu_ButtonPressedGradientEnd = Accent1; + #endregion + + #region Menus -> General + [ShifterMeta("Menus")] + [ShifterCategory("General")] + [ShifterName("Menu text color")] + public Color Menu_TextColor = DefaultForeground; + + [ShifterMeta("Menus")] + [ShifterCategory("General")] + [ShifterName("Menu selected text color")] + public Color Menu_SelectedTextColor = TitleFG; + + [ShifterMeta("Menus")] + [ShifterCategory("General")] + [ShifterName("Rafter gradient start")] + public Color Menu_RaftingContainerGradientBegin = TitleBG; + + [ShifterMeta("Menus")] + [ShifterCategory("General")] + [ShifterName("Rafter gradient end")] + public Color Menu_RaftingContainerGradientEnd = TitleBG; + + [ShifterMeta("Menus")] + [ShifterCategory("General")] + [ShifterName("Separator Color 1")] + public Color Menu_SeparatorDark = DefaultForeground; + + [ShifterMeta("Menus")] + [ShifterCategory("General")] + [ShifterName("Separator Color 2")] + public Color Menu_SeparatorLight = TitleFG; [ShifterMeta("Menus")] [ShifterCategory("General")] @@ -924,6 +1031,34 @@ namespace ShiftOS.Engine [ShifterCategory("General")] [ShifterName("Check BG (Pressed)")] public Color Menu_CheckPressedBackground = Accent1; + #endregion + + #region Menus -> Menu Bars + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Menu item pressed gradient start")] + public Color Menu_MenuItemPressedGradientBegin = Accent1; + + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Menu item pressed gradient middle")] + public Color Menu_MenuItemPressedGradientMiddle = Accent1; + + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Menu item pressed gradient end")] + public Color Menu_MenuItemPressedGradientEnd = Accent1; + + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Menu item selected gradient start")] + public Color Menu_MenuItemSelectedGradientBegin = Accent2; + + [ShifterMeta("Menus")] + [ShifterCategory("Toolbars")] + [ShifterName("Menu item selected gradient end")] + public Color Menu_MenuItemSelectedGradientEnd = Accent2; + [ShifterMeta("Menus")] [ShifterCategory("Menu bars")] @@ -964,52 +1099,9 @@ namespace ShiftOS.Engine [ShifterCategory("Menu bars")] [ShifterName("Menu border")] public Color Menu_MenuBorder = DefaultBackground; + #endregion - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Menu item selected gradient start")] - public Color Menu_MenuItemSelectedGradientBegin = Accent2; - - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Menu item selected gradient end")] - public Color Menu_MenuItemSelectedGradientEnd = Accent2; - - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Menu item pressed gradient start")] - public Color Menu_MenuItemPressedGradientBegin = Accent1; - - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Menu item pressed gradient middle")] - public Color Menu_MenuItemPressedGradientMiddle = Accent1; - - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Menu item pressed gradient end")] - public Color Menu_MenuItemPressedGradientEnd = Accent1; - - [ShifterMeta("Menus")] - [ShifterCategory("General")] - [ShifterName("Rafter gradient start")] - public Color Menu_RaftingContainerGradientBegin = TitleBG; - - [ShifterMeta("Menus")] - [ShifterCategory("General")] - [ShifterName("Rafter gradient end")] - public Color Menu_RaftingContainerGradientEnd = TitleBG; - - [ShifterMeta("Menus")] - [ShifterCategory("General")] - [ShifterName("Separator Color 1")] - public Color Menu_SeparatorDark = DefaultForeground; - - [ShifterMeta("Menus")] - [ShifterCategory("General")] - [ShifterName("Separator Color 2")] - public Color Menu_SeparatorLight = TitleFG; - + #region Menus -> Status bars [ShifterMeta("Menus")] [ShifterCategory("Status bars")] [ShifterName("Status bar gradient start")] @@ -1019,32 +1111,9 @@ namespace ShiftOS.Engine [ShifterCategory("Status bars")] [ShifterName("Status bar gradient end")] public Color Menu_StatusStripGradientEnd = TitleBG; + #endregion - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Toolbar Border")] - public Color Menu_ToolStripBorder = TitleBG; - - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Dropdown background")] - public Color Menu_ToolStripDropDownBackground = DefaultBackground; - - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Toolbar gradient start")] - public Color Menu_ToolStripGradientBegin = TitleBG; - - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Toolbar gradient middle")] - public Color Menu_ToolStripGradientMiddle = TitleBG; - - [ShifterMeta("Menus")] - [ShifterCategory("Toolbars")] - [ShifterName("Toolbar gradient end")] - public Color Menu_ToolStripGradientEnd = TitleBG; - + #region Menus -> Menu holders [ShifterMeta("Menus")] [ShifterCategory("Menu holders")] [ShifterName("Content panel gradient start")] @@ -1064,19 +1133,9 @@ namespace ShiftOS.Engine [ShifterCategory("Menu holders")] [ShifterName("Panel gradient end")] public Color Menu_ToolStripPanelGradientEnd = TitleBG; + #endregion - [ShifterMeta("Menus")] - [ShifterCategory("General")] - [ShifterName("Menu text color")] - public Color Menu_TextColor = DefaultForeground; - - [ShifterMeta("Menus")] - [ShifterCategory("General")] - [ShifterName("Menu selected text color")] - public Color Menu_SelectedTextColor = TitleFG; - - - + #region Windows -> Title Buttons -> Idle -> Images //Images [Image("closebutton")] [ShifterMeta("Windows")] @@ -1101,7 +1160,64 @@ namespace ShiftOS.Engine [RequiresUpgrade("shift_title_buttons;skinning")] [ShifterDescription("Show an image on the Maximize Button using this setting.")] public byte[] MaximizeButtonImage = null; + #endregion + #region Windows -> Title Buttons -> Mouse Over -> Images + //Images + [Image("closebuttonover")] + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Close Button Mouse Over Image")] + [RequiresUpgrade("shift_title_buttons;skinning;shift_states")] + [ShifterDescription("Show an image on the Close Button when the mouse hovers over it using this setting.")] + public byte[] CloseButtonOverImage = null; + + [Image("minimizebuttonover")] + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Minimize Button Mouse Over Image")] + [RequiresUpgrade("shift_title_buttons;skinning;shift_states")] + [ShifterDescription("Show an image on the Minimize Button when the mouse hovers over it using this setting.")] + public byte[] MinimizeButtonOverImage = null; + + [Image("maximizebuttonover")] + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Maximize Button Mouse Over Image")] + [RequiresUpgrade("shift_title_buttons;skinning;shift_states")] + [ShifterDescription("Show an image on the Maximize Button when the mouse hovers over it using this setting.")] + public byte[] MaximizeButtonOverImage = null; + #endregion + + #region Windows -> Title Buttons -> Mouse Down -> Images + //Images + [Image("closebuttondown")] + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Close Button Mouse Down Image")] + [RequiresUpgrade("shift_title_buttons;skinning;shift_states")] + [ShifterDescription("Show an image on the Close Button when the mouse clicks it using this setting.")] + public byte[] CloseButtonDownImage = null; + + [Image("minimizebuttondown")] + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Minimize Button Mouse Down Image")] + [RequiresUpgrade("shift_title_buttons;skinning;shift_states")] + [ShifterDescription("Show an image on the Minimize Button when the mouse clicks it using this setting.")] + public byte[] MinimizeButtonDownImage = null; + + [Image("maximizebuttondown")] + [ShifterMeta("Windows")] + [ShifterCategory("Title Buttons")] + [ShifterName("Maximize Button Mouse Down Image")] + [RequiresUpgrade("shift_title_buttons;skinning;shift_states")] + [ShifterDescription("Show an image on the Maximize Button when the mouse clicks it using this setting.")] + public byte[] MaximizeButtonDownImage = null; + #endregion + + + #region Desktop -> Images [Image("desktopbackground")] [ShifterMeta("Desktop")] [ShifterCategory("General")] @@ -1160,7 +1276,10 @@ namespace ShiftOS.Engine [Image("applauncher")] [RequiresUpgrade("skinning;shift_app_launcher")] public byte[] AppLauncherImage = null; + #endregion + + #region System -> General [ShifterMeta("System")] [ShifterCategory("General")] [ShifterName("Terminal font")] @@ -1175,6 +1294,7 @@ namespace ShiftOS.Engine [ShifterCategory("General")] [ShifterName("Terminal background color")] public ConsoleColor TerminalBackColorCC = ConsoleColor.Black; + #endregion [ShifterMeta("Desktop")] [ShifterCategory("Desktop Panel")]