HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
gui_window_win32.hpp
1// Copyright Take Vos 2019, 2021-2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "../GFX/gfx_surface_vulkan.hpp"
8#include "gui_window.hpp"
9#include <unordered_map>
10
11struct HWND__;
12using HWND = HWND__ *;
13
14namespace hi::inline v1 {
15
16class gui_window_win32 final : public gui_window {
17public:
18 using super = gui_window;
19
20 HWND win32Window = nullptr;
21
22 gui_window_win32(gui_system &gui, label const &title) noexcept;
23
25
26 void create_window(extent2 new_size) override;
27 int windowProc(unsigned int uMsg, uint64_t wParam, int64_t lParam) noexcept;
28
29 void set_cursor(mouse_cursor cursor) noexcept override;
30 void close_window() override;
31 void set_size_state(gui_window_size state) noexcept override;
32 [[nodiscard]] aarectangle workspace_rectangle() const noexcept override;
33 [[nodiscard]] aarectangle fullscreen_rectangle() const noexcept override;
34 [[nodiscard]] hi::subpixel_orientation subpixel_orientation() const noexcept override;
35 void open_system_menu() override;
36 void set_window_size(extent2 extent) override;
37 [[nodiscard]] std::string get_text_from_clipboard() const noexcept override;
38 void set_text_on_clipboard(std::string str) noexcept override;
39
40private:
41 static constexpr UINT_PTR move_and_resize_timer_id = 2;
42
43 TRACKMOUSEEVENT track_mouse_leave_event_parameters;
44 bool tracking_mouse_leave_event = false;
45 char32_t high_surrogate = 0;
46 gui_event mouse_button_event;
47 utc_nanoseconds multi_click_time_point;
48 point2 multi_click_position;
49 uint8_t multi_click_count;
50
51 bool keymenu_pressed = false;
52
53 void setOSWindowRectangleFromRECT(RECT aarectangle) noexcept;
54
55 [[nodiscard]] keyboard_state get_keyboard_state() noexcept;
56 [[nodiscard]] keyboard_modifiers get_keyboard_modifiers() noexcept;
57
58 [[nodiscard]] char32_t handle_suragates(char32_t c) noexcept;
59 [[nodiscard]] gui_event create_mouse_event(unsigned int uMsg, uint64_t wParam, int64_t lParam) noexcept;
60
61 friend LRESULT CALLBACK _WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) noexcept;
62};
63
64} // namespace hi::inline v1
STL namespace.
DOXYGEN BUG.
Definition algorithm.hpp:15
subpixel_orientation
The orientation of the RGB sub-pixels of and LCD/LED panel.
Definition subpixel_orientation.hpp:18
keyboard_modifiers
Key modification keys pressed at the same time as another key.
Definition keyboard_modifiers.hpp:20
The HikoGUI namespace.
Definition ascii.hpp:19
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
Graphics system.
Definition gui_system.hpp:30
Definition gui_window.hpp:38
Definition gui_window_win32.hpp:16
aarectangle workspace_rectangle() const noexcept override
The rectangle of the workspace of the screen where the window is currently located.
void close_window() override
Ask the operating system to close this window.
void create_window(extent2 new_size) override
Let the operating system create the actual window.
void set_size_state(gui_window_size state) noexcept override
Set the size-state of the window.
void set_cursor(mouse_cursor cursor) noexcept override
Set the mouse cursor icon.
A label consisting of localizable text and an icon.
Definition label.hpp:125