![]() |
MAGE
v0.171.0
Matthias Advanced Game Engine
|
#include <window.hpp>
Public Types | |
using | WindowDescriptorPtr = SharedPtr< const WindowDescriptor > |
using | WindowMessageListenerPtr = NotNull< WindowMessageListener *> |
using | WindowMessageHandlerPtr = NotNull< WindowMessageHandler *> |
Public Member Functions | |
Window (WindowDescriptorPtr window_desc, std::wstring_view title_text, const U32x2 &resolution, DWORD style=s_default_window_style) | |
Window (const Window &window)=delete | |
Window (Window &&window) noexcept | |
~Window () | |
Window & | operator= (const Window &window)=delete |
Window & | operator= (Window &&window)=delete |
void | Show (int nCmdShow) |
WindowDescriptorPtr | GetWindowDescriptor () const noexcept |
NotNull< HINSTANCE > | GetInstance () const noexcept |
HWND | GetWindow () const noexcept |
const std::wstring | GetTitleText () const noexcept |
void | SetTitleText (NotNull< const_wzstring > title_text) |
void | AddListener (WindowMessageListenerPtr listener) |
void | RemoveListener (WindowMessageListenerPtr listener) |
void | RemoveAllListeners () noexcept |
void | AddHandler (WindowMessageHandlerPtr handler) |
void | RemoveHandler (WindowMessageHandlerPtr handler) |
void | RemoveAllHandlers () noexcept |
Static Public Member Functions | |
static LRESULT CALLBACK | HandleWindowMessage (HWND window, UINT message, WPARAM wParam, LPARAM lParam) |
Static Public Attributes | |
static constexpr DWORD | s_default_window_style |
Private Member Functions | |
void | InitializeWindow (std::wstring_view title_text, const U32x2 &resolution, DWORD style) |
void | InitializeWindow (std::wstring_view title_text, const RECT &rectangle, DWORD style) |
const std::optional< LRESULT > | HandleWindowMessage (NotNull< HWND > window, UINT message, WPARAM wParam, LPARAM lParam) const |
Private Attributes | |
WindowDescriptorPtr | m_window_desc |
HWND | m_window |
std::vector< WindowMessageListenerPtr > | m_listeners |
std::vector< WindowMessageHandlerPtr > | m_handlers |
A class of windows.
using mage::Window::WindowDescriptorPtr = SharedPtr< const WindowDescriptor > |
|
explicit |
Constructs a window.
nullptr
. [in] | window_desc | A pointer to the window descriptor. |
[in] | title_text | The title text. |
[in] | resolution | The resolution of the window. |
[in] | style | The style of the window. |
Exception | Failed to create the window. |
|
delete |
Constructs a window from the given window.
[in] | window | A reference to the window to copy. |
|
defaultnoexcept |
Constructs a window by moving the given window.
[in] | window | A reference to the window to move. |
|
default |
Destructs this window.
void mage::Window::AddHandler | ( | WindowMessageHandlerPtr | handler | ) |
Adds the given window message handler to this window.
[in] | handler | A pointer to the window message handler to add. |
void mage::Window::AddListener | ( | WindowMessageListenerPtr | listener | ) |
Adds the given window message listener to this window.
[in] | listener | A pointer to the window message listener to add. |
|
noexcept |
Returns the application instance handle of this window.
|
noexcept |
Returns the title text of this window.
|
noexcept |
Returns the window handle of this window.
|
noexcept |
Returns the window descriptor of this window.
|
static |
Processes the given message sent to a window.
[in] | window | A handle to the window. |
[in] | message | The message. |
[in] | wParam | Additional message information. The contents of this parameter depend on the value of msg. |
[in] | lParam | Additional message information. The contents of this parameter depend on the value of msg. |
|
private |
Handles the given message sent to this window.
[in] | window | A handle to the window. |
[in] | message | The message. |
[in] | wParam | Additional message information. The contents of this parameter depend on the value of msg. |
[in] | lParam | Additional message information. The contents of this parameter depend on the value of msg. |
|
private |
Initializes the window of this window.
[in] | title_text | The title text. |
[in] | resolution | The resolution of the client rectangle of the window. |
[in] | style | The style of the window. |
Exception | Failed to create the window. |
|
private |
Initializes the window of this window.
[in] | title_text | The title text. |
[in] | rectangle | A reference to the client rectangle of the window. |
[in] | style | The style of the window. |
Exception | Failed to create the window. |
Copies the given window to this window.
[in] | window | A reference to the window to copy. |
Moves the given window to this window.
[in] | window | A reference to the window to move. |
|
noexcept |
Removes all the window message handlers from this window.
|
noexcept |
Removes all the window message listeners from this window.
void mage::Window::RemoveHandler | ( | WindowMessageHandlerPtr | handler | ) |
Removes the given window message handler from this window.
[in] | handler | A pointer to the window message handler to remove. |
void mage::Window::RemoveListener | ( | WindowMessageListenerPtr | listener | ) |
Removes the given window message listener from this window.
[in] | listener | A pointer to the window message listener to remove. |
void mage::Window::SetTitleText | ( | NotNull< const_wzstring > | title_text | ) |
Sets the title text of this window to the given title text.
[in] | title_text | A pointer to the title text. |
Exception | Failed to set the title text of this window. |
void mage::Window::Show | ( | int | nCmdShow | ) |
Sets the show state of this window.
[in] | nCmdShow | Controls how this window is to be shown. |
Exception | Failed to update the window. |
|
private |
A vector containing the message handler of this window.
|
private |
A vector containing the message listeners of this window.
|
private |
The window handle of this window.
|
private |
A pointer to the window descriptor of this window.
|
static |
The default window style of windows.