mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added UI Project to this repository, small UI fixes
This commit is contained in:
@@ -46,9 +46,9 @@ namespace GlitchyEngine.UI
|
||||
public enum TitleBarButton
|
||||
{
|
||||
None,
|
||||
Minimize,
|
||||
Maximize,
|
||||
Close
|
||||
Minimize = 1,
|
||||
Maximize = 2,
|
||||
Close = 4
|
||||
}
|
||||
|
||||
private TitleBarButton _hoveredTitleBarButton;
|
||||
@@ -739,14 +739,10 @@ namespace GlitchyEngine.UI
|
||||
}
|
||||
|
||||
// Check if hover button is on maximize to support SnapLayout on Windows 11
|
||||
if (window._hoveredTitleBarButton == .Maximize)
|
||||
if (window._hoveredTitleBarButton.HasFlag(.Maximize))
|
||||
{
|
||||
return 9 /* HTMAXBUTTON */;
|
||||
}
|
||||
else if (window._hoveredTitleBarButton == .Minimize)
|
||||
{
|
||||
return 8 /* HTMINBUTTON */;
|
||||
}
|
||||
|
||||
// Looks like adjustment happening in NCCALCSIZE is messing with the detection
|
||||
// of the top hit area so manually fixing that.
|
||||
@@ -1105,6 +1101,22 @@ namespace GlitchyEngine.UI
|
||||
|
||||
return .Ok;
|
||||
}
|
||||
|
||||
public override void ToggleMaximize()
|
||||
{
|
||||
PostMessageW(_windowHandle, WM_SYSCOMMAND, win32_window_is_maximized(_windowHandle) ? SC_RESTORE : SC_MAXIMIZE, 0);
|
||||
}
|
||||
|
||||
public override void Minimize()
|
||||
{
|
||||
PostMessageW(_windowHandle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
// TODO!
|
||||
Application.Instance.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +129,10 @@ namespace GlitchyEngine.UI
|
||||
public extern Result<void> SetIcon(StringView filePath);
|
||||
|
||||
public extern Result<void> SetCursor(CursorImage cursorImage);
|
||||
|
||||
public extern void ToggleMaximize();
|
||||
public extern void Minimize();
|
||||
public extern void Close();
|
||||
|
||||
private void DefaultEventHandler(Event e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user