Blender V4.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
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 bool wantStereoVisual,
80 bool alphaBackground,
81 GHOST_WindowWin32 *parentWindow,
82 bool is_debug,
83 bool dialog,
84 const GHOST_GPUDevice &preferred_device);
85
91
98 void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
99
104 bool getValid() const;
105
110 HWND getHWND() const;
111
116 void *getOSWindow() const;
117
122 void setTitle(const char *title);
123
128 std::string getTitle() const;
129
136 void getWindowBounds(GHOST_Rect &bounds) const;
137
143 void getClientBounds(GHOST_Rect &bounds) const;
144
150
156
163
169
177 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
178
186 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
187
194
201
206
211 GHOST_TSuccess setProgressBar(float progress);
212
217
225
231 void lostMouseCapture();
232
233 bool isDialog() const;
234
240 HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const;
241 void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const;
242
247 bool usingTabletAPI(GHOST_TTabletAPI api) const;
248
256 GHOST_TSuccess getPointerInfo(std::vector<GHOST_PointerInfoWin32> &outPointerInfo,
257 WPARAM wParam,
258 LPARAM lParam);
259
263 void resetPointerPenInfo();
264
269 GHOST_Wintab *getWintab() const;
270
276 void loadWintab(bool enable);
277
281 void closeWintab();
282
288
290 {
291 return GHOST_kFailure;
292 }
293
295 {
296 return GHOST_kFailure;
297 }
298
299 void updateDPI();
300
301 uint16_t getDPIHint() override;
302
305
308
310 void ThemeRefresh();
311
312#ifdef WITH_INPUT_IME
313 GHOST_ImeWin32 *getImeInput()
314 {
315 return &m_imeInput;
316 }
317
318 void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed);
319
320 void endIME();
321#endif /* WITH_INPUT_IME */
322
323 /*
324 * Drive DirectManipulation context.
325 */
327
328 /*
329 * Handle DM_POINTERHITTEST events.
330 * \param wParam: wParam from the event.
331 */
332 void onPointerHitTest(WPARAM wParam);
333
335
336 private:
341 GHOST_Context *newDrawingContext(GHOST_TDrawingContextType type);
342
347 GHOST_TSuccess setWindowCursorVisibility(bool visible);
348
354 GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode);
355
360 GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
361 GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape);
362
367 GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap,
368 uint8_t *mask,
369 int sizex,
370 int sizey,
371 int hotX,
372 int hotY,
373 bool canInvertColor);
374
375 /* Registration of the AppModel Properties that govern the taskbar button and jump lists. */
376 void registerWindowAppUserModelProperties();
377 void unregisterWindowAppUserModelProperties();
378
380 GHOST_SystemWin32 *m_system;
382 GHOST_DropTargetWin32 *m_dropTarget;
384 HWND m_hWnd;
386 HDC m_hDC;
387
388 bool m_isDialog;
389 GHOST_GPUDevice m_preferred_device;
390
392 bool m_hasMouseCaptured;
397 bool m_hasGrabMouse;
399 int m_nPressedButtons;
401 HCURSOR m_customCursor;
403 bool m_wantAlphaBackground;
404
406 ITaskbarList3 *m_Bar;
407
408 static const wchar_t *s_windowClassName;
409 static const int s_maxTitleLength;
410
412 GHOST_Wintab *m_wintab;
413
415 GHOST_TabletData m_lastPointerTabletData;
416
417 GHOST_TWindowState m_normal_state;
418
420 HMODULE m_user32;
421
422 HWND m_parentWindowHwnd;
423
424 GHOST_DirectManipulationHelper *m_directManipulationHelper;
425
426#ifdef WITH_INPUT_IME
428 GHOST_ImeWin32 m_imeInput;
429#endif
430 bool m_debug_context;
431};
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
Definition GHOST_Types.h:87
@ GHOST_kFailure
Definition GHOST_Types.h:87
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
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)
void setTitle(const char *title)
std::string getTitle() const
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
GHOST_TSuccess beginFullScreen() 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, bool alphaBackground, GHOST_WindowWin32 *parentWindow, bool is_debug, bool dialog, const GHOST_GPUDevice &preferred_device)
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_TSuccess endFullScreen() const
void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle)
static ulong state[N]
unsigned short uint16_t
Definition stdint.h:79
unsigned int uint32_t
Definition stdint.h:80
signed int int32_t
Definition stdint.h:77
unsigned char uint8_t
Definition stdint.h:78
unsigned __int64 uint64_t
Definition stdint.h:90
GHOST_TabletData tabletData