TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_os_window_manager.h
Go to the documentation of this file.
1#pragma once
2
4#include <gui_core/gui_id.h>
5
8
9#include <functional>
10#include <string_view>
11#include <unordered_map>
12#include <unordered_set>
13
14namespace tachyon
15{
18
19 // Forward declarations
20 class GraphicsContext;
21 class IWindowBackend;
22 class ImageSet;
23 class StyleManager;
24 class GraphicsContext;
25 class GradientManager;
26
38
48
50 enum class WindowState : uint8_t
51 {
56 };
57
61 {
62 private:
63 // ---------------- Window Data ----------------
64
65 struct Window
66 {
67 ID id = ID::Invalid();
68
71
72 ID parentID = ID::Invalid();
73 ID firstChildID = ID::Invalid();
74 ID nextSiblingID = ID::Invalid();
75 int32_t childCount = 0;
76
77 IntRect rect{};
78 IntRect lastRect{};
79
80 int32_t monitorIndex = -1;
81 float displayScale = 1.0f;
82 uint32_t sequence = 0;
83 int32_t framesHidden = 0;
84 bool cloaked = false;
85
86 // A popup fading in or out is shown by a layered stand-in (IWindowBackend::ShowFade)
87 // while the window itself is cloaked (in) or hidden (out).
88 uint32_t fade = 0;
89 int32_t fadeWait = -1;
90 bool fadingIn = false;
91 float fadeFrom = 0.0f;
92 uint32_t fadeStartMs = 0;
93 int2 slide { 0, 1 };
94
95 OSWindowHandle osHandle = nullptr;
96 IWindowContext* context = nullptr;
97 OnGuiFunc onGui;
98
99 OSWindowHandle GetWindowHandle() const { return osHandle; }
100 };
101
102 std::vector<MonitorInfo> monitors;
103 uint32_t m_nextSequence = 0;
104 ID m_textInputWindow = ID::Invalid();
105 uint32_t m_focusChangeCount = 0;
106 IntRect m_textInputArea {};
107 int primaryMonitorIndex = 0;
108
109 bool insideBeginEnd = false;
110
111 protected:
112 OSWindowManager() = default;
113
120
122
123 public:
124 virtual ~OSWindowManager() = default;
129
130
131 // ---------------- Popup motion ----------------
132
133 static constexpr uint32_t kPopupInMs = 120;
134 static constexpr uint32_t kTooltipInMs = 100;
135 static constexpr uint32_t kPopupOutMs = 80;
136 static constexpr int kPopupSlide = 4;
137
140 void SetPopupSlide(ID id, int2 away);
142 void SetReducedMotion(bool reduced) { m_reducedMotion = reduced; }
143
144 // ---------------- Frame Lifecycle ----------------
145
150
151 bool EndFrame();
153
154 // ---------------- Declared windows ----------------
155
159 void ReleaseUndeclaredWindows(const std::function<bool(ID)>& declared);
160
161 // ---------------- Input ----------------
162
166 {
167 for (const auto& w : windows)
168 if (w.state == WindowState::Alive &&
170 return true;
171 return false;
172 }
173
178 {
179 const WindowFlags kSecondary = WindowFlags::PopupMenu
181 for (const auto& w : windows)
182 if (w.state == WindowState::Alive &&
183 (w.flags & kSecondary) != WindowFlags::None)
184 return true;
185 return false;
186 }
187
191 {
192 auto* w = FindWindow(id);
193 if (w == nullptr || w->state != WindowState::Alive) return;
194 w->state = WindowState::Hidden;
195 windowBackendManager->SetWindowVisible(w->GetWindowHandle(), false);
196 }
197
200 void SetTextInputArea(ID id, IntRect screenRect)
201 {
202 auto* w = FindWindow(id);
203 if (w == nullptr || w->state != WindowState::Alive) return;
204 const IntRect local{ screenRect.x - w->rect.x, screenRect.y - w->rect.y, screenRect.w, screenRect.h };
205 if (id == m_textInputWindow && local == m_textInputArea) return;
206 m_textInputWindow = id;
207 m_textInputArea = local;
208 windowBackendManager->SetTextInputArea(w->GetWindowHandle(), local);
209 }
210
213 bool Update();
214
218
219 std::optional<color4b> ReadScreenPixel(int2 screenPos)
220 {
221 return windowBackendManager->ReadScreenPixel(screenPos);
222 }
223
226 {
227 const int32_t index = IndexOf(id);
228 return index >= 0 && windowBackendManager->TakeCloseRequest(windows[size_t(index)].GetWindowHandle());
229 }
230
235
240
241 // ---------------- Window Creation ----------------
242
243 inline bool IsNotAlive(ID id) const { return IsNotAlive(IndexOf(id)); }
244
249 GetOrCreateWindow(ID id, std::string_view title, IntRect rect,
250 OnGuiFunc onGui,
252 ID parentID = ID::Invalid(), int monitorIndex = -1);
253
254 // ---------------- Monitor State ----------------
255
257 {
258 monitors = windowBackendManager->GetMonitors();
259 for (size_t i = 0; i < monitors.size(); ++i)
260 {
261 if (monitors[i].isPrimary)
262 {
263 primaryMonitorIndex = static_cast<int>(i);
264 break;
265 }
266 }
267 }
268
269 size_t GetMonitorCount() const
270 {
271 return monitors.size();
272 }
273
274 IntRect GetMonitorArea(int monitorIndex);
275 IntRect CenterInMonitor(int monitorIndex, int width, int height);
276
277 const std::vector<MonitorInfo>& Monitors() const { return monitors; }
278
279 const MonitorInfo &GetMonitor(int index) const
280 {
281 return (index >= 0 && index < static_cast<int>(monitors.size()))
282 ? monitors[index]
284 }
285
286 int GetMonitorIndexAt(int2 pos) const
287 {
289 }
290
292 {
293 if (primaryMonitorIndex < 0 || size_t(primaryMonitorIndex) >= monitors.size())
294 return -1;
295 return primaryMonitorIndex;
296 }
297
299 {
300 static MonitorInfo kEmptyInfo{.isPrimary = true};
301 if (primaryMonitorIndex < 0 || size_t(primaryMonitorIndex) >= monitors.size())
302 return kEmptyInfo; // no monitor connected
303 return monitors[primaryMonitorIndex];
304 }
305
308 bool SetWindowRect(ID id, const IntRect &clientRect);
309
310 // ---------------- Window State ----------------
311
313
317 {
318 userClosedWindows.insert(id);
319 return RequestClose(IndexOf(id));
320 }
321
324 {
325 // Remove from user-closed set if present (allow reopening)
326 userClosedWindows.erase(id);
327 return RequestClose(IndexOf(id));
328 }
329
334 {
335 userClosedWindows.erase(id);
336 }
337
339 bool WasUserClosed(ID id) const
340 {
341 return userClosedWindows.find(id) != userClosedWindows.end();
342 }
343
345 {
346 int32_t index = IndexOf(id);
347 return index == -1 ? WindowState::NotRegistered : windows[index].state;
348 }
349
350 bool HasBeenRegistered(ID id) const
351 {
352 int32_t index = IndexOf(id);
353 return index != -1;
354 }
355
358 float GetWindowDisplayScale(ID id) const
359 {
360 int32_t index = IndexOf(id);
361 return index == -1 ? 1.0f : windows[index].displayScale;
362 }
363
366 float MainDisplayScale() const;
367
370 float MainRefreshRate() const;
371
374 {
375 const int32_t index = IndexOf(id);
376 return index == -1 ? nullptr : windows[index].context;
377 }
379 {
380 const int32_t index = IndexOf(id);
381 return index == -1 ? nullptr : windows[index].GetWindowHandle();
382 }
383
385 {
386 const int32_t index = IndexOf(handle);
387 return index == -1 ? ID::Invalid() : windows[index].id;
388 }
389
392 {
393 const OSWindowHandle h = GetWindowHandle(id);
394 return h != nullptr ? windowBackendManager->GetWindowMode(h) : WindowMode::Normal;
395 }
396
398 {
399 int32_t index = IndexOf(id);
400 return index == -1 ? IntRect{} : windows[index].rect;
401 }
402
404 {
405 int32_t index = IndexOf(id);
406 return index == -1 ? int2 {} : windows[index].rect.size;
407 }
408
410 {
411 int32_t index = IndexOf(id);
412 return index == -1 ? int2 {} : windows[index].rect.position;
413 }
414
415 // ---------------- Focus & Z Order ----------------
416
417 void BringToFront(ID id)
418 {
419 int32_t index = IndexOf(id);
420 if (index == -1) return;
422 }
423
425 {
427 if (handle == nullptr) return ID::Invalid(); // No active window
428 int32_t index = IndexOf(handle);
429 if (index == -1) return ID::Invalid();
430 return windows[index].id;
431 }
432
434 {
436 if (handle == nullptr)
437 {
438 return ID::Invalid(); // No active window
439 }
440 int32_t index = IndexOf(handle);
441 if (index == -1)
442 {
443 // No active window, or active window not managed by us
444 return ID::Invalid();
445 }
446 return windows[index].id;
447 }
448
449 // ---------------- Queries ----------------
450
451 size_t WindowCount() const { return windows.size(); }
452 const std::vector<Window> &AllWindows() const { return windows; }
453
457 {
459 for (const auto& w : windows)
460 if (w.state == WindowState::Alive &&
461 (w.flags & auxFlags) == WindowFlags::None)
462 return true;
463 return false;
464 }
465
469
470 bool WasWindowUserClosed(ID id) const
471 {
472 return userClosedWindows.find(id) != userClosedWindows.end();
473 }
474
481
484 void ForEachAliveWindowContext(const std::function<void(IWindowContext*, IntRect)>& func)
485 {
486 for (const auto& w : windows)
487 {
488 if (w.state == WindowState::Alive && w.context != nullptr)
489 {
490 func(w.context, windowBackendManager->GetWindowPixelRect(w.GetWindowHandle()));
491 }
492 }
493 }
494
495 protected:
498
499 std::vector<Window> windows;
500 std::unordered_map<ID, int32_t> IDToWindowIndex;
501 std::unordered_map<OSWindowHandle, int32_t> HandleToWindowIndex;
502
504 std::unordered_set<ID> userClosedWindows;
505
506 // ---------------- Internal ----------------
507
508 Window* FindWindow(ID id)
509 {
510 int32_t index = IndexOf(id);
511 if (index == -1) return nullptr;
512 return &windows[index];
513 }
514
516 {
517 int32_t index = IndexOf(handle);
518 if (index == -1) return nullptr;
519 return &windows[index];
520 }
521
522 int32_t IndexOf(ID id) const
523 {
524 if (id == ID::Invalid()) return -1;
525 auto it = IDToWindowIndex.find(id);
526 if (it == IDToWindowIndex.end()) return -1;
527 return it->second;
528 }
529
530 int32_t IndexOf(OSWindowHandle handle) const
531 {
532 auto it = HandleToWindowIndex.find(handle);
533 if (it == HandleToWindowIndex.end()) return -1;
534 return it->second;
535 }
536
537 inline bool IsNotAlive(int32_t index) const
538 {
539 return index < 0 || index >= static_cast<int32_t>(windows.size()) ||
540 windows[index].state != WindowState::Alive;
541 }
542
544 {
545 int index = IndexOf(id);
546 return (index != -1) ? windows[index].monitorIndex : -1;
547 }
548
550 RequestCloseResult RequestClose(int32_t index, std::vector<ID> &detach_children);
551 void RemoveWindowFromSiblingList(int32_t window_index);
553 void RaisePopup(const Window& window);
555 bool MayFade(const Window& window) const;
557 float FadeProgress(const Window& window, uint32_t nowMs) const;
559 IntRect FadeRect(const Window& window, float shown) const;
561 bool BeginFadeIn(Window& window, uint32_t nowMs);
563 void EndFadeOf(Window& window);
566 bool m_reducedMotion = false;
568 const Window* MainWindow() const;
569 void LinkToParent(int32_t window_index, ID parentID);
570 void ClearParentIDInChildren(int32_t window_index);
571 void RemoveWindow(int32_t window_index);
572
573 };
574
575}
The atlas that the colors of color styles are baked into: pages of 2D textures, one row per gradient,...
Definition gui_gradient_manager.h:64
A graphics backend: the device, the window contexts that render the GUI's windows,...
Definition gui_graphics_context.h:60
Platform-level input interface: receives raw OS events (keyboard, mouse) and forwards them into the G...
Definition gui_platform_input_handler.h:24
Makes and manages the OS windows and delivers their input; GUIApplication::SetWindowBackend sets one,...
Definition gui_window_backend.h:105
virtual IntRect GetWindowPixelRect(OSWindowHandle window)=0
The window's render target: OS position (for OS compositing) and size in physical pixels.
virtual void BringToFront(OSWindowHandle)=0
Raises the window above the others and asks the OS for the input focus.
virtual std::vector< MonitorInfo > GetMonitors() const =0
Every monitor, the primary first.
virtual int GetMonitorAt(int2 pos) const =0
Index into GetMonitors of the monitor holding the screen point pos; 0 (the primary) when no monitor h...
virtual void SetTextInputArea(OSWindowHandle window, IntRect rect)=0
Where text is being typed in the window (window coordinates), so the IME places its candidate list ne...
virtual OSWindowHandle GetActiveWindow()=0
The window with the keyboard focus, or nullptr when none of the backend's windows has it.
virtual OSWindowHandle GetWindowUnderMouse()=0
The backend's window under the mouse, or nullptr.
virtual void SetWindowMode(OSWindowHandle, WindowMode)
Sets the window's state: minimized, maximized, restored or fullscreen.
Definition gui_window_backend.h:233
virtual bool TakeCloseRequest(OSWindowHandle)
Whether the OS asked to close a WindowFlags::ConfirmClose window since last asked.
Definition gui_window_backend.h:167
virtual int2 GetScreenMousePos()=0
The mouse position in screen pixels (SDL: as of the last PollEvents).
virtual MouseButtons GetMouseButtons()=0
The mouse buttons held down, wherever the mouse is (SDL: as of the last PollEvents).
virtual void SetWindowVisible(OSWindowHandle, bool visible)=0
Shows or hides the window; hiding doesn't destroy it.
virtual std::optional< color4b > ReadScreenPixel(int2)
The color of a screen pixel, anywhere on the desktop (an eyedropper); nothing where the platform can'...
Definition gui_window_backend.h:165
virtual WindowMode GetWindowMode(OSWindowHandle) const
The window's state as the OS has it now; WindowMode::Normal by default.
Definition gui_window_backend.h:235
A window's rendering state: made by GraphicsContext::CreateWindowContext for each OS window,...
Definition gui_window_backend.h:72
The images the shaders can sample, each at an ImageIndex. Implemented by the backend.
Definition gui_image.h:44
bool IsNotAlive(int32_t index) const
Definition gui_os_window_manager.h:537
std::unordered_map< ID, int32_t > IDToWindowIndex
Definition gui_os_window_manager.h:500
Window * FindWindow(OSWindowHandle handle)
Definition gui_os_window_manager.h:515
bool HasAlivePopupWindows() const
True while a popup menu window is alive.
Definition gui_os_window_manager.h:165
MouseButtons GetMouseButtons()
Definition gui_os_window_manager.h:236
bool WasWindowUserClosed(ID id) const
Definition gui_os_window_manager.h:470
const Window * MainWindow() const
First top-level window still open; null when there is none.
static constexpr uint32_t kTooltipInMs
a tooltip fading in
Definition gui_os_window_manager.h:134
GradientManager * gradientManager
Application-owned; handed to each new window context for RenderFrame, so the graphics context itself ...
Definition gui_os_window_manager.h:118
std::unordered_set< ID > userClosedWindows
Windows the user closed (not code), which declaring doesn't reopen.
Definition gui_os_window_manager.h:504
bool HasAliveMainWindow() const
Any alive non-popup, non-tooltip window.
Definition gui_os_window_manager.h:456
const MonitorInfo & GetPrimaryMonitor() const
Definition gui_os_window_manager.h:298
size_t WindowCount() const
Definition gui_os_window_manager.h:451
ID GetActiveWindow() const
Definition gui_os_window_manager.h:433
float FadeProgress(const Window &window, uint32_t nowMs) const
How far a fading popup is shown now, 0 to 1 (linear in time).
void AllowReopenWindow(ID id)
Lets a window the user closed be reopened by declaring it.
Definition gui_os_window_manager.h:333
IntRect GetWindowRect(ID id) const
Definition gui_os_window_manager.h:397
ID GetTopModalWindow() const
Returns the ID of the top-most modal window (last created, still alive), or ID::Invalid() if there ar...
size_t GetMonitorCount() const
Definition gui_os_window_manager.h:269
virtual ~OSWindowManager()=default
const std::vector< MonitorInfo > & Monitors() const
Definition gui_os_window_manager.h:277
void SetWindowMode(ID id, WindowMode mode)
Definition gui_os_window_manager.h:390
void DestroyWindowContexts()
For a lost GPU device: the contexts go before the device, and come back on the new one for the same O...
void ClearParentIDInChildren(int32_t window_index)
bool IsNotAlive(ID id) const
Definition gui_os_window_manager.h:243
bool Update()
Polls the OS events and destroys closed windows' contexts; call outside BeginFrame / EndFrame.
int32_t IndexOf(OSWindowHandle handle) const
Definition gui_os_window_manager.h:530
bool HasBeenRegistered(ID id) const
Definition gui_os_window_manager.h:350
RequestCloseResult RequestClose(int32_t index, std::vector< ID > &detach_children)
int GetMonitorIndexForWindow(ID id) const
Definition gui_os_window_manager.h:543
void ReleaseUndeclaredWindows(const std::function< bool(ID)> &declared)
Releases the windows the app no longer declares (declared(id) is false): popups are hidden for a fast...
void SetReducedMotion(bool reduced)
Reduced motion: popups show and hide at once.
Definition gui_os_window_manager.h:142
IPlatformInputHandler * inputHandler
Definition gui_os_window_manager.h:121
int GetMonitorIndexAt(int2 pos) const
Definition gui_os_window_manager.h:286
void SetPopupSlide(ID id, int2 away)
The way popup id opens, away from its anchor (one step on one axis, e.g.
void RaisePopup(const Window &window)
int GetPrimaryMonitorIndex() const
Definition gui_os_window_manager.h:291
Window * FindWindow(ID id)
Definition gui_os_window_manager.h:508
IntRect FadeRect(const Window &window, float shown) const
Where a popup shown (0 to 1) of the way in is: short of its rect, towards its anchor.
void AnimateFades()
Moves the stand-ins, and ends the fades that are done.
bool BeginFrame()
Brackets the frame's window work (GetOrCreateWindow, SetWindowRect, closes); false (and a misuse repo...
float QueryDisplayScale(OSWindowHandle handle) const
RequestCloseResult RequestCloseAllowReopen(ID id)
Closes a window from code; unlike RequestUserClose, declaring it again reopens it.
Definition gui_os_window_manager.h:323
ID GetWindowUnderMouse() const
Definition gui_os_window_manager.h:424
bool SetWindowRect(ID id, const IntRect &clientRect)
Moves and resizes a window so its client area is clientRect (screen pixels).
std::optional< color4b > ReadScreenPixel(int2 screenPos)
Definition gui_os_window_manager.h:219
void ForEachAliveWindowContext(const std::function< void(IWindowContext *, IntRect)> &func)
Calls func for each live window's context with its render-target rect (OS position,...
Definition gui_os_window_manager.h:484
bool TakeCloseRequest(ID id)
Whether the OS asked to close this (ConfirmClose) window since last asked.
Definition gui_os_window_manager.h:225
bool EndFrame()
Brackets the frame's window work (GetOrCreateWindow, SetWindowRect, closes); false (and a misuse repo...
std::unordered_map< OSWindowHandle, int32_t > HandleToWindowIndex
Definition gui_os_window_manager.h:501
bool MayFade(const Window &window) const
Popups fade unless motion is reduced; tooltips fade without sliding.
bool m_reducedMotion
Definition gui_os_window_manager.h:566
IWindowContext * GetWindowContext(ID id) const
The window's context; nullptr when the window doesn't exist.
Definition gui_os_window_manager.h:373
void RemoveWindowFromSiblingList(int32_t window_index)
static constexpr uint32_t kPopupInMs
a menu or popup fading in
Definition gui_os_window_manager.h:133
static constexpr int kPopupSlide
CSS px a popup slides in from its anchor.
Definition gui_os_window_manager.h:136
StyleManager * styleManager
Application-owned; handed to each new window context for RenderFrame, so the graphics context itself ...
Definition gui_os_window_manager.h:117
float MainDisplayScale() const
The display scale of the main window (the first top-level window still open), or of the primary monit...
bool HasAliveSecondaryWindows() const
True while a secondary top-level window (popup or utility window) is alive.
Definition gui_os_window_manager.h:177
OSWindowHandle GetWindowHandle(ID id) const
Definition gui_os_window_manager.h:378
static constexpr uint32_t kPopupOutMs
either fading out
Definition gui_os_window_manager.h:135
IntRect GetMonitorArea(int monitorIndex)
void HidePopupWindow(ID id)
Hides a popup / menu window, kept (WindowState::Hidden) for a fast reopen.
Definition gui_os_window_manager.h:190
void SetTextInputArea(ID id, IntRect screenRect)
Places the IME candidate window at screenRect (e.g.
Definition gui_os_window_manager.h:200
bool BeginFadeIn(Window &window, uint32_t nowMs)
Starts the stand-in of a cloaked popup that has been drawn; false when there can't be one.
WindowMode GetWindowMode(ID id) const
Definition gui_os_window_manager.h:391
IWindowBackend * windowBackendManager
Definition gui_os_window_manager.h:497
void DestroyAllWindowContexts()
Destroys every window's IWindowContext.
RequestCloseResult RequestUserClose(ID id)
Closes a window on the user's behalf (e.g.
Definition gui_os_window_manager.h:316
AddWindowResult GetOrCreateWindow(ID id, std::string_view title, IntRect rect, OnGuiFunc onGui, WindowFlags windowFlags=WindowFlags::DefaultFlags|WindowFlags::CloseWithParent, ID parentID=ID::Invalid(), int monitorIndex=-1)
Creates the OS window for id on first call (SuccessCreate), returns the existing one after (SuccessRe...
float GetWindowDisplayScale(ID id) const
The OS UI scale where the window is (see IWindowBackend::GetWindowDisplayScale); 1 when unknown.
Definition gui_os_window_manager.h:358
int32_t IndexOf(ID id) const
Definition gui_os_window_manager.h:522
WindowState GetWindowState(ID id) const
Definition gui_os_window_manager.h:344
int2 GetWindowPosition(ID id) const
Definition gui_os_window_manager.h:409
void RemoveWindow(int32_t window_index)
RequestCloseResult RequestClose(int32_t index)
bool RecreateWindowContexts()
For a lost GPU device: the contexts go before the device, and come back on the new one for the same O...
IntRect CenterInMonitor(int monitorIndex, int width, int height)
void LinkToParent(int32_t window_index, ID parentID)
float MainRefreshRate() const
Refresh rate in Hz of the monitor showing the main window, or of the primary monitor before there is ...
GraphicsContext * graphicsContext
Definition gui_os_window_manager.h:496
OSWindowManager(GraphicsContext *graphicsContext, IWindowBackend *backend)
For tests without real windows: no style / gradient managers, no context init.
int2 GetWindowSize(ID id) const
Definition gui_os_window_manager.h:403
const MonitorInfo & GetMonitor(int index) const
Definition gui_os_window_manager.h:279
const std::vector< Window > & AllWindows() const
Definition gui_os_window_manager.h:452
void RefreshMonitors()
Definition gui_os_window_manager.h:256
void BringToFront(ID id)
Definition gui_os_window_manager.h:417
bool WasUserClosed(ID id) const
True when the user closed the window and it isn't reopened yet.
Definition gui_os_window_manager.h:339
RequestCloseResult RequestClose(ID id)
Definition gui_os_window_manager.h:312
void EndFadeOf(Window &window)
Removes a popup's stand-in.
ID GetWindowID(OSWindowHandle handle) const
Invalid for a handle this manager doesn't own.
Definition gui_os_window_manager.h:384
OSWindowManager(GraphicsContext *graphicsContext, IWindowBackend *backendWindowManager, IPlatformInputHandler *inputHandler, StyleManager &styleManager, GradientManager &gradientManager)
std::vector< Window > windows
Definition gui_os_window_manager.h:499
int2 GetScreenMousePos()
Definition gui_os_window_manager.h:231
Bakes serializable Styles into deduplicated runtime layout/visual styles; a StyleRef holds indices in...
Definition gui_style_manager.h:39
@ Success
Definition gui_element_storage.h:44
MouseButtons
Mouse buttons, combined with |.
Definition gui_input_enums.h:38
@ Hidden
Content clipped, no scrollbars.
Definition gui_style.h:236
std::function< void()> OnGuiFunc
Definition gui_base_types.h:14
WindowFlags
How an OS window is made and behaves (IWindowBackend::CreateWindow); flags combine with |.
Definition gui_window_flags.h:12
RequestCloseResult
Outcome of an OSWindowManager close request; negative values are failures.
Definition gui_os_window_manager.h:41
WindowMode
A window's state (IWindowBackend::SetWindowMode). Any window can go fullscreen.
Definition gui_window_backend.h:60
WindowState
The life cycle of a managed window.
Definition gui_os_window_manager.h:51
void * OSWindowHandle
An OS window, opaque; what it points to is up to the window backend.
Definition gui_window_backend.h:37
AddWindowResult
Outcome of OSWindowManager::GetOrCreateWindow; negative values are failures.
Definition gui_os_window_manager.h:29
@ DefaultFlags
Definition gui_window_flags.h:61
@ CloseWithParent
Closes with its parent window; without it the window becomes top-level when the parent closes.
Definition gui_window_flags.h:45
@ NotFocusable
Never takes keyboard focus (e.g. tooltips).
Definition gui_window_flags.h:37
@ None
Definition gui_window_flags.h:13
@ Utility
Definition gui_window_flags.h:24
@ PopupMenu
Stays on top without blocking other windows; closes when another (non-child) window gets focus.
Definition gui_window_flags.h:31
@ UnknownError
Another failure.
Definition gui_os_window_manager.h:46
@ WindowAlreadyClosed
Window was already closed.
Definition gui_os_window_manager.h:45
@ CalledOutsideFrame
Called outside of BeginFrame/EndFrame.
Definition gui_os_window_manager.h:43
@ Normal
as placed (restored)
Definition gui_window_backend.h:61
@ NotRegistered
no window with this ID (GetWindowState for an unknown ID)
Definition gui_os_window_manager.h:52
@ Closing
close requested (this frame) or already closed
Definition gui_os_window_manager.h:54
@ Hidden
OS window hidden but context alive (for fast reopen of popups/menus).
Definition gui_os_window_manager.h:55
@ Alive
normal
Definition gui_os_window_manager.h:53
@ FailedToCreateOSWindow
OS window creation failed.
Definition gui_os_window_manager.h:34
@ InvalidID
Provided ID was invalid.
Definition gui_os_window_manager.h:35
@ IndexOutOfBounds
Internal error: window index out of bounds.
Definition gui_os_window_manager.h:33
@ SuccessCreate
New window created.
Definition gui_os_window_manager.h:30
@ SuccessRecycle
Existing window returned (a hidden one is shown again).
Definition gui_os_window_manager.h:31
@ WindowUserClosed
The user closed it; not reopened until AllowReopenWindow.
Definition gui_os_window_manager.h:36
@ CalledOutsideOfFrame
Called outside of BeginFrame/EndFrame.
Definition gui_os_window_manager.h:32
Definition gui_logging.h:24
A 64-bit element ID whose bit layout depends on its IDMode.
Definition gui_id.h:23
static constexpr ID Invalid()
The "no element" ID (all bits zero); also the default for optional ID parameters.
Definition gui_id.h:66
Definition gui_base_types.h:407
Window, monitor and mouse coordinates are physical pixels.
Definition gui_window_backend.h:42
Integer 2D vector.
Definition gui_base_types.h:19