Blender
V3.3
|
#include <GHOST_WindowCocoa.h>
Protected Member Functions | |
GHOST_Context * | newDrawingContext (GHOST_TDrawingContextType type) |
GHOST_TSuccess | invalidate () |
GHOST_TSuccess | setWindowCursorVisibility (bool visible) |
GHOST_TSuccess | setWindowCursorGrab (GHOST_TGrabCursorMode mode) |
GHOST_TSuccess | setWindowCursorShape (GHOST_TStandardCursor shape) |
GHOST_TSuccess | hasCursorShape (GHOST_TStandardCursor shape) |
GHOST_TSuccess | setWindowCustomCursorShape (uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor) |
![]() | |
GHOST_TSuccess | releaseNativeHandles () |
Protected Attributes | |
CocoaWindow * | m_window |
CocoaOpenGLView * | m_openGLView |
CocoaMetalView * | m_metalView |
CAMetalLayer * | m_metalLayer |
GHOST_SystemCocoa * | m_systemCocoa |
NSCursor * | m_customCursor |
GHOST_TabletData | m_tablet |
bool | m_immediateDraw |
bool | m_debug_context |
bool | m_is_dialog |
![]() | |
GHOST_TDrawingContextType | m_drawingContextType |
GHOST_TUserDataPtr | m_userData |
bool | m_cursorVisible |
GHOST_TGrabCursorMode | m_cursorGrab |
GHOST_TAxisFlag | m_cursorGrabAxis |
int32_t | m_cursorGrabInitPos [2] |
int32_t | m_cursorGrabAccumPos [2] |
GHOST_Rect | m_cursorGrabBounds |
GHOST_TStandardCursor | m_cursorShape |
bool | m_progressBarVisible |
bool | m_canAcceptDragOperation |
bool | m_isUnsavedChanges |
bool | m_fullScreen |
bool | m_wantStereoVisual |
uint32_t | m_fullScreenWidth |
uint32_t | m_fullScreenHeight |
float | m_nativePixelSize |
Definition at line 29 of file GHOST_WindowCocoa.h.
GHOST_WindowCocoa::GHOST_WindowCocoa | ( | GHOST_SystemCocoa * | systemCocoa, |
const char * | title, | ||
int32_t | left, | ||
int32_t | bottom, | ||
uint32_t | width, | ||
uint32_t | height, | ||
GHOST_TWindowState | state, | ||
GHOST_TDrawingContextType | type = GHOST_kDrawingContextTypeNone , |
||
const bool | stereoVisual = false , |
||
bool | is_debug = false , |
||
bool | dialog = false , |
||
GHOST_WindowCocoa * | parentWindow = 0 |
||
) |
Constructor. Creates a new window and opens it. To check if the window was created properly, use the getValid() method.
systemCocoa | The associated system class to forward events to. |
title | The text shown in the title bar of the window. |
left | The coordinate of the left edge of the window. |
bottom | The coordinate of the bottom edge of the window. |
width | The width the window. |
height | The height the window. |
state | The state the window is initially opened with. |
type | The type of drawing context installed in this window. |
stereoVisual | Stereo visual for quad buffered stereo. |
Definition at line 270 of file GHOST_WindowCocoa.mm.
References GHOST_Window::activateDrawingContext(), bottom, GHOST_kWindowStateFullScreen, GHOST_TABLET_DATA_NONE, height, left, GHOST_Window::m_fullScreen, m_metalLayer, m_metalView, GHOST_System::m_nativePixel, m_openGLView, m_systemCocoa, m_tablet, m_window, blender::compositor::pool, GHOST_Window::setDrawingContextType(), setNativePixelSize(), setState(), CocoaWindowDelegate::setSystemAndWindowCocoa:windowCocoa:, CocoaWindow::setSystemAndWindowCocoa:windowCocoa:, setTitle(), state, type, GHOST_Window::updateDrawingContext(), view, and width.
GHOST_WindowCocoa::~GHOST_WindowCocoa | ( | ) |
Destructor. Closes the window and disposes resources allocated.
Definition at line 402 of file GHOST_WindowCocoa.mm.
References Freestyle::a, m_customCursor, m_metalLayer, m_metalView, m_openGLView, m_window, blender::compositor::pool, and GHOST_Window::releaseNativeHandles().
|
inlinevirtual |
Implements GHOST_IWindow.
Definition at line 215 of file GHOST_WindowCocoa.h.
References GHOST_kFailure.
|
virtual |
Converts a point in client rectangle coordinates to screen coordinates.
inX | The x-coordinate in the client rectangle. |
inY | The y-coordinate in the client rectangle. |
outX | The x-coordinate on the screen. |
outY | The y-coordinate on the screen. |
Implements GHOST_IWindow.
Definition at line 656 of file GHOST_WindowCocoa.mm.
References clientToScreenIntern(), getClientBounds(), GHOST_Rect::getHeight(), getValid(), and GHOST_ASSERT.
void GHOST_WindowCocoa::clientToScreenIntern | ( | int32_t | inX, |
int32_t | inY, | ||
int32_t & | outX, | ||
int32_t & | outY | ||
) | const |
Converts a point in client rectangle coordinates to screen coordinates. but without the y coordinate conversion needed for ghost compatibility.
inX | The x-coordinate in the client rectangle. |
inY | The y-coordinate in the client rectangle. |
outX | The x-coordinate on the screen. |
outY | The y-coordinate on the screen. |
Definition at line 688 of file GHOST_WindowCocoa.mm.
References m_window.
Referenced by clientToScreen(), GHOST_SystemCocoa::handleDraggingEvent(), and GHOST_SystemCocoa::handleMouseEvent().
|
inlinevirtual |
Implements GHOST_IWindow.
Definition at line 220 of file GHOST_WindowCocoa.h.
References GHOST_kFailure.
|
virtual |
Hides the progress bar icon
Reimplemented from GHOST_Window.
Definition at line 886 of file GHOST_WindowCocoa.mm.
References GHOST_kFailure, GHOST_kSuccess, GHOST_Window::m_progressBarVisible, blender::compositor::pool, and postNotification().
|
virtual |
Returns the client rectangle dimensions. The left and top members of the rectangle are always zero.
bounds | The bounding rectangle of the client area of the window. |
Implements GHOST_IWindow.
Definition at line 536 of file GHOST_WindowCocoa.mm.
References bounds(), getValid(), GHOST_ASSERT, m_window, and blender::compositor::pool.
Referenced by clientToScreen(), GHOST_SystemCocoa::handleMouseEvent(), screenToClient(), setClientHeight(), setClientSize(), setClientWidth(), and setNativePixelSize().
|
inline |
Definition at line 197 of file GHOST_WindowCocoa.h.
References m_tablet.
Referenced by GHOST_SystemCocoa::setCursorPosition().
|
inline |
public function to get the window containing the OpenGL view
Definition at line 226 of file GHOST_WindowCocoa.h.
References m_window.
Definition at line 236 of file GHOST_WindowCocoa.h.
References m_immediateDraw.
|
virtual |
Returns the associated NSWindow object
Reimplemented from GHOST_Window.
Definition at line 452 of file GHOST_WindowCocoa.mm.
References m_window.
Referenced by GHOST_SystemCocoa::handleMouseEvent().
NSScreen * GHOST_WindowCocoa::getScreen | ( | ) |
Gets the screen the window is displayed in
Definition at line 705 of file GHOST_WindowCocoa.mm.
References m_window.
Referenced by GHOST_SystemCocoa::setMouseCursorPosition().
NSCursor * GHOST_WindowCocoa::getStandardCursor | ( | GHOST_TStandardCursor | cursor | ) | const |
Definition at line 942 of file GHOST_WindowCocoa.mm.
References getImageCursor(), GHOST_kStandardCursorBottomSide, GHOST_kStandardCursorCopy, GHOST_kStandardCursorCrosshair, GHOST_kStandardCursorCrosshairA, GHOST_kStandardCursorCrosshairB, GHOST_kStandardCursorCrosshairC, GHOST_kStandardCursorCustom, GHOST_kStandardCursorDefault, GHOST_kStandardCursorDestroy, GHOST_kStandardCursorDownArrow, GHOST_kStandardCursorEraser, GHOST_kStandardCursorEWScroll, GHOST_kStandardCursorEyedropper, GHOST_kStandardCursorHorizontalSplit, GHOST_kStandardCursorKnife, GHOST_kStandardCursorLeftArrow, GHOST_kStandardCursorLeftRight, GHOST_kStandardCursorLeftSide, GHOST_kStandardCursorMove, GHOST_kStandardCursorNSEWScroll, GHOST_kStandardCursorNSScroll, GHOST_kStandardCursorPencil, GHOST_kStandardCursorRightArrow, GHOST_kStandardCursorRightSide, GHOST_kStandardCursorStop, GHOST_kStandardCursorText, GHOST_kStandardCursorTopSide, GHOST_kStandardCursorUpArrow, GHOST_kStandardCursorUpDown, GHOST_kStandardCursorVerticalSplit, GHOST_kStandardCursorZoomIn, GHOST_kStandardCursorZoomOut, m_customCursor, and NULL.
Referenced by hasCursorShape(), and loadCursor().
|
virtual |
Returns the state of the window (normal, minimized, maximized).
Implements GHOST_IWindow.
Definition at line 606 of file GHOST_WindowCocoa.mm.
References getValid(), GHOST_ASSERT, GHOST_kWindowStateFullScreen, GHOST_kWindowStateMaximized, GHOST_kWindowStateMinimized, GHOST_kWindowStateNormal, m_immediateDraw, m_window, blender::compositor::pool, and state.
|
virtual |
Returns the title displayed in the title bar.
title | The title displayed in the title bar. |
Implements GHOST_IWindow.
Definition at line 499 of file GHOST_WindowCocoa.mm.
References getValid(), GHOST_ASSERT, m_window, and blender::compositor::pool.
|
virtual |
Returns indication as to whether the window is valid.
Reimplemented from GHOST_Window.
Definition at line 446 of file GHOST_WindowCocoa.mm.
References GHOST_Window::getValid(), m_metalView, m_openGLView, m_window, NULL, and view.
Referenced by clientToScreen(), getClientBounds(), getState(), getTitle(), getWindowBounds(), invalidate(), screenToClient(), setClientHeight(), setClientSize(), setClientWidth(), setOrder(), setState(), and setTitle().
|
virtual |
Returns the window rectangle dimensions. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
bounds | The bounding rectangle of the window. |
Implements GHOST_IWindow.
Definition at line 517 of file GHOST_WindowCocoa.mm.
References bounds(), getValid(), GHOST_ASSERT, m_window, and blender::compositor::pool.
|
protectedvirtual |
Test if the standard cursor shape is supported by current platform.
Implements GHOST_IWindow.
Definition at line 1106 of file GHOST_WindowCocoa.mm.
References getStandardCursor(), GHOST_kFailure, GHOST_kSuccess, and blender::compositor::pool.
|
protectedvirtual |
Invalidates the contents of this window.
Implements GHOST_IWindow.
Definition at line 823 of file GHOST_WindowCocoa.mm.
References getValid(), GHOST_ASSERT, GHOST_kSuccess, m_metalView, m_openGLView, blender::compositor::pool, and view.
|
virtual |
Reimplemented from GHOST_Window.
Definition at line 1041 of file GHOST_WindowCocoa.mm.
References m_is_dialog.
Referenced by GHOST_SystemCocoa::handleApplicationBecomeActiveEvent(), and GHOST_SystemCocoa::hasDialogWindow().
void GHOST_WindowCocoa::loadCursor | ( | bool | visible, |
GHOST_TStandardCursor | cursor | ||
) | const |
Definition at line 1019 of file GHOST_WindowCocoa.mm.
References getStandardCursor(), GHOST_kStandardCursorDefault, and NULL.
Referenced by GHOST_SystemCocoa::handleWindowEvent(), setWindowCursorShape(), setWindowCursorVisibility(), and setWindowCustomCursorShape().
|
protectedvirtual |
type | The type of rendering context create. |
Implements GHOST_Window.
Definition at line 805 of file GHOST_WindowCocoa.mm.
References blender::compositor::context, GHOST_kDrawingContextTypeOpenGL, m_metalLayer, m_metalView, m_openGLView, GHOST_Window::m_wantStereoVisual, NULL, and type.
|
virtual |
Converts a point in screen coordinates to client rectangle coordinates
inX | The x-coordinate on the screen. |
inY | The y-coordinate on the screen. |
outX | The x-coordinate in the client rectangle. |
outY | The y-coordinate in the client rectangle. |
Implements GHOST_IWindow.
Definition at line 641 of file GHOST_WindowCocoa.mm.
References getClientBounds(), GHOST_Rect::getHeight(), getValid(), GHOST_ASSERT, and screenToClientIntern().
Referenced by GHOST_SystemCocoa::handleMouseEvent().
void GHOST_WindowCocoa::screenToClientIntern | ( | int32_t | inX, |
int32_t | inY, | ||
int32_t & | outX, | ||
int32_t & | outY | ||
) | const |
Converts a point in screen coordinates to client rectangle coordinates, but without the y coordinate conversion needed for ghost compatibility.
inX | The x-coordinate on the screen. |
inY | The y-coordinate on the screen. |
outX | The x-coordinate in the client rectangle. |
outY | The y-coordinate in the client rectangle. |
Definition at line 671 of file GHOST_WindowCocoa.mm.
References m_window.
Referenced by GHOST_SystemCocoa::handleMouseEvent(), and screenToClient().
|
virtual |
Resizes client rectangle height.
height | The new height of the client area of the window. |
Implements GHOST_IWindow.
Definition at line 574 of file GHOST_WindowCocoa.mm.
References getClientBounds(), GHOST_Rect::getHeight(), getValid(), GHOST_Rect::getWidth(), GHOST_ASSERT, GHOST_kSuccess, height, m_window, blender::compositor::pool, and size().
|
virtual |
Resizes client rectangle.
width | The new width of the client area of the window. |
height | The new height of the client area of the window. |
Implements GHOST_IWindow.
Definition at line 590 of file GHOST_WindowCocoa.mm.
References getClientBounds(), GHOST_Rect::getHeight(), getValid(), GHOST_Rect::getWidth(), GHOST_ASSERT, GHOST_kSuccess, height, m_window, blender::compositor::pool, size(), and width.
|
virtual |
Resizes client rectangle width.
width | The new width of the client area of the window. |
Implements GHOST_IWindow.
Definition at line 558 of file GHOST_WindowCocoa.mm.
References getClientBounds(), GHOST_Rect::getHeight(), getValid(), GHOST_Rect::getWidth(), GHOST_ASSERT, GHOST_kSuccess, m_window, blender::compositor::pool, size(), and width.
Definition at line 232 of file GHOST_WindowCocoa.h.
References m_immediateDraw.
|
virtual |
Sets the window "modified" status, indicating unsaved changes
isUnsavedChanges | Unsaved changes or not. |
Reimplemented from GHOST_Window.
Definition at line 768 of file GHOST_WindowCocoa.mm.
References m_window, blender::compositor::pool, and GHOST_Window::setModifiedState().
Definition at line 711 of file GHOST_WindowCocoa.mm.
References float(), getClientBounds(), GHOST_Rect::getWidth(), m_metalView, GHOST_Window::m_nativePixelSize, m_openGLView, and view.
Referenced by GHOST_WindowCocoa(), and GHOST_SystemCocoa::handleWindowEvent().
|
virtual |
Sets the order of the window (bottom, top).
order | The order of the window. |
Implements GHOST_IWindow.
Definition at line 778 of file GHOST_WindowCocoa.mm.
References count, getValid(), GHOST_ASSERT, GHOST_kSuccess, GHOST_kWindowOrderTop, m_window, order, and blender::compositor::pool.
|
virtual |
Sets the progress bar value displayed in the window/application icon
progress | The progress percentage (0.0 to 1.0). |
Reimplemented from GHOST_Window.
Definition at line 835 of file GHOST_WindowCocoa.mm.
References GHOST_kSuccess, GHOST_Window::m_progressBarVisible, and blender::compositor::pool.
|
virtual |
Sets the state of the window (normal, minimized, maximized).
state | The state of the window. |
Instead, the menu bar and the dock are hidden, and the window is made border-less and enlarged. Thus, process switch, exposé, spaces, ... still work in fullscreen mode
Implements GHOST_IWindow.
Definition at line 729 of file GHOST_WindowCocoa.mm.
References getValid(), GHOST_ASSERT, GHOST_kSuccess, GHOST_kWindowStateFullScreen, GHOST_kWindowStateMaximized, GHOST_kWindowStateMinimized, GHOST_kWindowStateNormal, m_window, blender::compositor::pool, and state.
Referenced by GHOST_WindowCocoa().
|
virtual |
Sets the title displayed in the title bar.
title | The title to display in the title bar. |
Implements GHOST_IWindow.
Definition at line 457 of file GHOST_WindowCocoa.mm.
References e, getValid(), GHOST_ASSERT, len, m_window, and blender::compositor::pool.
Referenced by GHOST_WindowCocoa().
|
protectedvirtual |
Sets the cursor grab on the window using native window system calls.
Reimplemented from GHOST_Window.
Definition at line 1058 of file GHOST_WindowCocoa.mm.
References err, GHOST_SystemCocoa::getCursorPosition(), GHOST_kGrabDisable, GHOST_kGrabHide, GHOST_kGrabNormal, GHOST_kSuccess, GHOST_Window::m_cursorGrab, GHOST_Window::m_cursorGrabBounds, GHOST_Window::m_cursorGrabInitPos, GHOST_Rect::m_l, GHOST_Rect::m_r, m_systemCocoa, m_window, blender::compositor::pool, GHOST_Window::setCursorGrabAccum(), GHOST_SystemCocoa::setCursorPosition(), and setWindowCursorVisibility().
|
protectedvirtual |
Sets the cursor shape on the window using native window system calls.
Implements GHOST_Window.
Definition at line 1094 of file GHOST_WindowCocoa.mm.
References GHOST_Window::getCursorVisibility(), GHOST_kSuccess, loadCursor(), m_window, and blender::compositor::pool.
|
protectedvirtual |
Sets the cursor visibility on the window using native window system calls.
Implements GHOST_Window.
Definition at line 1046 of file GHOST_WindowCocoa.mm.
References GHOST_Window::getCursorShape(), GHOST_kSuccess, loadCursor(), m_window, and blender::compositor::pool.
Referenced by setWindowCursorGrab().
|
protectedvirtual |
Sets the cursor shape on the window using native window system calls.
Implements GHOST_Window.
Definition at line 1135 of file GHOST_WindowCocoa.mm.
References GHOST_Window::getCursorVisibility(), GHOST_kStandardCursorCustom, GHOST_kSuccess, loadCursor(), m_customCursor, m_window, mask(), blender::compositor::pool, uns16ReverseBits(), and y.
|
protected |
Definition at line 301 of file GHOST_WindowCocoa.h.
Referenced by getStandardCursor(), setWindowCustomCursorShape(), and ~GHOST_WindowCocoa().
|
protected |
Definition at line 306 of file GHOST_WindowCocoa.h.
|
protected |
Definition at line 305 of file GHOST_WindowCocoa.h.
Referenced by getImmediateDraw(), getState(), and setImmediateDraw().
|
protected |
Definition at line 307 of file GHOST_WindowCocoa.h.
Referenced by isDialog().
|
protected |
Definition at line 296 of file GHOST_WindowCocoa.h.
Referenced by GHOST_WindowCocoa(), newDrawingContext(), and ~GHOST_WindowCocoa().
|
protected |
Definition at line 295 of file GHOST_WindowCocoa.h.
Referenced by getValid(), GHOST_WindowCocoa(), invalidate(), newDrawingContext(), setNativePixelSize(), and ~GHOST_WindowCocoa().
|
protected |
The view, either Metal or OpenGL
Definition at line 294 of file GHOST_WindowCocoa.h.
Referenced by getValid(), GHOST_WindowCocoa(), invalidate(), newDrawingContext(), setNativePixelSize(), and ~GHOST_WindowCocoa().
|
protected |
The mother SystemCocoa class to send events
Definition at line 299 of file GHOST_WindowCocoa.h.
Referenced by GHOST_WindowCocoa(), and setWindowCursorGrab().
|
protected |
Definition at line 303 of file GHOST_WindowCocoa.h.
Referenced by GetCocoaTabletData(), and GHOST_WindowCocoa().
|
protected |
The window containing the view
Definition at line 291 of file GHOST_WindowCocoa.h.
Referenced by clientToScreenIntern(), getClientBounds(), getCocoaWindow(), getOSWindow(), getScreen(), getState(), getTitle(), getValid(), getWindowBounds(), GHOST_WindowCocoa(), screenToClientIntern(), setClientHeight(), setClientSize(), setClientWidth(), setModifiedState(), setOrder(), setState(), setTitle(), setWindowCursorGrab(), setWindowCursorShape(), setWindowCursorVisibility(), setWindowCustomCursorShape(), and ~GHOST_WindowCocoa().