Blender  V2.93
GHOST_WindowCocoa.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 #ifndef __APPLE__
28 # error Apple OSX only!
29 #endif // __APPLE__
30 
31 #include "GHOST_Window.h"
32 
33 @class CAMetalLayer;
34 @class CocoaMetalView;
35 @class CocoaOpenGLView;
36 @class CocoaWindow;
37 @class NSCursor;
38 @class NSScreen;
39 
40 class GHOST_SystemCocoa;
41 
43  public:
59  const char *title,
66  const bool stereoVisual = false,
67  bool is_debug = false,
68  bool dialog = false,
69  GHOST_WindowCocoa *parentWindow = 0);
70 
76 
81  bool getValid() const;
82 
87  void *getOSWindow() const;
88 
93  void setTitle(const char *title);
98  std::string getTitle() const;
99 
106  void getWindowBounds(GHOST_Rect &bounds) const;
107 
113  void getClientBounds(GHOST_Rect &bounds) const;
114 
120 
126 
133 
139 
145  GHOST_TSuccess setModifiedState(bool isUnsavedChanges);
146 
154  void screenToClient(GHOST_TInt32 inX,
155  GHOST_TInt32 inY,
156  GHOST_TInt32 &outX,
157  GHOST_TInt32 &outY) const;
158 
166  void clientToScreen(GHOST_TInt32 inX,
167  GHOST_TInt32 inY,
168  GHOST_TInt32 &outX,
169  GHOST_TInt32 &outY) const;
170 
180  GHOST_TInt32 inY,
181  GHOST_TInt32 &outX,
182  GHOST_TInt32 &outY) const;
183 
193  GHOST_TInt32 inY,
194  GHOST_TInt32 &outX,
195  GHOST_TInt32 &outY) const;
196 
201  NSScreen *getScreen();
202 
209 
216 
217  NSCursor *getStandardCursor(GHOST_TStandardCursor cursor) const;
218  void loadCursor(bool visible, GHOST_TStandardCursor cursor) const;
219 
220  bool isDialog() const;
221 
223  {
224  return m_tablet;
225  }
226 
231  GHOST_TSuccess setProgressBar(float progress);
232 
237 
238  void setNativePixelSize(void);
239 
241  {
242  return GHOST_kFailure;
243  }
244 
246  {
247  return GHOST_kFailure;
248  }
249 
252  {
253  return m_window;
254  };
255 
256  /* Internal value to ensure proper redraws during animations */
257  void setImmediateDraw(bool value)
258  {
259  m_immediateDraw = value;
260  }
261  bool getImmediateDraw(void) const
262  {
263  return m_immediateDraw;
264  }
265 
266  protected:
272 
278 
284 
290 
297 
303  GHOST_TUns8 *mask,
304  int sizex,
305  int sizey,
306  int hotX,
307  int hotY,
308  bool canInvertColor);
309 
312 
314  CocoaOpenGLView *m_openGLView;
315  CocoaMetalView *m_metalView;
316  CAMetalLayer *m_metalLayer;
317 
320 
321  NSCursor *m_customCursor;
322 
324 
326  bool m_debug_context; // for debug messages during context setup
328 };
GHOST_TWindowState
Definition: GHOST_Types.h:144
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_TDrawingContextType
Definition: GHOST_Types.h:156
@ GHOST_kDrawingContextTypeNone
Definition: GHOST_Types.h:157
GHOST_TWindowOrder
Definition: GHOST_Types.h:154
GHOST_TSuccess
Definition: GHOST_Types.h:91
@ GHOST_kFailure
Definition: GHOST_Types.h:91
GHOST_TGrabCursorMode
Definition: GHOST_Types.h:412
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 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
_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 bottom
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition: btDbvt.cpp:299
void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
GHOST_TSuccess setClientWidth(GHOST_TUns32 width)
GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa, const char *title, GHOST_TInt32 left, GHOST_TInt32 bottom, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type=GHOST_kDrawingContextTypeNone, const bool stereoVisual=false, bool is_debug=false, bool dialog=false, GHOST_WindowCocoa *parentWindow=0)
GHOST_SystemCocoa * m_systemCocoa
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape)
void setImmediateDraw(bool value)
void setTitle(const char *title)
std::string getTitle() const
void clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type)
GHOST_TSuccess setWindowCursorVisibility(bool visible)
GHOST_TSuccess endFullScreen() const
CocoaOpenGLView * m_openGLView
CAMetalLayer * m_metalLayer
CocoaWindow * m_window
GHOST_TSuccess setOrder(GHOST_TWindowOrder order)
NSCursor * getStandardCursor(GHOST_TStandardCursor cursor) const
GHOST_TWindowState getState() const
GHOST_TabletData m_tablet
void getWindowBounds(GHOST_Rect &bounds) const
GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
void getClientBounds(GHOST_Rect &bounds) const
void * getOSWindow() const
void screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
GHOST_TSuccess setModifiedState(bool isUnsavedChanges)
GHOST_TSuccess setState(GHOST_TWindowState state)
void setNativePixelSize(void)
bool getImmediateDraw(void) const
void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
GHOST_TSuccess invalidate()
CocoaMetalView * m_metalView
CocoaWindow * getCocoaWindow() const
GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor)
GHOST_TSuccess setClientHeight(GHOST_TUns32 height)
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape)
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode)
GHOST_TabletData & GetCocoaTabletData()
GHOST_TSuccess beginFullScreen() const
void loadCursor(bool visible, GHOST_TStandardCursor cursor) const
GHOST_TSuccess setProgressBar(float progress)
GHOST_TSuccess endProgressBar()
static ulong state[N]
static int left
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)