Blender V5.3
GHOST_WindowWin32.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9
10#pragma once
11
12#ifndef WIN32
13# error WIN32 only!
14#endif /* WIN32 */
15
16#include "GHOST_TaskbarWin32.hh"
18#include "GHOST_Window.hh"
19#include "GHOST_Wintab.hh"
20#ifdef WITH_INPUT_IME
21# include "GHOST_ImeWin32.hh"
22#endif
23
24#include <vector>
25
28
29/* typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions. */
30typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND);
31
33 LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
34
43
50
55 public:
72 const char *title,
73 int32_t left,
74 int32_t top,
75 uint32_t width,
76 uint32_t height,
79 const GHOST_ContextParams &context_params,
80 GHOST_WindowWin32 *parent_window,
81 bool dialog,
82 const GHOST_GPUDevice &preferred_device);
83
89
96 void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
97
102 bool getValid() const override;
103
108 HWND getHWND() const;
109
114 void *getOSWindow() const override;
115
120 void setTitle(const char *title) override;
121
126 std::string getTitle() const override;
127
132
139 void getWindowBounds(GHOST_Rect &bounds) const override;
140
146 void getClientBounds(GHOST_Rect &bounds) const override;
147
152 GHOST_TSuccess setClientWidth(uint32_t width) override;
153
158 GHOST_TSuccess setClientHeight(uint32_t height) override;
159
165 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override;
166
171 GHOST_TWindowState getState() const override;
172
180 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
181
189 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
190
197
204
208 GHOST_TSuccess invalidate() override;
209
214 GHOST_TSuccess setProgressBar(float progress) override;
215
220
228
234 void lostMouseCapture();
235
236 bool isDialog() const override;
237
241 HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const;
242 void loadCursor(bool visible, GHOST_TStandardCursor cursor_shape) const;
243
248 bool usingTabletAPI(GHOST_TTabletAPI api) const;
249
257 GHOST_TSuccess getPointerInfo(std::vector<GHOST_PointerInfoWin32> &outPointerInfo,
258 WPARAM wParam,
259 LPARAM lParam);
260
264 void resetPointerPenInfo();
265
270 GHOST_Wintab *getWintab() const;
271
277 void loadWintab(bool enable);
278
282 void closeWintab();
283
289
290 void updateDPI();
291
292 uint16_t getDPIHint() override;
293
296
299
301 void ThemeRefresh();
302
303#ifdef WITH_INPUT_IME
304 GHOST_ImeWin32 *getImeInput()
305 {
306 return &ime_input_;
307 }
308
309 void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) override;
310
311 void endIME() override;
312#endif /* WITH_INPUT_IME */
313
318
323 void onPointerHitTest(WPARAM wParam);
324
326
328 void updateHDRInfo();
329
330 private:
335 GHOST_Context *newDrawingContext(GHOST_TDrawingContextType type) override;
336
341 GHOST_TSuccess setWindowCursorVisibility(bool visible) override;
342
348 GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override;
349
354 GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) override;
355 GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape) override;
356
361 GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap,
362 const uint8_t *mask,
363 const int size[2],
364 const int hot_spot[2],
365 bool can_invert_color) override;
366
367 /* Registration of the AppModel Properties that govern the taskbar button and jump lists. */
368 void registerWindowAppUserModelProperties();
369 void unregisterWindowAppUserModelProperties();
370
372 GHOST_SystemWin32 *system_;
374 GHOST_DropTargetWin32 *drop_target_;
376 HWND h_wnd_;
378 HDC h_DC_;
379
380 bool is_dialog_;
381 GHOST_GPUDevice preferred_device_;
382
384 bool has_mouse_captured_;
389 bool has_grab_mouse_;
391 int n_pressed_buttons_;
393 HCURSOR custom_cursor_;
394
396 ITaskbarList3 *bar_;
397
398 static const wchar_t *s_windowClassName;
399 static const int s_maxTitleLength;
400
402 GHOST_Wintab *wintab_;
403
405 GHOST_TabletData last_pointer_tablet_data_;
406
407 GHOST_TWindowState normal_state_;
408
410 HMODULE user32_;
411
412 HWND parent_window_hwnd_;
413
414 GHOST_DirectManipulationHelper *direct_manipulation_helper_;
415
416#ifdef WITH_INPUT_IME
418 GHOST_ImeWin32 ime_input_;
419#endif
420};
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
GHOST_TGrabCursorMode
GHOST_TButton
GHOST_TTabletAPI
UINT(API *) GHOST_WIN32_GetDpiForWindow(HWND)
BOOL(API *) GHOST_WIN32_AdjustWindowRectExForDpi(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi)
GHOST_MouseCaptureEventWin32
@ MousePressed
@ OperatorUngrab
@ MouseReleased
@ OperatorGrab
unsigned long long int uint64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override
std::string getTitle() const override
GHOST_TSuccess setState(GHOST_TWindowState state) override
uint16_t getDPIHint() override
GHOST_TTrackpadInfo getTrackpadInfo()
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) override
bool getValid() const override
GHOST_TSuccess invalidate() override
GHOST_TSuccess applyWindowDecorationStyle() override
void getClientBounds(GHOST_Rect &bounds) const override
GHOST_TSuccess endProgressBar() override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
bool usingTabletAPI(GHOST_TTabletAPI api) const
GHOST_TSuccess getPointerInfo(std::vector< GHOST_PointerInfoWin32 > &outPointerInfo, WPARAM wParam, LPARAM lParam)
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
void setTitle(const char *title) override
void loadWintab(bool enable)
GHOST_TabletData getTabletData()
GHOST_Wintab * getWintab() const
HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const
void updateMouseCapture(GHOST_MouseCaptureEventWin32 event)
GHOST_TWindowState getState() const override
GHOST_TSuccess setProgressBar(float progress) override
void onPointerHitTest(WPARAM wParam)
void getWindowBounds(GHOST_Rect &bounds) const override
void * getOSWindow() const override
GHOST_TSuccess setClientHeight(uint32_t height) override
GHOST_WindowWin32(GHOST_SystemWin32 *system, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type, const GHOST_ContextParams &context_params, GHOST_WindowWin32 *parent_window, bool dialog, const GHOST_GPUDevice &preferred_device)
bool isDialog() const override
void loadCursor(bool visible, GHOST_TStandardCursor cursor_shape) const
GHOST_TSuccess setClientWidth(uint32_t width) override
void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle)
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_ContextParams &context_params, const bool exclusive=false)
#define API(returnType)
const int state
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
GHOST_TabletData tabletData