Blender  V3.3
GHOST_Window.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 #include "GHOST_IWindow.h"
12 
13 class GHOST_Context;
14 
22 class GHOST_Window : public GHOST_IWindow {
23  public:
37  const bool wantStereoVisual = false,
38  const bool exclusive = false);
39 
69  virtual ~GHOST_Window();
70 
75  virtual bool getValid() const
76  {
77  return m_context != NULL;
78  }
79 
84  virtual void *getOSWindow() const;
85 
91 
92  inline bool isDialog() const
93  {
94  return false;
95  }
96 
103 
113  uint8_t *mask,
114  int sizex,
115  int sizey,
116  int hotX,
117  int hotY,
118  bool canInvertColor);
119 
121 
126  inline bool getCursorVisibility() const;
128  inline bool getCursorGrabModeIsWarp() const;
129  inline GHOST_TAxisFlag getCursorGrabAxis() const;
130  inline void getCursorGrabInitPos(int32_t &x, int32_t &y) const;
131  inline void getCursorGrabAccum(int32_t &x, int32_t &y) const;
132  inline void setCursorGrabAccum(int32_t x, int32_t y);
133 
139  GHOST_TSuccess setCursorVisibility(bool visible);
140 
147  GHOST_TAxisFlag wrap_axis,
149  int32_t mouse_ungrab_xy[2]);
150 
156 
158  GHOST_TAxisFlag &axis_flag,
160  bool &use_software_cursor);
165 
170  virtual GHOST_TSuccess setProgressBar(float /*progress*/)
171  {
172  return GHOST_kFailure;
173  }
174 
179  {
180  return GHOST_kFailure;
181  }
182 
188  GHOST_TSuccess setSwapInterval(int interval);
189 
194  GHOST_TSuccess getSwapInterval(int &intervalOut);
195 
199  void setAcceptDragOperation(bool canAccept);
200 
205  bool canAcceptDragOperation() const;
206 
212  virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges);
213 
218  virtual bool getModifiedState();
219 
225 
234 
239  virtual GHOST_TSuccess swapBuffers();
240 
246 
253 
258  virtual unsigned int getDefaultFramebuffer();
259 
265  {
266  return m_userData;
267  }
268 
273  void setUserData(const GHOST_TUserDataPtr userData)
274  {
275  m_userData = userData;
276  }
277 
278  float getNativePixelSize(void)
279  {
280  if (m_nativePixelSize > 0.0f)
281  return m_nativePixelSize;
282  return 1.0f;
283  }
284 
289  virtual inline uint16_t getDPIHint()
290  {
291  return 96;
292  }
293 
294 #ifdef WITH_INPUT_IME
295  virtual void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed)
296  {
297  /* do nothing temporarily if not in windows */
298  }
299 
300  virtual void endIME()
301  {
302  /* do nothing temporarily if not in windows */
303  }
304 #endif /* WITH_INPUT_IME */
305 
306  protected:
313 
318  virtual GHOST_TSuccess setWindowCursorVisibility(bool visible) = 0;
319 
325  {
326  return GHOST_kSuccess;
327  }
328 
334 
340  uint8_t *mask,
341  int szx,
342  int szy,
343  int hotX,
344  int hotY,
345  bool canInvertColor) = 0;
346 
348 
351 
354 
357 
360 
363 
366 
369 
372 
375 
378 
381 
384 
387 
390 
395 
396  /* OSX only, retina screens */
398 
399  private:
400  GHOST_Context *m_context;
401 };
402 
404 {
405  return m_drawingContextType;
406 }
407 
409 {
410  return m_cursorVisible;
411 }
412 
414 {
415  return m_cursorGrab;
416 }
417 
419 {
421 }
422 
424 {
425  return m_cursorGrabAxis;
426 }
427 
429 {
430  x = m_cursorGrabInitPos[0];
431  y = m_cursorGrabInitPos[1];
432 }
433 
435 {
436  x = m_cursorGrabAccumPos[0];
437  y = m_cursorGrabAccumPos[1];
438 }
439 
441 {
442  m_cursorGrabAccumPos[0] = x;
443  m_cursorGrabAccumPos[1] = y;
444 }
445 
447 {
448  return m_cursorShape;
449 }
GHOST_TWindowState
Definition: GHOST_Types.h:129
void * GHOST_TUserDataPtr
Definition: GHOST_Types.h:72
GHOST_TStandardCursor
Definition: GHOST_Types.h:214
GHOST_TAxisFlag
Definition: GHOST_Types.h:420
GHOST_TDrawingContextType
Definition: GHOST_Types.h:148
GHOST_TSuccess
Definition: GHOST_Types.h:74
@ GHOST_kFailure
Definition: GHOST_Types.h:74
@ GHOST_kSuccess
Definition: GHOST_Types.h:74
GHOST_TGrabCursorMode
Definition: GHOST_Types.h:404
@ GHOST_kGrabWrap
Definition: GHOST_Types.h:410
@ GHOST_kGrabHide
Definition: GHOST_Types.h:415
_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
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_Rect m_cursorGrabBounds
Definition: GHOST_Window.h:371
bool getCursorGrabUseSoftwareDisplay()
GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
virtual unsigned int getDefaultFramebuffer()
GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds)
virtual bool getModifiedState()
GHOST_TSuccess getSwapInterval(int &intervalOut)
bool getCursorVisibility() const
Definition: GHOST_Window.h:408
void setCursorGrabAccum(int32_t x, int32_t y)
Definition: GHOST_Window.h:440
void getCursorGrabInitPos(int32_t &x, int32_t &y) const
Definition: GHOST_Window.h:428
virtual GHOST_TSuccess endProgressBar()
Definition: GHOST_Window.h:178
GHOST_TGrabCursorMode m_cursorGrab
Definition: GHOST_Window.h:359
GHOST_TAxisFlag getCursorGrabAxis() const
Definition: GHOST_Window.h:423
int32_t m_cursorGrabAccumPos[2]
Definition: GHOST_Window.h:368
bool m_wantStereoVisual
Definition: GHOST_Window.h:389
int32_t m_cursorGrabInitPos[2]
Definition: GHOST_Window.h:365
GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type)
GHOST_TStandardCursor m_cursorShape
Definition: GHOST_Window.h:374
virtual uint16_t getDPIHint()
Definition: GHOST_Window.h:289
bool m_cursorVisible
Definition: GHOST_Window.h:356
bool isDialog() const
Definition: GHOST_Window.h:92
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode)
Definition: GHOST_Window.h:324
GHOST_TSuccess releaseNativeHandles()
virtual void * getOSWindow() const
GHOST_TAxisFlag m_cursorGrabAxis
Definition: GHOST_Window.h:362
virtual GHOST_TSuccess swapBuffers()
virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges)
GHOST_TSuccess setSwapInterval(int interval)
virtual GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type)=0
bool canAcceptDragOperation() const
virtual GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int szx, int szy, int hotX, int hotY, bool canInvertColor)=0
virtual GHOST_TSuccess setProgressBar(float)
Definition: GHOST_Window.h:170
GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, GHOST_Rect *bounds, int32_t mouse_ungrab_xy[2])
virtual GHOST_TSuccess setWindowCursorVisibility(bool visible)=0
GHOST_TDrawingContextType m_drawingContextType
Definition: GHOST_Window.h:350
uint32_t m_fullScreenHeight
Definition: GHOST_Window.h:394
virtual bool getValid() const
Definition: GHOST_Window.h:75
GHOST_TDrawingContextType getDrawingContextType()
Definition: GHOST_Window.h:403
void getCursorGrabState(GHOST_TGrabCursorMode &mode, GHOST_TAxisFlag &axis_flag, GHOST_Rect &bounds, bool &use_software_cursor)
GHOST_TGrabCursorMode getCursorGrabMode() const
Definition: GHOST_Window.h:413
bool m_isUnsavedChanges
Definition: GHOST_Window.h:383
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const bool wantStereoVisual=false, const bool exclusive=false)
float m_nativePixelSize
Definition: GHOST_Window.h:397
void setAcceptDragOperation(bool canAccept)
float getNativePixelSize(void)
Definition: GHOST_Window.h:278
GHOST_TSuccess updateDrawingContext()
GHOST_TUserDataPtr m_userData
Definition: GHOST_Window.h:353
void setUserData(const GHOST_TUserDataPtr userData)
Definition: GHOST_Window.h:273
bool m_progressBarVisible
Definition: GHOST_Window.h:377
virtual ~GHOST_Window()
GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape)
virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape)=0
bool m_canAcceptDragOperation
Definition: GHOST_Window.h:380
virtual GHOST_TSuccess activateDrawingContext()
GHOST_TSuccess setCursorVisibility(bool visible)
GHOST_TStandardCursor getCursorShape() const
Definition: GHOST_Window.h:446
bool getCursorGrabModeIsWarp() const
Definition: GHOST_Window.h:418
void getCursorGrabAccum(int32_t &x, int32_t &y) const
Definition: GHOST_Window.h:434
GHOST_TUserDataPtr getUserData() const
Definition: GHOST_Window.h:264
GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap)
uint32_t m_fullScreenWidth
Definition: GHOST_Window.h:392
const int state
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
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