Sparkle 0.0.1
Loading...
Searching...
No Matches
spk_window.hpp
1#pragma once
2
3#include <Windows.h>
4#include <cstdint>
5#include <string>
6
7#include "structure/graphics/spk_extend_2d.hpp"
8
9namespace spk
10{
11 namespace Win32
12 {
13 class Class;
14
19 class Window
20 {
21 friend class Class;
22
23 public:
27 using Handle = HWND;
28
29 private:
30 Handle _winAPIHandle = nullptr;
31 std::wstring _title;
32
33 static RECT _computeWindowRectForClient(uint32_t p_cw, uint32_t p_ch, DWORD p_style, DWORD p_exstyle);
34
35 Window(const std::wstring &p_className, const std::wstring &p_title, const spk::Extend2D &p_extend, void *p_userPtr);
36
37 public:
41 ~Window();
42
46 void show() const;
47
48 Window(const Window &) = delete;
49 Window &operator=(const Window &) = delete;
50 Window(Window &&) = delete;
51 Window &operator=(Window &&) = delete;
52
57 Handle handle() const noexcept;
58 };
59 }
60}
Registers a Win32 window class and instantiates windows from it.
Definition spk_class.hpp:24
HWND Handle
Native Win32 handle type.
Definition spk_window.hpp:27
Handle handle() const noexcept
Retrieves the underlying HWND.
Definition spk_window.cpp:69
~Window()
Destroys the underlying window handle.
Definition spk_window.cpp:54
void show() const
Shows the window using SW_SHOW.
Definition spk_window.cpp:63
Axis-aligned rectangle defined by an anchor point and size.
Definition spk_extend_2d.hpp:24