1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed popup location clipping

This commit is contained in:
Brian Fiete 2020-03-30 12:17:24 -07:00
parent d635b8e67f
commit 757464db3e
12 changed files with 21 additions and 13 deletions

View file

@ -20,7 +20,7 @@ namespace Beefy.widgets
public String mTitle ~ delete _;
public String mText ~ delete _;
public Image mIcon;
public BFWindowBase.Flags mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Modal;
public BFWindowBase.Flags mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Modal | .PopupPosition;
public List<ButtonWidget> mButtons = new List<ButtonWidget>() ~ delete _;
public List<Widget> mTabWidgets = new List<Widget>() ~ delete _;
public Dictionary<ButtonWidget, DialogEventHandler> mHandlers = new Dictionary<ButtonWidget, DialogEventHandler>() ~ delete _;

View file

@ -131,9 +131,14 @@ WinBFWindow::WinBFWindow(BFWindow* parent, const StringImpl& title, int x, int y
RECT desktopRect;
::SystemParametersInfo(SPI_GETWORKAREA, NULL, &desktopRect, NULL);
if (x + width >= desktopRect.right)
if (x < desktopRect.left)
x = desktopRect.left;
else if (x + width >= desktopRect.right)
x = BF_MAX((int)desktopRect.left, desktopRect.right - width);
if (y + height >= desktopRect.bottom)
if (y < desktopRect.top)
y = desktopRect.top;
else if (y + height >= desktopRect.bottom)
y = BF_MAX((int)desktopRect.top, desktopRect.bottom - height);
}

View file

@ -28,7 +28,7 @@ namespace IDE.ui
public this()
{
mWindowFlags = BFWindow.Flags.ClientSized | BFWindow.Flags.TopMost | BFWindow.Flags.Caption |
BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable;
BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable | .PopupPosition;
AddOkCancelButtons(new (evt) => { Attach(); }, null, 0, 1);
//mApplyButton = AddButton("Apply", (evt) => { evt.mCloseDialog = false; ApplyChanges(); });

View file

@ -1044,9 +1044,12 @@ namespace IDE.ui
mTargetEditWidget.Content.GetTextCoordAtCursor(var cursorX, var cursorY);
if (!mInvokeWidget.mIsAboveText)
if (mInvokeWidget?.mIsAboveText != true)
y = Math.Max(y, cursorY + gApp.mCodeFont.GetHeight() * 0.0f);
/*if (cursorY > y + gApp.mCodeFont.GetHeight() * 2.5f)
y = cursorY;*/
float screenX;
float screenY;
mTargetEditWidget.Content.SelfToRootTranslate(x, y, out screenX, out screenY);

View file

@ -28,7 +28,7 @@ namespace IDE.ui
mIsReplace = isReplace;
mWindowFlags = BFWindow.Flags.ClientSized | BFWindow.Flags.TopMost | BFWindow.Flags.Caption |
BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable;
BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable | .PopupPosition;
AddOkCancelButtons(new (evt) => { DoFind(); }, null, 0, 1);

View file

@ -10,7 +10,7 @@ namespace IDE.ui
public this()
{
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable;
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition;
AddOkCancelButtons(new (evt) => { GotoClass(); }, null, 0, 1);

View file

@ -32,7 +32,7 @@ namespace IDE.ui
public this()
{
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable;
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition;
AddOkCancelButtons(new (evt) => { DoImport(); }, null, 0, 1);
//mApplyButton = AddButton("Apply", (evt) => { evt.mCloseDialog = false; ApplyChanges(); });

View file

@ -31,7 +31,7 @@ namespace IDE.ui
mSettingHistoryManager = gApp.mLaunchHistoryManager;
mTitle = new .("Launch Executable");
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable;
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition;
AddOkCancelButtons(new (evt) => { evt.mCloseDialog = false; Launch(); }, null, 0, 1);

View file

@ -67,7 +67,7 @@ namespace IDE.ui
public this()
{
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable;
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition;
AddOkCancelButtons(new (evt) => { GotoFile(); }, null, 0, 1);
//mApplyButton = AddButton("Apply", (evt) => { evt.mCloseDialog = false; ApplyChanges(); });

View file

@ -11,7 +11,7 @@ namespace IDE.ui
class PanelPopup : Widget
{
public Panel mPanel;
public BFWindowBase.Flags mWindowFlags = .ClientSized | .NoActivate | .NoMouseActivate | .DestAlpha;
public BFWindowBase.Flags mWindowFlags = .ClientSized | .NoActivate | .NoMouseActivate | .DestAlpha | .PopupPosition;
Widget mRelativeWidget;
bool mReverse;
float mMinContainerWidth = 32;

View file

@ -25,7 +25,7 @@ namespace IDE.ui
AddDialogComponent(mThreadCombo);
mWindowFlags = BFWindow.Flags.ClientSized | BFWindow.Flags.TopMost | BFWindow.Flags.Caption |
BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable;
BFWindow.Flags.Border | BFWindow.Flags.SysMenu | BFWindow.Flags.Resizable | .PopupPosition;
mSampleRateEdit = AddEdit(scope String()..AppendF("{0}", gApp.mSettings.mDebuggerSettings.mProfileSampleRate));

View file

@ -497,7 +497,7 @@ namespace IDE.ui
{
//mMinWidth = GS!(320);
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable;
mWindowFlags = .ClientSized | .TopMost | .Caption | .Border | .SysMenu | .Resizable | .PopupPosition;
mButtonBottomMargin = GS!(6);
mButtonRightMargin = GS!(6);