mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 22:34:09 +02:00
Support for empty parent, for | to separate columns
This commit is contained in:
parent
3552837b4f
commit
be3c968e2b
2 changed files with 40 additions and 9 deletions
|
@ -29,21 +29,30 @@ namespace Beefy.theme.dark
|
||||||
let darkMenuWidget = (DarkMenuWidget)mMenuWidget;
|
let darkMenuWidget = (DarkMenuWidget)mMenuWidget;
|
||||||
g.SetFont(mMenuItem.mBold ? darkMenuWidget.mBoldFont : darkMenuWidget.mFont);
|
g.SetFont(mMenuItem.mBold ? darkMenuWidget.mBoldFont : darkMenuWidget.mFont);
|
||||||
|
|
||||||
if (mMenuItem.mDisabled)
|
using (g.PushColor(mMenuItem.mDisabled ? 0xFFA8A8A8 : 0xFFFFFFFF))
|
||||||
{
|
{
|
||||||
using (g.PushColor(0xFFA8A8A8))
|
StringView leftStr = mMenuItem.mLabel;
|
||||||
g.DrawString(mMenuItem.mLabel, GS!(36), 0);
|
StringView rightStr = default;
|
||||||
}
|
int barIdx = leftStr.IndexOf('|');
|
||||||
else
|
if (barIdx != -1)
|
||||||
g.DrawString(mMenuItem.mLabel, GS!(36), 0);
|
{
|
||||||
|
rightStr = .(leftStr, barIdx + 1);
|
||||||
|
leftStr.RemoveToEnd(barIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
g.DrawString(leftStr, GS!(36), 0);
|
||||||
|
if (!rightStr.IsEmpty)
|
||||||
|
g.DrawString(rightStr, mWidth - GS!(8), 0, .Right);
|
||||||
|
}
|
||||||
|
|
||||||
if (mMenuItem.mIconImage != null)
|
if (mMenuItem.mIconImage != null)
|
||||||
g.Draw(mMenuItem.mIconImage, GS!(4), 0);
|
g.Draw(mMenuItem.mIconImage, GS!(4), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMenuItem.mItems.Count > 0)
|
if (mMenuItem.IsParent)
|
||||||
{
|
{
|
||||||
g.Draw(DarkTheme.sDarkTheme.GetImage(DarkTheme.ImageIdx.RightArrow), mWidth - GS!(16), 0);
|
using (g.PushColor(mMenuItem.mDisabled ? 0xFFA8A8A8 : 0xFFFFFFFF))
|
||||||
|
g.Draw(DarkTheme.sDarkTheme.GetImage(DarkTheme.ImageIdx.RightArrow), mWidth - GS!(16), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -551,12 +551,34 @@ namespace Beefy.widgets
|
||||||
public bool mDisabled;
|
public bool mDisabled;
|
||||||
public bool mBold;
|
public bool mBold;
|
||||||
public IDrawable mIconImage;
|
public IDrawable mIconImage;
|
||||||
|
public bool mForceParent;
|
||||||
|
|
||||||
public ~this()
|
public ~this()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsEmpty
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return mItems.IsEmpty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsParent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return !mItems.IsEmpty || mForceParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
mForceParent = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual Menu AddItem(StringView label = default)
|
public virtual Menu AddItem(StringView label = default)
|
||||||
{
|
{
|
||||||
Menu item = new Menu();
|
Menu item = new Menu();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue