HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
application_win32.hpp
1// Copyright 2019 Pokitec
2// All rights reserved.
3
4#pragma once
5
6#include "application.hpp"
7#include <thread>
8
9namespace tt {
10
11// WM_USER = ?-0x7fff
12// WM_APP = 0x8000-0xbfff.
13constexpr unsigned int WM_WIN_LANGUAGE_CHANGE = 0x8000 - 1;
14constexpr unsigned int WM_APP_CALL_FUNCTION = 0x8000 + 1;
15
16class application_win32 final : public application {
17public:
20 int argc,
21 char *argv[],
22 os_handle instance);
23 ~application_win32() = default;
24
25 application_win32(const application_win32 &) = delete;
26 application_win32 &operator=(const application_win32 &) = delete;
28 application_win32 &operator=(application_win32 &&) = delete;
29
30 void init() override;
31
32 void run_from_main_loop(std::function<void()> function) override;
33
34 int loop() override;
35
36 void exit(int exit_code) override;
37
40 [[nodiscard]] std::vector<void *> win32_windows() noexcept;
41
44 void post_message(void *window, unsigned int Msg, ptrdiff_t wParam = 0, ptrdiff_t lParam = 0) noexcept;
45
48 void post_message(std::vector<void *> const &windows, unsigned int Msg, ptrdiff_t wParam = 0, ptrdiff_t lParam = 0) noexcept;
49
50protected:
51 typename timer::callback_ptr_type languages_maintenance_callback;
52
53 void init_audio() override;
54};
55
56} // namespace tt
STL namespace.
Definition application.hpp:36
std::weak_ptr< application_delegate > delegate
Definition application.hpp:42
os_handle instance
Handle to the operating system's application-instance.
Definition application.hpp:52
int argc
Definition application.hpp:46
Definition application_win32.hpp:16
void init() override
Two phase construction.
int loop() override
void post_message(void *window, unsigned int Msg, ptrdiff_t wParam=0, ptrdiff_t lParam=0) noexcept
Send a win32 message to a window, on the thread associated with that window.
std::vector< void * > win32_windows() noexcept
Get a win32 handle to each window of the application.
void run_from_main_loop(std::function< void()> function) override
void exit(int exit_code) override
Exit the main loop and exit the application.
A timer which will execute callbacks at given intervals.
Definition timer.hpp:19