acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
device_context.h
1// Created by camilo on 2024-09-13 15:55 <3ThomasBorregaardSorensen
2#pragma once
3
4
5#undef USUAL_OPERATING_SYSTEM_SUPPRESSIONS
6#include "acme/_operating_system.h"
7#include "acme/windowing/window.h"
8#include "acme/operating_system/window.h"
9
10
11namespace operating_system
12{
13
14
16 {
17
18
19 HDC m_hdcWindowsWindow;
20
21
22 void Null() { m_hdcWindowsWindow = nullptr; }
23
24 };
25
26
27 class windows_device_context : public ::operating_system::a_device_context<e_operating_system_windows, windows_device_context_t>
28 {
29 public:
30
31
33
34
35 using BASE_TYPE::BASE_TYPE;
36
37
38 windows_device_context(HWND hwnd)
39 {
40
41 this->operator=(hwnd);
42
43 }
44
45
46 HWND as_HWND() const
47 {
48
49 if(this->m_eoperatingsystem == e_operating_system_windows)
50 {
51
52 if (!this->m_device_context.m_hwndWindowsWindow)
53 {
54
55 throw ::exception(error_wrong_state);
56
57 }
58
59 return this->m_device_context.m_hwndWindowsWindow;
60
61 }
62 else if (this->m_device_context.m_hwndWindowsWindow)
63 {
64
65 throw ::exception(error_wrong_state);
66
67 }
68 else
69 {
70
71 return nullptr;
72
73 }
74
75 }
76
77
78 using BASE_TYPE::operator=;
79
80 windows_device_context & operator=(HWND hwnd)
81 {
82
83 if (::is_null(hwnd) || hwnd == INVALID_HANDLE_VALUE)
84 {
85
86 this->Null();
87
88 }
89 else
90 {
91
92 this->m_eoperatingsystem = e_operating_system_windows;
93 this->m_device_context.m_hwndWindowsWindow = hwnd;
94
95 }
96
97 return *this;
98
99 }
100
101 };
102
103
104} // namespace operating_system
105
106
107// namespace windows
108// {
109//
110//
111// class CLASS_DECL_ACME window :
112// virtual public ::acme::windowing::window
113// {
114// public:
115//
116//
117// ::operating_system::windows_window m_windowswindow;
118// ::f64 m_dVelocity;
119// class ::time m_timeLastSizeMove;
120// ::i32_point m_pointSizeMoveStart;
121// bool m_bMovingNow;
122// bool m_bDefaultSystemMenu;
123// bool m_bSizeMoveMode;
124// //HWND m_hwnd;
125// HMENU m_hmenuSystem;
126// ::i32 m_iDebugAtom = 0;
127//
128// window();
129// ~window() override;
130//
131// virtual bool on_device_context_procedure(LRESULT & lresult, UINT message, WPARAM wparam, LPARAM lparam);
132// virtual bool _on_default_system_menu_init_menu(LRESULT & lresult, WPARAM wparam);
133// virtual bool _on_default_system_menu_command(LRESULT & lresult, WPARAM wparam, LPARAM lparam);
134// virtual void _defer_show_system_menu(::user::mouse * ppmouse);
135//
136//
137// virtual HWND _HWND() const;
138//
139//
140// };
141//
142//
143// CLASS_DECL_ACME LRESULT CALLBACK device_context_procedure(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
144// CLASS_DECL_ACME HINSTANCE get_device_context_procedure_hinstance();
145//
146//
147// } // namespace windows
148//
149//
150//
Definition device_context.h:274
Definition device_context.h:16