1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

More scaling fixes, frameless combo box for status bar

This commit is contained in:
Brian Fiete 2020-03-30 07:28:04 -07:00
parent 990d092274
commit 385fa6dbb5
10 changed files with 30 additions and 17 deletions

View file

@ -41,10 +41,17 @@ namespace Beefy.theme.dark
}
}*/
public enum FrameKind
{
OnWindow,
Frameless,
Transparent
}
String mLabel ~ delete _;
public float mLabelX = GS!(8);
public FontAlign mLabelAlign = FontAlign.Centered;
public bool mFrameless = false;
public FrameKind mFrameKind = .OnWindow;
public Event<Action<Menu>> mPopulateMenuAction ~ _.Dispose();
public CBMenuWidget mCurMenuWidget;
@ -96,12 +103,12 @@ namespace Beefy.theme.dark
return;
}
if (!mFrameless)
if ((mFrameKind == .OnWindow) || (mFrameKind == .Frameless))
{
Image texture = DarkTheme.sDarkTheme.mImages[(int32)DarkTheme.ImageIdx.ComboBox];
g.DrawBox(texture, 0, -2, mWidth, mHeight);
Image texture = DarkTheme.sDarkTheme.mImages[(mFrameKind == .OnWindow) ? (int32)DarkTheme.ImageIdx.ComboBox : (int32)DarkTheme.ImageIdx.ComboBoxFrameless];
g.DrawBox(texture, 0, GS!(-2), mWidth, mHeight);
}
else
else
{
if (mBkgColor != 0)
{
@ -125,7 +132,7 @@ namespace Beefy.theme.dark
float fontHeight = g.mFont.GetHeight();
//g.DrawString(label, mLabelX, (mHeight - GS!(24)) / 2, mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
g.DrawString(label, mLabelX, (mHeight - fontHeight) / 2 - GS!(2) - 1, mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
g.DrawString(label, mLabelX, (mHeight - fontHeight) / 2 - (int)GS!(3.5f), mLabelAlign, mWidth - mLabelX - GS!(24), FontOverflowMode.Ellipsis);
}
}
@ -134,7 +141,10 @@ namespace Beefy.theme.dark
using (g.PushColor(DarkTheme.COLOR_SELECTED_OUTLINE))
g.DrawBox(DarkTheme.sDarkTheme.GetImage(.Outline), GS!(2), 0, mWidth - GS!(4), mHeight - GS!(4));
}
}
}
/*using (g.PushColor(0x1FFF0000))
g.FillRect(0, 0, mWidth, mHeight);*/
}
public void GetLabel(String label)
@ -184,7 +194,7 @@ namespace Beefy.theme.dark
popupXOfs = GS!(2);
popupYOfs = GS!(2);
}
else if (mFrameless)
else if (mFrameKind == .Transparent)
{
popupXOfs = GS!(2);
popupYOfs = GS!(2);

View file

@ -481,7 +481,7 @@ namespace Beefy.theme.dark
useWidth = Math.Max(mWidth - GS!(36), 0);
useWidth = (float)Math.Round(useWidth);
tabButton.Resize(curX, tabButton.mY, useWidth, tabButton.mHeight);
tabButton.Resize(curX, tabButton.mY, useWidth, DarkTheme.sUnitSize);
//float offset = tabIdx - leftObscure;
float widthSubtract = Math.Max(0, leftObscure);
@ -590,7 +590,7 @@ namespace Beefy.theme.dark
mChildWidgets.Insert(0, tabButton);
tabButton.Resize(curX, tabButton.mY, tabButton.mWidth, tabButton.mHeight);
tabButton.Resize(curX, tabButton.mY, tabButton.mWidth, DarkTheme.sUnitSize);
curX += showWidth;
}

View file

@ -181,6 +181,7 @@ namespace Beefy.theme.dark
CheckIndeterminate,
CodeError,
CodeWarning,
ComboBoxFrameless,
COUNT
};