inactive border colors

This commit is contained in:
Michael 2017-06-20 18:02:13 -04:00
parent df14761a81
commit 41504bdc15
3 changed files with 151 additions and 25 deletions

View file

@ -48,6 +48,8 @@ namespace ShiftOS.WinForms
/// </summary>
public partial class WindowBorder : Form, IWindowBorder
{
private bool IsFocused { get; set; }
/// <summary>
/// Raises the closing event.
/// </summary>
@ -109,6 +111,17 @@ namespace ShiftOS.WinForms
public WindowBorder(UserControl win)
{
InitializeComponent();
IsFocused = true;
this.Activated += (o, a) =>
{
IsFocused = true;
SetupSkin();
};
this.Deactivate += (o, a) =>
{
IsFocused = false;
SetupSkin();
};
this._parentWindow = win;
Shiftorium.Installed += () =>
{
@ -255,49 +268,93 @@ namespace ShiftOS.WinForms
/// <returns>The skin.</returns>
public void SetupSkin()
{
//Border colors and images...
if (IsFocused)
{
pnltitle.BackColor = LoadedSkin.TitleBackgroundColor;
pnltitle.BackgroundImage = GetImage("titlebar");
pnltitleleft.BackColor = LoadedSkin.TitleLeftCornerBackground;
pnltitleright.BackColor = LoadedSkin.TitleRightCornerBackground;
pnltitleleft.BackgroundImage = GetImage("titleleft");
pnltitleleft.BackgroundImageLayout = GetImageLayout("titleleft");
pnltitleright.BackgroundImage = GetImage("titleright");
pnltitleright.BackgroundImageLayout = GetImageLayout("titleright");
pnltitle.BackgroundImageLayout = GetImageLayout("titlebar"); //RETARD ALERT. WHY WASN'T THIS THERE WHEN IMAGELAYOUTS WERE FIRST IMPLEMENTED?
pnlleft.BackColor = LoadedSkin.BorderLeftBackground;
pnlleft.BackgroundImage = GetImage("leftborder");
pnlleft.BackgroundImageLayout = GetImageLayout("leftborder");
pnlright.BackColor = LoadedSkin.BorderRightBackground;
pnlright.BackgroundImage = GetImage("rightborder");
pnlright.BackgroundImageLayout = GetImageLayout("rightborder");
pnlbottom.BackColor = LoadedSkin.BorderBottomBackground;
pnlbottom.BackgroundImage = GetImage("bottomborder");
pnlbottom.BackgroundImageLayout = GetImageLayout("bottomborder");
pnlbottomr.BackColor = LoadedSkin.BorderBottomRightBackground;
pnlbottomr.BackgroundImage = GetImage("bottomrborder");
pnlbottomr.BackgroundImageLayout = GetImageLayout("bottomrborder");
pnlbottoml.BackColor = LoadedSkin.BorderBottomLeftBackground;
pnlbottoml.BackgroundImage = GetImage("bottomlborder");
pnlbottoml.BackgroundImageLayout = GetImageLayout("bottomlborder");
}
else
{
pnltitle.BackColor = LoadedSkin.TitleInactiveBackgroundColor;
pnltitle.BackgroundImage = GetImage("titlebarinactive");
pnltitleleft.BackColor = LoadedSkin.TitleInactiveLeftCornerBackground;
pnltitleright.BackColor = LoadedSkin.TitleInactiveRightCornerBackground;
pnltitleleft.BackgroundImage = GetImage("titleleftinactive");
pnltitleleft.BackgroundImageLayout = GetImageLayout("titleleftinactive");
pnltitleright.BackgroundImage = GetImage("titlerightinactive");
pnltitleright.BackgroundImageLayout = GetImageLayout("titlerightinactive");
pnltitle.BackgroundImageLayout = GetImageLayout("titlebarinactive"); //RETARD ALERT. WHY WASN'T THIS THERE WHEN IMAGELAYOUTS WERE FIRST IMPLEMENTED?
pnlleft.BackColor = LoadedSkin.BorderInactiveLeftBackground;
pnlleft.BackgroundImage = GetImage("leftborderinactive");
pnlleft.BackgroundImageLayout = GetImageLayout("leftborderinactive");
pnlright.BackColor = LoadedSkin.BorderInactiveRightBackground;
pnlright.BackgroundImage = GetImage("rightborderinactive");
pnlright.BackgroundImageLayout = GetImageLayout("rightborderinactive");
pnlbottom.BackColor = LoadedSkin.BorderInactiveBottomBackground;
pnlbottom.BackgroundImage = GetImage("bottomborderinactive");
pnlbottom.BackgroundImageLayout = GetImageLayout("bottomborderinactive");
pnlbottomr.BackColor = LoadedSkin.BorderInactiveBottomRightBackground;
pnlbottomr.BackgroundImage = GetImage("bottomrborderinactive");
pnlbottomr.BackgroundImageLayout = GetImageLayout("bottomrborderinactive");
pnlbottoml.BackColor = LoadedSkin.BorderInactiveBottomLeftBackground;
pnlbottoml.BackgroundImage = GetImage("bottomlborderinactive");
pnlbottoml.BackgroundImageLayout = GetImageLayout("bottomlborderinactive");
}
this.DoubleBuffered = true;
this.TransparencyKey = LoadedSkin.SystemKey;
pnlcontents.BackColor = this.TransparencyKey;
pnltitle.Height = LoadedSkin.TitlebarHeight;
pnltitle.BackColor = LoadedSkin.TitleBackgroundColor;
pnltitle.BackgroundImage = GetImage("titlebar");
pnltitleleft.Visible = LoadedSkin.ShowTitleCorners;
pnltitleright.Visible = LoadedSkin.ShowTitleCorners;
pnltitleleft.BackColor = LoadedSkin.TitleLeftCornerBackground;
pnltitleright.BackColor = LoadedSkin.TitleRightCornerBackground;
pnltitleleft.Width = LoadedSkin.TitleLeftCornerWidth;
pnltitleright.Width = LoadedSkin.TitleRightCornerWidth;
pnltitleleft.BackgroundImage = GetImage("titleleft");
pnltitleleft.BackgroundImageLayout = GetImageLayout("titleleft");
pnltitleright.BackgroundImage = GetImage("titleright");
pnltitleright.BackgroundImageLayout = GetImageLayout("titleright");
pnltitle.BackgroundImageLayout = GetImageLayout("titlebar"); //RETARD ALERT. WHY WASN'T THIS THERE WHEN IMAGELAYOUTS WERE FIRST IMPLEMENTED?
lbtitletext.BackColor = (pnltitle.BackgroundImage != null) ? Color.Transparent : LoadedSkin.TitleBackgroundColor;
lbtitletext.ForeColor = LoadedSkin.TitleTextColor;
lbtitletext.Font = LoadedSkin.TitleFont;
pnlleft.BackColor = LoadedSkin.BorderLeftBackground;
pnlleft.BackgroundImage = GetImage("leftborder");
pnlleft.BackgroundImageLayout = GetImageLayout("leftborder");
pnlleft.Width = LoadedSkin.LeftBorderWidth;
pnlright.BackColor = LoadedSkin.BorderRightBackground;
pnlright.BackgroundImage = GetImage("rightborder");
pnlright.BackgroundImageLayout = GetImageLayout("rightborder");
pnlright.Width = LoadedSkin.RightBorderWidth;
pnlbottom.BackColor = LoadedSkin.BorderBottomBackground;
pnlbottom.BackgroundImage = GetImage("bottomborder");
pnlbottom.BackgroundImageLayout = GetImageLayout("bottomborder");
pnlbottom.Height = LoadedSkin.BottomBorderWidth;
pnlbottomr.BackColor = LoadedSkin.BorderBottomRightBackground;
pnlbottomr.BackgroundImage = GetImage("bottomrborder");
pnlbottomr.BackgroundImageLayout = GetImageLayout("bottomrborder");
pnlbottomr.Width = pnlright.Width;
pnlbottoml.BackColor = LoadedSkin.BorderBottomLeftBackground;
pnlbottoml.BackgroundImage = GetImage("bottomlborder");
pnlbottoml.BackgroundImageLayout = GetImageLayout("bottomlborder");
pnlbottoml.Width = pnlleft.Width;
lbtitletext.ForeColor = LoadedSkin.TitleTextColor;

View file

@ -910,6 +910,7 @@ namespace ShiftOS.WinForms
public void ShowWindow(IWindowBorder border)
{
var brdr = border as Form;
focused = border;
brdr.GotFocus += (o, a) =>
{

View file

@ -574,6 +574,15 @@ namespace ShiftOS.Engine
[ShifterDescription("The color of the titlebar's background.")]
public Color TitleBackgroundColor = TitleBG;
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
[ShifterName("Title Inactive Background Color")]
[RequiresUpgrade("shift_titlebar;shift_states")]
[ShifterDescription("The color of the titlebar's background when the window isn't active.")]
public Color TitleInactiveBackgroundColor = Skin.DefaultBackground;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Left Border Background")]
@ -581,6 +590,14 @@ namespace ShiftOS.Engine
[ShifterDescription("The background color for the left border.")]
public Color BorderLeftBackground = TitleBG;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Left Border Inactive Background")]
[RequiresUpgrade("shift_window_borders;shift_states")]
[ShifterDescription("The background color for the left border when the window is inactive.")]
public Color BorderInactiveLeftBackground = DefaultBackground;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Right Border Background")]
@ -588,6 +605,14 @@ namespace ShiftOS.Engine
[ShifterDescription("The background color for the right border.")]
public Color BorderRightBackground = TitleBG;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Right Border Inactive Background")]
[RequiresUpgrade("shift_window_borders;shift_states")]
[ShifterDescription("The background color for the right border when the window is inactive.")]
public Color BorderInactiveRightBackground = DefaultBackground;
[ShifterMeta("Desktop")]
[ShifterCategory("Panel buttons")]
[RequiresUpgrade("shift_panel_buttons")]
@ -602,6 +627,14 @@ namespace ShiftOS.Engine
[ShifterDescription("The background color for the bottom border.")]
public Color BorderBottomBackground = TitleBG;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Bottom Border Inactive Background")]
[RequiresUpgrade("shift_window_borders;shift_states")]
[ShifterDescription("The background color for the bottom border when the window is inactive.")]
public Color BorderInactiveBottomBackground = DefaultBackground;
[ShifterMeta("Desktop")]
[ShifterCategory("Panel buttons")]
[ShifterName("Panel button holder from left")]
@ -609,6 +642,14 @@ namespace ShiftOS.Engine
[RequiresUpgrade("shift_panel_buttons")]
public int PanelButtonHolderFromLeft = 100;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Bottom Left Border Inactive Background")]
[RequiresUpgrade("shift_window_borders;shift_states")]
[ShifterDescription("The background color for the bottom left border when the window is inactive.")]
public Color BorderInactiveBottomLeftBackground = DefaultBackground;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Bottom Left Border Background")]
@ -616,6 +657,7 @@ namespace ShiftOS.Engine
[ShifterDescription("The background color for the bottom left border.")]
public Color BorderBottomLeftBackground = TitleBG;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Bottom Right Border Background")]
@ -623,6 +665,14 @@ namespace ShiftOS.Engine
[ShifterDescription("The background color for the bottom right border.")]
public Color BorderBottomRightBackground = TitleBG;
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Bottom Right Border Inactive Background")]
[RequiresUpgrade("shift_window_borders;shift_states")]
[ShifterDescription("The background color for the bottom right border when the window is inactive.")]
public Color BorderInactiveBottomRightBackground = DefaultBackground;
[ShifterMeta("Windows")]
[ShifterCategory("Title Buttons")]
[ShifterName("Close Button Color")]
@ -1148,6 +1198,15 @@ namespace ShiftOS.Engine
[ShifterDescription("What color should be used for the left title corner?")]
public Color TitleLeftCornerBackground = TitleBG;
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
[RequiresUpgrade("shift_titlebar;shift_states")]
[ShifterFlag("ShowTitleCorners", true)]
[ShifterName("Title left inactive background color")]
[ShifterDescription("What color should be used for the left title corner when the window is inactive?")]
public Color TitleInactiveLeftCornerBackground = DefaultBackground;
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
[RequiresUpgrade("shift_titlebar")]
@ -1156,6 +1215,15 @@ namespace ShiftOS.Engine
[ShifterDescription("What color should be used for the right title corner?")]
public Color TitleRightCornerBackground = TitleBG;
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
[RequiresUpgrade("shift_titlebar;shift_states")]
[ShifterFlag("ShowTitleCorners", true)]
[ShifterName("Title right inactive background color")]
[ShifterDescription("What color should be used for the right title corner when the window is inactive?")]
public Color TitleInactiveRightCornerBackground = DefaultBackground;
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
[RequiresUpgrade("shift_titlebar")]