MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Window.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace MayaFlux::Vruta {
6class EventSource;
7}
8
9namespace MayaFlux::Core {
10
11/**
12 * @class Window
13 * @brief Platform-agnostic window wrapper
14 *
15 * Wraps a window (provided via a backend) and provides a unified interface
16 * for window management, event handling, and state tracking.
17 */
18class MAYAFLUX_API Window {
19public:
20 virtual ~Window() = default;
21
22 /**
23 * @brief Show the window
24 */
25 virtual void show() = 0;
26
27 /**
28 * @brief Hide the window
29 */
30 virtual void hide() = 0;
31
32 /**
33 * @brief Poll for window events (non-blocking)
34 */
35 [[nodiscard]] virtual bool should_close() const = 0;
36
37 /**
38 * @brief Get the current window state
39 */
40 [[nodiscard]] virtual const WindowState& get_state() const = 0;
41
42 /*
43 * @brief Get the window creation parameters
44 */
45 [[nodiscard]] virtual const WindowCreateInfo& get_create_info() const = 0;
46
47 /**
48 * @brief Set input configuration (keyboard, mouse, cursor)
49 * @param config Input configuration settings
50 */
51 virtual void set_input_config(const InputConfig& config) = 0;
52
53 /**
54 * @brief Get current input configuration
55 * @return Current input configuration settings
56 */
57 [[nodiscard]] virtual const InputConfig& get_input_config() const = 0;
58
59 /**
60 * @brief Set the callback function for window events
61 * @param callback Function to be called on window events
62 */
63 virtual void set_event_callback(WindowEventCallback callback) = 0;
64
65 /**
66 * @brief Get native window handle (platform-specific)
67 * @return Pointer to the native window handle
68 */
69 [[nodiscard]] virtual void* get_native_handle() const = 0;
70
71 /**
72 * @brief Get native display handle (platform-specific)
73 * @return Pointer to the native display handle
74 */
75 [[nodiscard]] virtual void* get_native_display() const = 0;
76
77 /**
78 * @brief Set window title, size, or position
79 * @param title New window title
80 */
81 virtual void set_title(const std::string& title) = 0;
82
83 /**
84 * @brief Resize the window
85 * @param width New window width
86 * @param height New window height
87 */
88 virtual void set_size(uint32_t width, uint32_t height) = 0;
89
90 /**
91 * @brief Move the window to a new position
92 * @param x New X coordinate
93 * @param y New Y coordinate
94 */
95 virtual void set_position(uint32_t x, uint32_t y) = 0;
96
97 /**
98 * @brief Gets the event source for awaiting events
99 */
100 [[nodiscard]] virtual Vruta::EventSource& get_event_source() = 0;
101 [[nodiscard]] virtual const Vruta::EventSource& get_event_source() const = 0;
102
103 /**
104 * @brief Check if window is registered with graphics subsystem
105 */
106 [[nodiscard]] virtual bool is_graphics_registered() const = 0;
107
108 /**
109 * @brief Mark window as registered/unregistered with graphics
110 * Called by GraphicsSubsystem during register/unregister
111 */
112 virtual void set_graphics_registered(bool registered) = 0;
113};
114}
virtual void set_input_config(const InputConfig &config)=0
Set input configuration (keyboard, mouse, cursor)
virtual const Vruta::EventSource & get_event_source() const =0
virtual void * get_native_display() const =0
Get native display handle (platform-specific)
virtual ~Window()=default
virtual void set_graphics_registered(bool registered)=0
Mark window as registered/unregistered with graphics Called by GraphicsSubsystem during register/unre...
virtual void set_event_callback(WindowEventCallback callback)=0
Set the callback function for window events.
virtual const WindowCreateInfo & get_create_info() const =0
virtual void hide()=0
Hide the window.
virtual void set_title(const std::string &title)=0
Set window title, size, or position.
virtual void * get_native_handle() const =0
Get native window handle (platform-specific)
virtual Vruta::EventSource & get_event_source()=0
Gets the event source for awaiting events.
virtual void set_size(uint32_t width, uint32_t height)=0
Resize the window.
virtual bool is_graphics_registered() const =0
Check if window is registered with graphics subsystem.
virtual const WindowState & get_state() const =0
Get the current window state.
virtual const InputConfig & get_input_config() const =0
Get current input configuration.
virtual void show()=0
Show the window.
virtual void set_position(uint32_t x, uint32_t y)=0
Move the window to a new position.
virtual bool should_close() const =0
Poll for window events (non-blocking)
Platform-agnostic window wrapper.
Definition Window.hpp:18
Awaitable event stream for window events.
std::function< void(const WindowEvent &)> WindowEventCallback
Input configuration for a window.
Configuration for creating a single window instance.
Runtime state of a window (mutable by system, read by user)