Added UI Project to this repository, small UI fixes

This commit is contained in:
Simon Lübeß
2024-11-05 22:21:47 +01:00
parent 4957f3c033
commit df125f4e57
182 changed files with 3083 additions and 82002 deletions
@@ -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();
}
}
}
+4
View File
@@ -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)
{