MCPcopy Create free account
hub / github.com/OldJii/ring_layout / MessageHandler

Method MessageHandler

example/windows/runner/win32_window.cpp:152–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152LRESULT
153Win32Window::MessageHandler(HWND hwnd,
154 UINT const message,
155 WPARAM const wparam,
156 LPARAM const lparam) noexcept {
157 switch (message) {
158 case WM_DESTROY:
159 window_handle_ = nullptr;
160 Destroy();
161 if (quit_on_close_) {
162 PostQuitMessage(0);
163 }
164 return 0;
165
166 case WM_DPICHANGED: {
167 auto newRectSize = reinterpret_cast<RECT*>(lparam);
168 LONG newWidth = newRectSize->right - newRectSize->left;
169 LONG newHeight = newRectSize->bottom - newRectSize->top;
170
171 SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
172 newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
173
174 return 0;
175 }
176 case WM_SIZE: {
177 RECT rect = GetClientArea();
178 if (child_content_ != nullptr) {
179 // Size and position the child window.
180 MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
181 rect.bottom - rect.top, TRUE);
182 }
183 return 0;
184 }
185
186 case WM_ACTIVATE:
187 if (child_content_ != nullptr) {
188 SetFocus(child_content_);
189 }
190 return 0;
191 }
192
193 return DefWindowProc(window_handle_, message, wparam, lparam);
194}
195
196void Win32Window::Destroy() {
197 OnDestroy();

Callers 1

WndProcMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected