mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-07 00:36:00 +02:00
Beefy2D windows enhancements
This commit is contained in:
parent
6045137bce
commit
2428fe8e57
9 changed files with 125 additions and 52 deletions
|
@ -48,7 +48,8 @@ namespace Beefy
|
|||
ShowMinimized = 0x0200'0000,
|
||||
ShowMaximized = 0x0400'0000,
|
||||
AllowFullscreen = 0x0800'0000,
|
||||
AcceptFiles = 0x1000'0000
|
||||
AcceptFiles = 0x1000'0000,
|
||||
NoShow = 0x2000'0000,
|
||||
};
|
||||
|
||||
[AllowDuplicates]
|
||||
|
@ -84,6 +85,18 @@ namespace Beefy
|
|||
Zoom = 9
|
||||
}
|
||||
|
||||
public enum ShowKind
|
||||
{
|
||||
Hide,
|
||||
Normal,
|
||||
Minimized,
|
||||
Maximized,
|
||||
Show,
|
||||
ShowNormal,
|
||||
ShowMinimized,
|
||||
ShowMaximized
|
||||
}
|
||||
|
||||
public SysMenu mSysMenu ~ delete _;
|
||||
public Dictionary<int, SysMenu> mSysMenuMap = new Dictionary<int, SysMenu>() ~ delete _;
|
||||
public DrawLayer mDefaultDrawLayer ~ delete _;
|
||||
|
@ -108,9 +121,14 @@ namespace Beefy
|
|||
{
|
||||
public enum ShowKind
|
||||
{
|
||||
Hide,
|
||||
Normal,
|
||||
Minimized,
|
||||
Maximized
|
||||
Maximized,
|
||||
Show,
|
||||
ShowNormal,
|
||||
ShowMinimized,
|
||||
ShowMaximized
|
||||
}
|
||||
|
||||
delegate void NativeMovedDelegate(void* window);
|
||||
|
@ -147,6 +165,7 @@ namespace Beefy
|
|||
public int32 mNormY;
|
||||
public int32 mNormWidth;
|
||||
public int32 mNormHeight;
|
||||
public bool mVisible = true;
|
||||
public ShowKind mShowKind;
|
||||
public int32 mClientX;
|
||||
public int32 mClientY;
|
||||
|
@ -154,7 +173,6 @@ namespace Beefy
|
|||
public int32 mClientHeight;
|
||||
public float mAlpha = 1.0f;
|
||||
public Flags mWindowFlags;
|
||||
public bool mVisible = true;
|
||||
private bool mMouseVisible;
|
||||
public bool mHasFocus = false;
|
||||
public bool mHasClosed;
|
||||
|
@ -213,6 +231,9 @@ namespace Beefy
|
|||
[CallingConvention(.Stdcall), CLink]
|
||||
static extern void BFWindow_Close(void* window, int32 force);
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
static extern void BFWindow_Show(void* window, ShowKind showKind);
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
static extern void BFWindow_SetForeground(void* window);
|
||||
|
||||
|
@ -334,6 +355,9 @@ namespace Beefy
|
|||
useFlags |= .NoMouseActivate;
|
||||
}*/
|
||||
|
||||
if (windowFlags.HasFlag(.NoShow))
|
||||
mVisible = false;
|
||||
|
||||
mNativeWindow = BFApp_CreateWindow((parent != null) ? (parent.mNativeWindow) : null, title, (int32)x, (int32)y, (int32)width, (int32)height, (int32)useFlags);
|
||||
sWindowDictionary[(int)mNativeWindow] = this;
|
||||
|
||||
|
@ -461,6 +485,12 @@ namespace Beefy
|
|||
GotFocus();
|
||||
}
|
||||
|
||||
public void Show(ShowKind showKind)
|
||||
{
|
||||
mShowKind = showKind;
|
||||
BFWindow_Show(mNativeWindow, showKind);
|
||||
}
|
||||
|
||||
public void SetNonExclusiveMouseCapture()
|
||||
{
|
||||
// Does checking of mouse coords against all window even when this window has mouse capture,
|
||||
|
|
|
@ -1005,6 +1005,7 @@ namespace Beefy.widgets
|
|||
mouseEvent.mSender = selectedItem;
|
||||
mouseEvent.mBtnCount = 2;
|
||||
selectedItem.mOnMouseDown(mouseEvent);
|
||||
mOnItemMouseDown(selectedItem, 0, 0, 0, 2);
|
||||
default:
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ using Beefy.geom;
|
|||
namespace Beefy.widgets
|
||||
{
|
||||
public delegate void MouseLeftWindowHandler(BFWindow window);
|
||||
public delegate void WindowGotFocusHandler(BFWindow window);
|
||||
public delegate void WindowLostFocusHandler(BFWindow window, BFWindow newFocus);
|
||||
public delegate bool WindowCloseQueryHandler(BFWindow window);
|
||||
public delegate void WindowClosedHandler(BFWindow window);
|
||||
|
@ -22,7 +23,8 @@ namespace Beefy.widgets
|
|||
public class WidgetWindow : BFWindow
|
||||
{
|
||||
public Event<MouseLeftWindowHandler> mOnMouseLeftWindow ~ _.Dispose();
|
||||
public Event<WindowLostFocusHandler> mOnWindowLostFocus ~ _.Dispose();
|
||||
public Event<WindowGotFocusHandler> mOnWindowGotFocus ~ _.Dispose();
|
||||
public Event<WindowLostFocusHandler> mOnWindowLostFocus ~ _.Dispose();
|
||||
public Event<MouseEventHandler> mOnMouseDown ~ _.Dispose();
|
||||
public Event<MouseEventHandler> mOnMouseUp ~ _.Dispose();
|
||||
public Event<WindowCloseQueryHandler> mOnWindowCloseQuery ~ _.Dispose();
|
||||
|
@ -319,6 +321,8 @@ namespace Beefy.widgets
|
|||
if (!mFocusWidget.mHasFocus)
|
||||
mFocusWidget.GotFocus();
|
||||
}
|
||||
|
||||
mOnWindowGotFocus(this);
|
||||
}
|
||||
|
||||
public override void LostFocus(BFWindow newFocus)
|
||||
|
@ -363,6 +367,8 @@ namespace Beefy.widgets
|
|||
|
||||
public override void KeyChar(char32 c)
|
||||
{
|
||||
//Debug.WriteLine($"KeyChar {c}");
|
||||
|
||||
var fakeFocusWindow = GetFakeFocusWindow();
|
||||
if (fakeFocusWindow != null)
|
||||
{
|
||||
|
@ -815,6 +821,7 @@ namespace Beefy.widgets
|
|||
mOverWidget = null;
|
||||
}
|
||||
|
||||
mIsDirty = true;
|
||||
mOnMouseLeftWindow(this);
|
||||
sOnMouseLeftWindow(this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue