Blender V5.0
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,
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;
103
108 HWND getHWND() const;
109
114 void *getOSWindow() const;
115
120 void setTitle(const char *title);
121
126 std::string getTitle() const;
127
132
139 void getWindowBounds(GHOST_Rect &bounds) const;
140
146 void getClientBounds(GHOST_Rect &bounds) const;
147
152 GHOST_TSuccess setClientWidth(uint32_t width);
153
158 GHOST_TSuccess setClientHeight(uint32_t height);
159
165 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height);
166
172
180 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
181
189 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
190
197
204
209
214 GHOST_TSuccess setProgressBar(float progress);
215
220
228
234 void lostMouseCapture();
235
236 bool isDialog() const;
237
243 HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const;
244 void loadCursor(bool visible, GHOST_TStandardCursor cursor_shape) const;
245
250 bool usingTabletAPI(GHOST_TTabletAPI api) const;
251
259 GHOST_TSuccess getPointerInfo(std::vector<GHOST_PointerInfoWin32> &outPointerInfo,
260 WPARAM wParam,
261 LPARAM lParam);
262
266 void resetPointerPenInfo();
267
272 GHOST_Wintab *getWintab() const;
273
279 void loadWintab(bool enable);
280
284 void closeWintab();
285
291
292 void updateDPI();
293
294 uint16_t getDPIHint() override;
295
298
301
303 void ThemeRefresh();
304
305#ifdef WITH_INPUT_IME
306 GHOST_ImeWin32 *getImeInput()
307 {
308 return &ime_input_;
309 }
310
311 void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed);
312
313 void endIME();
314#endif /* WITH_INPUT_IME */
315
316 /*
317 * Drive DirectManipulation context.
318 */
320
321 /*
322 * Handle DM_POINTERHITTEST events.
323 * \param wParam: wParam from the event.
324 */
325 void onPointerHitTest(WPARAM wParam);
326
328
329 /* Update HDR info on initialization and window changes. */
330 void updateHDRInfo();
331
332 private:
337 GHOST_Context *newDrawingContext(GHOST_TDrawingContextType type);
338
343 GHOST_TSuccess setWindowCursorVisibility(bool visible);
344
350 GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode);
351
356 GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
357 GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape);
358
363 GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap,
364 const uint8_t *mask,
365 const int size[2],
366 const int hot_spot[2],
367 bool can_invert_color);
368
369 /* Registration of the AppModel Properties that govern the taskbar button and jump lists. */
370 void registerWindowAppUserModelProperties();
371 void unregisterWindowAppUserModelProperties();
372
374 GHOST_SystemWin32 *system_;
376 GHOST_DropTargetWin32 *drop_target_;
378 HWND h_wnd_;
380 HDC h_DC_;
381
382 bool is_dialog_;
383 GHOST_GPUDevice preferred_device_;
384
386 bool has_mouse_captured_;
391 bool has_grab_mouse_;
393 int n_pressed_buttons_;
395 HCURSOR custom_cursor_;
396
398 ITaskbarList3 *bar_;
399
400 static const wchar_t *s_windowClassName;
401 static const int s_maxTitleLength;
402
404 GHOST_Wintab *wintab_;
405
407 GHOST_TabletData last_pointer_tablet_data_;
408
409 GHOST_TWindowState normal_state_;
410
412 HMODULE user32_;
413
414 HWND parent_window_hwnd_;
415
416 GHOST_DirectManipulationHelper *direct_manipulation_helper_;
417
418#ifdef WITH_INPUT_IME
420 GHOST_ImeWin32 ime_input_;
421#endif
422};
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
Definition GHOST_Types.h:57
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
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
GHOST_TSuccess invalidate()
GHOST_TSuccess setOrder(GHOST_TWindowOrder order)
uint16_t getDPIHint() override
GHOST_TTrackpadInfo getTrackpadInfo()
GHOST_TSuccess setProgressBar(float progress)
GHOST_TSuccess applyWindowDecorationStyle() override
void setTitle(const char *title)
std::string getTitle() const
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height)
bool usingTabletAPI(GHOST_TTabletAPI api) const
GHOST_TSuccess getPointerInfo(std::vector< GHOST_PointerInfoWin32 > &outPointerInfo, WPARAM wParam, LPARAM lParam)
GHOST_TSuccess setClientHeight(uint32_t height)
void loadWintab(bool enable)
GHOST_TabletData getTabletData()
GHOST_Wintab * getWintab() const
HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const
void updateMouseCapture(GHOST_MouseCaptureEventWin32 event)
GHOST_TSuccess setClientWidth(uint32_t width)
GHOST_TSuccess setState(GHOST_TWindowState state)
void getWindowBounds(GHOST_Rect &bounds) const
void getClientBounds(GHOST_Rect &bounds) const
void onPointerHitTest(WPARAM wParam)
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
GHOST_TSuccess endProgressBar()
GHOST_TWindowState getState() const
void * getOSWindow() const
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
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)
void loadCursor(bool visible, GHOST_TStandardCursor cursor_shape) const
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)
uint top
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static ulong state[N]
static int left
GHOST_TabletData tabletData