1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-06 08:15:59 +02:00

Recent file selector (ctrl+tab)

This commit is contained in:
Brian Fiete 2020-09-03 06:49:19 -07:00
parent 73d9d1ec59
commit 6511d6a845
11 changed files with 163 additions and 15 deletions

View file

@ -227,7 +227,7 @@ namespace Beefy.theme.dark
float popupY = mHeight + popupYOfs;
//TODO: Autocomplete didn't work on this: BFApp.sApp.GetW...
menuWidget.Init(this, popupXOfs, popupY, true, menuWindow);
menuWidget.Init(this, popupXOfs, popupY, .AllowScrollable, menuWindow);
// Why were we capturing?
mWidgetWindow.TransferMouse(menuWidget.mWidgetWindow);
if (menuWindow == null)

View file

@ -301,7 +301,7 @@ namespace Beefy.theme.dark
{
MenuWidget menuWidget = DarkTheme.sDarkTheme.CreateMenuWidget(menu);
menuWidget.Init(this, x, y, true);
menuWidget.Init(this, x, y, .AllowScrollable);
menuWidget.mWidgetWindow.mOnWindowClosed.Add(new => MenuClosed);
}
else

View file

@ -95,6 +95,14 @@ namespace Beefy.widgets
public class MenuWidget : Widget
{
enum ShowFlags
{
None,
AllowScrollable = 1,
CenterHorz = 2,
CenterVert = 4,
}
public MenuItemWidget mParentMenuItemWidget;
public Menu mMenu;
//public BFWindowBase.Flags mWindowFlags = BFWindowBase.Flags.ClientSized | BFWindowBase.Flags.NoActivate | BFWindowBase.Flags.NoMouseActivate;
@ -227,8 +235,9 @@ namespace Beefy.widgets
return 10;
}
public virtual void Init(Widget relativeWidget, float x, float y, bool allowScrollable = false, WidgetWindow widgetWindow = null)
public virtual void Init(Widget relativeWidget, float x, float y, ShowFlags showFlags = 0, WidgetWindow widgetWindow = null)
{
bool allowScrollable = showFlags.HasFlag(.AllowScrollable);
mWasInitialized = true;
float curY = y;
@ -289,6 +298,11 @@ namespace Beefy.widgets
screenX += relativeWidget.mWidgetWindow.mClientX;
screenY += relativeWidget.mWidgetWindow.mClientY;
if (showFlags.HasFlag(.CenterHorz))
screenX -= mWidth / 2;
if (showFlags.HasFlag(.CenterVert))
screenY -= mHeight / 2;
MenuContainer menuContainer;
if (curWidgetWindow == null)