1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +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
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before After
Before After

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Before After
Before After

View file

@ -1877,7 +1877,7 @@ namespace IDE.ui
if (propIdx == 0)
{
var comboBox = new DarkComboBox();
comboBox.mFrameless = true;
comboBox.mFrameKind = .Transparent;
comboBox.mPopulateMenuAction.Add(new (menu) => { PopulateComboBox(menu, propEntries); });
subItem.AddWidget(comboBox);
subItem.mOnResized.Add(new (evt) => { comboBox.Resize(0, 0, GetValueEditWidth(subItem), subItem.mHeight + 1); });

View file

@ -27,11 +27,13 @@ namespace IDE.ui
public this()
{
mConfigComboBox = new DarkComboBox();
mConfigComboBox = new DarkComboBox();
mConfigComboBox.mFrameKind = .Frameless;
mConfigComboBox.mPopulateMenuAction.Add(new => PopulateConfigMenu);
AddWidget(mConfigComboBox);
mPlatformComboBox = new DarkComboBox();
mPlatformComboBox = new DarkComboBox();
mPlatformComboBox.mFrameKind = .Frameless;
mPlatformComboBox.mPopulateMenuAction.Add(new => PopulatePlatformMenu);
AddWidget(mPlatformComboBox);
}
@ -94,8 +96,8 @@ namespace IDE.ui
void ResizeComponents()
{
int btnLeft = gApp.mSettings.mEnableDevMode ? GS!(380) : GS!(300);
mConfigComboBox.Resize(mWidth - btnLeft, 0, GS!(120), mHeight + 2);
mPlatformComboBox.Resize(mWidth - btnLeft - GS!(120), 0, GS!(120), mHeight + 2);
mConfigComboBox.Resize(mWidth - btnLeft, GS!(0), GS!(120), GS!(24));
mPlatformComboBox.Resize(mWidth - btnLeft - GS!(120), GS!(0), GS!(120), GS!(24));
if (mCancelSymSrvButton != null)
mCancelSymSrvButton.Resize(GS!(546), 0, GS!(20), GS!(20));

View file

@ -634,7 +634,7 @@ namespace IDE.ui
configItem = listViewItem.CreateSubItem(1);
configItem.Label = configSelection.mConfig;
configComboBox = new DarkComboBox();
configComboBox.mFrameless = true;
configComboBox.mFrameKind = .Transparent;
configComboBox.mPopulateMenuAction.Add(new (menu) => { PopulateProjectConfigMenu(menu, configItem, project, newConfigSelection); });
configItem.AddWidget(configComboBox);
configItem.mOnResized.Add(new (evt) => { configComboBox.Resize(0, 0, configItem.mWidth, configItem.mHeight + 1); });
@ -643,7 +643,7 @@ namespace IDE.ui
platformItem = listViewItem.CreateSubItem(2);
platformItem.Label = configSelection.mPlatform;
platformComboBox = new DarkComboBox();
platformComboBox.mFrameless = true;
platformComboBox.mFrameKind = .Transparent;
platformComboBox.mPopulateMenuAction.Add(new (menu) => { PopulateProjectPlatformMenu(menu, platformItem, project, newConfigSelection); });
platformItem.AddWidget(platformComboBox);
platformItem.mOnResized.Add(new (evt) => { platformComboBox.Resize(0, 0, GetValueEditWidth(platformItem), platformItem.mHeight + 1); });