Blender  V3.3
GHOST_WindowWin32.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
9 #pragma once
10 
11 #ifndef WIN32
12 # error WIN32 only!
13 #endif // WIN32
14 
15 #include "GHOST_TaskbarWin32.h"
16 #include "GHOST_TrackpadWin32.h"
17 #include "GHOST_Window.h"
18 #include "GHOST_Wintab.h"
19 #ifdef WITH_INPUT_IME
20 # include "GHOST_ImeWin32.h"
21 #endif
22 
23 #include <vector>
24 
25 class GHOST_SystemWin32;
27 
28 // typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions
29 typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND);
30 
32  LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
33 
41 };
42 
43 typedef enum {
49 
54  public:
70  const char *title,
71  int32_t left,
72  int32_t top,
77  bool wantStereoVisual = false,
78  bool alphaBackground = false,
79  GHOST_WindowWin32 *parentWindow = 0,
80  bool is_debug = false,
81  bool dialog = false);
82 
88 
95  void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
96 
101  bool getValid() const;
102 
107  HWND getHWND() const;
108 
113  void setTitle(const char *title);
114 
119  std::string getTitle() const;
120 
127  void getWindowBounds(GHOST_Rect &bounds) const;
128 
134  void getClientBounds(GHOST_Rect &bounds) const;
135 
141 
147 
154 
160 
168  void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
169 
177  void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
178 
185 
192 
197 
202  GHOST_TSuccess setProgressBar(float progress);
203 
208 
216 
222  void lostMouseCapture();
223 
224  bool isDialog() const;
225 
231  HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const;
232  void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const;
233 
238  bool usingTabletAPI(GHOST_TTabletAPI api) const;
239 
247  GHOST_TSuccess getPointerInfo(std::vector<GHOST_PointerInfoWin32> &outPointerInfo,
248  WPARAM wParam,
249  LPARAM lParam);
250 
254  void resetPointerPenInfo();
255 
260  GHOST_Wintab *getWintab() const;
261 
267  void loadWintab(bool enable);
268 
272  void closeWintab();
273 
279 
281  {
282  return GHOST_kFailure;
283  }
284 
286  {
287  return GHOST_kFailure;
288  }
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 &m_imeInput;
307  }
308 
309  void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed);
310 
311  void endIME();
312 #endif /* WITH_INPUT_IME */
313 
314  /*
315  * Drive DirectManipulation context.
316  */
318 
319  /*
320  * Handle DM_POINTERHITTEST events.
321  * \param wParam: wParam from the event.
322  */
323  void onPointerHitTest(WPARAM wParam);
324 
326 
327  private:
332  GHOST_Context *newDrawingContext(GHOST_TDrawingContextType type);
333 
338  GHOST_TSuccess setWindowCursorVisibility(bool visible);
339 
345  GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode);
346 
351  GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
352  GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape);
353 
358  GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap,
359  uint8_t *mask,
360  int sizex,
361  int sizey,
362  int hotX,
363  int hotY,
364  bool canInvertColor);
365 
367  GHOST_SystemWin32 *m_system;
369  GHOST_DropTargetWin32 *m_dropTarget;
371  HWND m_hWnd;
373  HDC m_hDC;
374 
375  bool m_isDialog;
376 
378  bool m_hasMouseCaptured;
383  bool m_hasGrabMouse;
385  int m_nPressedButtons;
387  HCURSOR m_customCursor;
389  bool m_wantAlphaBackground;
390 
392  ITaskbarList3 *m_Bar;
393 
394  static const wchar_t *s_windowClassName;
395  static const int s_maxTitleLength;
396 
398  GHOST_Wintab *m_wintab;
399 
401  GHOST_TabletData m_lastPointerTabletData;
402 
403  GHOST_TWindowState m_normal_state;
404 
406  HMODULE m_user32;
407 
408  HWND m_parentWindowHwnd;
409 
410  GHOST_DirectManipulationHelper *m_directManipulationHelper;
411 
412 #ifdef WITH_INPUT_IME
414  GHOST_ImeWin32 m_imeInput;
415 #endif
416  bool m_debug_context;
417 };
GHOST_TWindowState
Definition: GHOST_Types.h:129
GHOST_TStandardCursor
Definition: GHOST_Types.h:214
GHOST_TDrawingContextType
Definition: GHOST_Types.h:148
@ GHOST_kDrawingContextTypeNone
Definition: GHOST_Types.h:149
GHOST_TWindowOrder
Definition: GHOST_Types.h:146
GHOST_TSuccess
Definition: GHOST_Types.h:74
@ GHOST_kFailure
Definition: GHOST_Types.h:74
GHOST_TGrabCursorMode
Definition: GHOST_Types.h:404
GHOST_TButton
Definition: GHOST_Types.h:156
GHOST_TTabletAPI
Definition: GHOST_Types.h:89
BOOL(API * GHOST_WIN32_AdjustWindowRectExForDpi)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi)
GHOST_MouseCaptureEventWin32
@ MousePressed
@ OperatorUngrab
@ MouseReleased
@ OperatorGrab
typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble top
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint order
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
void onPointerHitTest(WPARAM wParam)
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=GHOST_kDrawingContextTypeNone, bool wantStereoVisual=false, bool alphaBackground=false, GHOST_WindowWin32 *parentWindow=0, bool is_debug=false, bool dialog=false)
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
GHOST_TSuccess endProgressBar()
GHOST_TWindowState getState() 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)
const int state
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static int left
static const VertexNature POINT
Definition: Nature.h:20
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