Blender  V2.93
GHOST_Window.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
25 #pragma once
26 
27 #include "GHOST_IWindow.h"
28 
29 class GHOST_Context;
30 
38 class GHOST_Window : public GHOST_IWindow {
39  public:
54  const bool wantStereoVisual = false,
55  const bool exclusive = false);
56 
86  virtual ~GHOST_Window();
87 
92  virtual bool getValid() const
93  {
94  return m_context != NULL;
95  }
96 
101  virtual void *getOSWindow() const;
102 
107  inline GHOST_TStandardCursor getCursorShape() const;
108 
109  inline bool isDialog() const
110  {
111  return false;
112  }
113 
120 
130  GHOST_TUns8 *mask,
131  int sizex,
132  int sizey,
133  int hotX,
134  int hotY,
135  bool canInvertColor);
136 
141  inline bool getCursorVisibility() const;
143  inline bool getCursorGrabModeIsWarp() const;
144  inline GHOST_TAxisFlag getCursorGrabAxis() const;
145  inline void getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
146  inline void getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
148 
154  GHOST_TSuccess setCursorVisibility(bool visible);
155 
162  GHOST_TAxisFlag wrap_axis,
164  GHOST_TInt32 mouse_ungrab_xy[2]);
165 
171 
176  virtual GHOST_TSuccess setProgressBar(float /*progress*/)
177  {
178  return GHOST_kFailure;
179  }
180 
185  {
186  return GHOST_kFailure;
187  }
188 
194  GHOST_TSuccess setSwapInterval(int interval);
195 
200  GHOST_TSuccess getSwapInterval(int &intervalOut);
201 
205  void setAcceptDragOperation(bool canAccept);
206 
211  bool canAcceptDragOperation() const;
212 
218  virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges);
219 
224  virtual bool getModifiedState();
225 
231 
240 
245  virtual GHOST_TSuccess swapBuffers();
246 
252 
259 
264  virtual unsigned int getDefaultFramebuffer();
265 
271  {
272  return m_userData;
273  }
274 
279  void setUserData(const GHOST_TUserDataPtr userData)
280  {
281  m_userData = userData;
282  }
283 
284  float getNativePixelSize(void)
285  {
286  if (m_nativePixelSize > 0.0f)
287  return m_nativePixelSize;
288  return 1.0f;
289  }
290 
295  virtual inline GHOST_TUns16 getDPIHint()
296  {
297  return 96;
298  }
299 
300 #ifdef WITH_INPUT_IME
301  virtual void beginIME(
302  GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed)
303  {
304  /* do nothing temporarily if not in windows */
305  }
306 
307  virtual void endIME()
308  {
309  /* do nothing temporarily if not in windows */
310  }
311 #endif /* WITH_INPUT_IME */
312 
313  protected:
320 
325  virtual GHOST_TSuccess setWindowCursorVisibility(bool visible) = 0;
326 
332  {
333  return GHOST_kSuccess;
334  }
335 
341 
347  GHOST_TUns8 *mask,
348  int szx,
349  int szy,
350  int hotX,
351  int hotY,
352  bool canInvertColor) = 0;
353 
355 
358 
361 
364 
367 
370 
373 
376 
379 
382 
385 
388 
391 
394 
397 
402 
403  /* OSX only, retina screens */
405 
406  private:
407  GHOST_Context *m_context;
408 };
409 
411 {
412  return m_drawingContextType;
413 }
414 
416 {
417  return m_cursorVisible;
418 }
419 
421 {
422  return m_cursorGrab;
423 }
424 
426 {
428 }
429 
431 {
432  return m_cursorGrabAxis;
433 }
434 
436 {
437  x = m_cursorGrabInitPos[0];
438  y = m_cursorGrabInitPos[1];
439 }
440 
442 {
443  x = m_cursorGrabAccumPos[0];
444  y = m_cursorGrabAccumPos[1];
445 }
446 
448 {
449  m_cursorGrabAccumPos[0] = x;
450  m_cursorGrabAccumPos[1] = y;
451 }
452 
454 {
455  return m_cursorShape;
456 }
GHOST_TWindowState
Definition: GHOST_Types.h:144
void * GHOST_TUserDataPtr
Definition: GHOST_Types.h:89
GHOST_TStandardCursor
Definition: GHOST_Types.h:222
unsigned int GHOST_TUns32
Definition: GHOST_Types.h:64
int GHOST_TInt32
Definition: GHOST_Types.h:63
GHOST_TAxisFlag
Definition: GHOST_Types.h:423
unsigned short GHOST_TUns16
Definition: GHOST_Types.h:62
GHOST_TDrawingContextType
Definition: GHOST_Types.h:156
GHOST_TSuccess
Definition: GHOST_Types.h:91
@ GHOST_kFailure
Definition: GHOST_Types.h:91
@ GHOST_kSuccess
Definition: GHOST_Types.h:91
GHOST_TGrabCursorMode
Definition: GHOST_Types.h:412
@ GHOST_kGrabWrap
Definition: GHOST_Types.h:418
@ GHOST_kGrabHide
Definition: GHOST_Types.h:420
unsigned char GHOST_TUns8
Definition: GHOST_Types.h:60
_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 type
_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
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:378
virtual unsigned int getDefaultFramebuffer()
GHOST_Window(GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, const bool wantStereoVisual=false, const bool exclusive=false)
GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds)
virtual bool getModifiedState()
GHOST_TSuccess getSwapInterval(int &intervalOut)
bool getCursorVisibility() const
Definition: GHOST_Window.h:415
virtual GHOST_TSuccess endProgressBar()
Definition: GHOST_Window.h:184
GHOST_TGrabCursorMode m_cursorGrab
Definition: GHOST_Window.h:366
GHOST_TAxisFlag getCursorGrabAxis() const
Definition: GHOST_Window.h:430
GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
bool m_wantStereoVisual
Definition: GHOST_Window.h:396
void getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const
Definition: GHOST_Window.h:435
GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type)
GHOST_TUns32 m_fullScreenWidth
Definition: GHOST_Window.h:399
GHOST_TInt32 m_cursorGrabAccumPos[2]
Definition: GHOST_Window.h:375
GHOST_TStandardCursor m_cursorShape
Definition: GHOST_Window.h:381
bool m_cursorVisible
Definition: GHOST_Window.h:363
virtual GHOST_TUns16 getDPIHint()
Definition: GHOST_Window.h:295
bool isDialog() const
Definition: GHOST_Window.h:109
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode)
Definition: GHOST_Window.h:331
GHOST_TSuccess releaseNativeHandles()
virtual void * getOSWindow() const
GHOST_TAxisFlag m_cursorGrabAxis
Definition: GHOST_Window.h:369
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
GHOST_TInt32 m_cursorGrabInitPos[2]
Definition: GHOST_Window.h:372
virtual GHOST_TSuccess setProgressBar(float)
Definition: GHOST_Window.h:176
GHOST_TUns32 m_fullScreenHeight
Definition: GHOST_Window.h:401
virtual GHOST_TSuccess setWindowCursorVisibility(bool visible)=0
GHOST_TDrawingContextType m_drawingContextType
Definition: GHOST_Window.h:357
virtual bool getValid() const
Definition: GHOST_Window.h:92
void setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y)
Definition: GHOST_Window.h:447
GHOST_TDrawingContextType getDrawingContextType()
Definition: GHOST_Window.h:410
GHOST_TGrabCursorMode getCursorGrabMode() const
Definition: GHOST_Window.h:420
bool m_isUnsavedChanges
Definition: GHOST_Window.h:390
float m_nativePixelSize
Definition: GHOST_Window.h:404
void getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const
Definition: GHOST_Window.h:441
GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, GHOST_Rect *bounds, GHOST_TInt32 mouse_ungrab_xy[2])
void setAcceptDragOperation(bool canAccept)
float getNativePixelSize(void)
Definition: GHOST_Window.h:284
GHOST_TSuccess updateDrawingContext()
GHOST_TUserDataPtr m_userData
Definition: GHOST_Window.h:360
void setUserData(const GHOST_TUserDataPtr userData)
Definition: GHOST_Window.h:279
bool m_progressBarVisible
Definition: GHOST_Window.h:384
virtual ~GHOST_Window()
GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape)
virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape)=0
bool m_canAcceptDragOperation
Definition: GHOST_Window.h:387
virtual GHOST_TSuccess activateDrawingContext()
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int szx, int szy, int hotX, int hotY, bool canInvertColor)=0
GHOST_TSuccess setCursorVisibility(bool visible)
GHOST_TStandardCursor getCursorShape() const
Definition: GHOST_Window.h:453
bool getCursorGrabModeIsWarp() const
Definition: GHOST_Window.h:425
GHOST_TUserDataPtr getUserData() const
Definition: GHOST_Window.h:270
static ulong state[N]
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)