Procházet zdrojové kódy

Fixed popup location clipping

Brian Fiete před 5 roky
rodič
revize
757464db3e

+ 1 - 1
BeefLibs/Beefy2D/src/widgets/Dialog.bf

@@ -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 _;

+ 7 - 2
BeefySysLib/platform/win/WinBFApp.cpp

@@ -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);
 	}
 	

+ 1 - 1
IDE/src/ui/AttachDialog.bf

@@ -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(); });

+ 4 - 1
IDE/src/ui/AutoComplete.bf

@@ -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);

+ 1 - 1
IDE/src/ui/FindAndReplaceDialog.bf

@@ -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);
 

+ 1 - 1
IDE/src/ui/FindClassDialog.bf

@@ -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);
 

+ 1 - 1
IDE/src/ui/InstalledProjectDialog.bf

@@ -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(); });

+ 1 - 1
IDE/src/ui/LaunchDialog.bf

@@ -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);
 

+ 1 - 1
IDE/src/ui/OpenFileInSolutionDialog.bf

@@ -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(); });

+ 1 - 1
IDE/src/ui/PanelPopup.bf

@@ -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;

+ 1 - 1
IDE/src/ui/ProfileDialog.bf

@@ -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));
 

+ 1 - 1
IDE/src/ui/PropertiesDialog.bf

@@ -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);