Blender V4.5
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 bool wantStereoVisual,
80 GHOST_WindowWin32 *parentWindow,
81 bool is_debug,
82 bool dialog,
83 const GHOST_GPUDevice &preferred_device);
84
90
97 void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
98
103 bool getValid() const;
104
109 HWND getHWND() const;
110
115 void *getOSWindow() const;
116
121 void setTitle(const char *title);
122
127 std::string getTitle() const;
128
133
140 void getWindowBounds(GHOST_Rect &bounds) const;
141
147 void getClientBounds(GHOST_Rect &bounds) const;
148
153 GHOST_TSuccess setClientWidth(uint32_t width);
154
159 GHOST_TSuccess setClientHeight(uint32_t height);
160
166 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height);
167
173
181 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
182
190 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
191
198
205
210
216
221
229
235 void lostMouseCapture();
236
237 bool isDialog() const;
238
244 HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const;
245 void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const;
246
251 bool usingTabletAPI(GHOST_TTabletAPI api) const;
252
260 GHOST_TSuccess getPointerInfo(std::vector<GHOST_PointerInfoWin32> &outPointerInfo,
261 WPARAM wParam,
262 LPARAM lParam);
263
267 void resetPointerPenInfo();
268
273 GHOST_Wintab *getWintab() const;
274
280 void loadWintab(bool enable);
281
285 void closeWintab();
286
292
293 void updateDPI();
294
295 uint16_t getDPIHint() override;
296
299
302
304 void ThemeRefresh();
305
306#ifdef WITH_INPUT_IME
307 GHOST_ImeWin32 *getImeInput()
308 {
309 return &m_imeInput;
310 }
311
312 void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed);
313
314 void endIME();
315#endif /* WITH_INPUT_IME */
316
317 /*
318 * Drive DirectManipulation context.
319 */
321
322 /*
323 * Handle DM_POINTERHITTEST events.
324 * \param wParam: wParam from the event.
325 */
326 void onPointerHitTest(WPARAM wParam);
327
329
330 private:
335 GHOST_Context *newDrawingContext(GHOST_TDrawingContextType type);
336
341 GHOST_TSuccess setWindowCursorVisibility(bool visible);
342
348 GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode);
349
354 GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
355 GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape);
356
361 GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap,
362 uint8_t *mask,
363 int sizex,
364 int sizey,
365 int hotX,
366 int hotY,
367 bool canInvertColor);
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 *m_system;
376 GHOST_DropTargetWin32 *m_dropTarget;
378 HWND m_hWnd;
380 HDC m_hDC;
381
382 bool m_isDialog;
383 GHOST_GPUDevice m_preferred_device;
384
386 bool m_hasMouseCaptured;
391 bool m_hasGrabMouse;
393 int m_nPressedButtons;
395 HCURSOR m_customCursor;
396
398 ITaskbarList3 *m_Bar;
399
400 static const wchar_t *s_windowClassName;
401 static const int s_maxTitleLength;
402
404 GHOST_Wintab *m_wintab;
405
407 GHOST_TabletData m_lastPointerTabletData;
408
409 GHOST_TWindowState m_normal_state;
410
412 HMODULE m_user32;
413
414 HWND m_parentWindowHwnd;
415
416 GHOST_DirectManipulationHelper *m_directManipulationHelper;
417
418#ifdef WITH_INPUT_IME
420 GHOST_ImeWin32 m_imeInput;
421#endif
422 bool m_debug_context;
423};
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
Definition GHOST_Types.h:80
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
float progress
Definition WM_types.hh:1019
unsigned long long int uint64_t
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_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, bool wantStereoVisual, GHOST_WindowWin32 *parentWindow, bool is_debug, bool dialog, const GHOST_GPUDevice &preferred_device)
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height)
void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const
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
void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle)
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const bool wantStereoVisual=false, 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