Blender V2.61 - r43446
|
#include <GHOST_SystemCocoa.h>
Definition at line 52 of file GHOST_SystemCocoa.h.
GHOST_SystemCocoa::GHOST_SystemCocoa | ( | ) |
Constructor.
Definition at line 545 of file GHOST_SystemCocoa.mm.
References addon::engine::free(), GHOST_ASSERT, GHOST_DisplayManager::initialize(), len(), m_cursorDelta_x, m_cursorDelta_y, GHOST_System::m_displayManager, m_hasMultiTouchTrackpad, m_ignoreWindowSizedMessages, m_isGestureInProgress, m_modifierMask, m_needDelayedApplicationBecomeActiveEventProcessing, m_outsideLoopEventProcessed, m_pressedMouseButtons, m_start_time, NULL, and strlen().
GHOST_SystemCocoa::~GHOST_SystemCocoa | ( | ) |
Destructor.
Definition at line 590 of file GHOST_SystemCocoa.mm.
GHOST_IWindow * GHOST_SystemCocoa::createWindow | ( | const STR_String & | title, |
GHOST_TInt32 | left, | ||
GHOST_TInt32 | top, | ||
GHOST_TUns32 | width, | ||
GHOST_TUns32 | height, | ||
GHOST_TWindowState | state, | ||
GHOST_TDrawingContextType | type, | ||
const bool | stereoVisual = false , |
||
const GHOST_TUns16 | numOfAASamples = 0 , |
||
const GHOST_TEmbedderWindowID | parentWindow = 0 |
||
) | [virtual] |
Create a new window. The new window is added to the list of windows managed. Never explicitly delete the window, use disposeWindow() instead.
title | The name of the window (displayed in the title bar of the window if the OS supports it). |
left | The coordinate of the left edge of the window. |
top | The coordinate of the top edge of the window. |
width | The width the window. |
height | The height the window. |
state | The state of the window when opened. |
type | The type of drawing context installed in this window. |
stereoVisual | Stereo visual for quad buffered stereo. |
numOfAASamples | Number of samples used for AA (zero if no AA) |
parentWindow | Parent (embedder) window |
Implements GHOST_ISystem.
Definition at line 729 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::addWindow(), getMilliSeconds(), GHOST_IWindow::getValid(), GHOST_ASSERT, GHOST_kEventWindowActivate, GHOST_kEventWindowSize, GHOST_PRINT, GHOST_System::m_windowManager, GHOST_System::pushEvent(), and GHOST_WindowManager::setActiveWindow().
GHOST_TSuccess GHOST_SystemCocoa::getButtons | ( | GHOST_Buttons & | buttons | ) | const [virtual] |
Returns the state of the mouse buttons (ouside the message queue).
buttons | The state of the buttons. |
Implements GHOST_System.
Definition at line 850 of file GHOST_SystemCocoa.mm.
References GHOST_Buttons::clear(), GHOST_kButtonMaskButton4, GHOST_kButtonMaskButton5, GHOST_kButtonMaskLeft, GHOST_kButtonMaskMiddle, GHOST_kButtonMaskRight, GHOST_kSuccess, m_pressedMouseButtons, and GHOST_Buttons::set().
GHOST_TUns8 * GHOST_SystemCocoa::getClipboard | ( | bool | selection | ) | const [virtual] |
Returns Clipboard data
selection | Indicate which buffer to return |
Implements GHOST_System.
Definition at line 1737 of file GHOST_SystemCocoa.mm.
References NULL.
GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition | ( | GHOST_TInt32 & | x, |
GHOST_TInt32 & | y | ||
) | const [virtual] |
Returns the current location of the cursor (location in screen coordinates)
x | The x-coordinate of the cursor. |
y | The y-coordinate of the cursor. |
Implements GHOST_ISystem.
Definition at line 785 of file GHOST_SystemCocoa.mm.
References GHOST_kSuccess.
void GHOST_SystemCocoa::getMainDisplayDimensions | ( | GHOST_TUns32 & | width, |
GHOST_TUns32 & | height | ||
) | const [virtual] |
Returns the dimensions of the main display on this system.
Implements GHOST_ISystem.
Definition at line 712 of file GHOST_SystemCocoa.mm.
GHOST_TUns64 GHOST_SystemCocoa::getMilliSeconds | ( | ) | const [virtual] |
Returns the system time. Returns the number of milliseconds since the start of the system process. Based on ANSI clock() routine.
Reimplemented from GHOST_System.
Definition at line 686 of file GHOST_SystemCocoa.mm.
References m_start_time, and NULL.
Referenced by createWindow(), handleApplicationBecomeActiveEvent(), handleDraggingEvent(), handleOpenDocumentRequest(), handleQuitRequest(), handleWindowEvent(), and setCursorPosition().
GHOST_TSuccess GHOST_SystemCocoa::getModifierKeys | ( | GHOST_ModifierKeys & | keys | ) | const [virtual] |
Returns the state of all modifier keys.
keys | The state of all modifier keys (true == pressed). |
Implements GHOST_System.
Definition at line 840 of file GHOST_SystemCocoa.mm.
References GHOST_kModifierKeyLeftAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyLeftShift, GHOST_kModifierKeyOS, GHOST_kSuccess, m_modifierMask, and GHOST_ModifierKeys::set().
GHOST_TUns8 GHOST_SystemCocoa::getNumDisplays | ( | ) | const [virtual] |
Returns the number of displays on this system.
Implements GHOST_ISystem.
Definition at line 699 of file GHOST_SystemCocoa.mm.
GHOST_TSuccess GHOST_SystemCocoa::handleApplicationBecomeActiveEvent | ( | ) |
Handles the Cocoa event telling the application has become active (again)
Definition at line 983 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getActiveWindow(), getMilliSeconds(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kFailure, GHOST_kKeyLeftAlt, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyOS, GHOST_kSuccess, m_modifierMask, m_needDelayedApplicationBecomeActiveEventProcessing, m_outsideLoopEventProcessed, GHOST_System::m_windowManager, and GHOST_System::pushEvent().
Referenced by CocoaAppDelegate::applicationWillBecomeActive:, handleQuitRequest(), and processEvents().
GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent | ( | GHOST_TEventType | eventType, |
GHOST_TDragnDropTypes | draggedObjectType, | ||
GHOST_WindowCocoa * | window, | ||
int | mouseX, | ||
int | mouseY, | ||
void * | data | ||
) |
Handles a drag'n'drop destination event. Called by GHOST_WindowCocoa window subclass
eventType | The type of drag'n'drop event |
draggedObjectType | The type object concerned (currently array of file names, string, TIFF image) |
mouseX | x mouse coordinate (in cocoa base window coordinates) |
mouseY | y mouse coordinate |
window | The window on which the event occurred |
Definition at line 1069 of file GHOST_SystemCocoa.mm.
References GHOST_TStringArray::count, getMilliSeconds(), GHOST_kDragnDropTypeBitmap, GHOST_kDragnDropTypeFilenames, GHOST_kDragnDropTypeString, GHOST_kEventDraggingDropDone, GHOST_kEventDraggingEntered, GHOST_kEventDraggingExited, GHOST_kEventDraggingUpdated, GHOST_kFailure, GHOST_kSuccess, i, IB_rect, IMB_allocImBuf(), m_outsideLoopEventProcessed, NULL, GHOST_System::pushEvent(), ImBuf::rect, GHOST_TStringArray::strings, and GHOST_System::validWindow().
GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent | ( | void * | eventPtr | ) | [protected] |
Handles a key event.
eventPtr | An NSEvent pointer (casted to void* to enable compilation in standard C++) |
Definition at line 1642 of file GHOST_SystemCocoa.mm.
References convertKey(), GHOST_WindowManager::getWindowAssociatedWithOSWindow(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kFailure, GHOST_kKeyLeftAlt, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyOS, GHOST_kKeyQ, GHOST_kSuccess, length(), m_modifierMask, GHOST_System::m_windowManager, and GHOST_System::pushEvent().
Referenced by processEvents().
GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent | ( | void * | eventPtr | ) | [protected] |
Handles a mouse event.
eventPtr | An NSEvent pointer (casted to void* to enable compilation in standard C++) |
Definition at line 1425 of file GHOST_SystemCocoa.mm.
References bounds(), convertButton(), fabs(), GHOST_WindowManager::getWindowAssociatedWithOSWindow(), GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventCursorMove, GHOST_kFailure, GHOST_kGrabHide, GHOST_kGrabWrap, GHOST_kSuccess, GHOST_kTrackpadEventMagnify, GHOST_kTrackpadEventRotate, GHOST_kTrackpadEventScroll, handleTabletEvent(), GHOST_Rect::m_b, m_cursorDelta_x, m_cursorDelta_y, m_hasMultiTouchTrackpad, m_isGestureInProgress, GHOST_Rect::m_l, GHOST_Rect::m_r, GHOST_Rect::m_t, GHOST_System::m_windowManager, NSEventTypeBeginGesture, NSEventTypeEndGesture, NSEventTypeMagnify, NSEventTypeRotate, GHOST_System::pushEvent(), setMouseCursorPosition(), and GHOST_Rect::wrapPoint().
Referenced by processEvents().
bool GHOST_SystemCocoa::handleOpenDocumentRequest | ( | void * | filepathStr | ) |
Handle Cocoa openFile event Display confirmation request panel if changes performed since last save
Definition at line 1318 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getActiveWindow(), GHOST_WindowManager::getAnyModifiedState(), GHOST_Window::getCursorGrabMode(), getMilliSeconds(), GHOST_kEventOpenMainFile, GHOST_kExitCancel, GHOST_kFailure, GHOST_kGrabDisable, GHOST_kGrabNormal, GHOST_System::m_windowManager, NO, NULL, GHOST_System::pushEvent(), and YES.
Referenced by CocoaAppDelegate::application:openFile:.
GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest | ( | ) |
Handle User request to quit, from Menu bar Quit, and Cmd+Q Display alert panel if changes performed since last save
Definition at line 1278 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getActiveWindow(), GHOST_WindowManager::getAnyModifiedState(), GHOST_Window::getCursorGrabMode(), getMilliSeconds(), GHOST_kEventQuit, GHOST_kExitCancel, GHOST_kExitNow, GHOST_kGrabDisable, GHOST_kGrabNormal, handleApplicationBecomeActiveEvent(), m_outsideLoopEventProcessed, GHOST_System::m_windowManager, NULL, and GHOST_System::pushEvent().
Referenced by CocoaAppDelegate::applicationShouldTerminate:.
GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent | ( | void * | eventPtr, |
short | eventType | ||
) | [protected] |
Handles a tablet event.
eventPtr | An NSEvent pointer (casted to void* to enable compilation in standard C++) |
eventType | The type of the event. It needs to be passed separately as it can be either directly in the event type, or as a subtype if combined with a mouse button event. |
Definition at line 1370 of file GHOST_SystemCocoa.mm.
References GHOST_TabletData::Active, FALSE, GHOST_WindowManager::getWindowAssociatedWithOSWindow(), GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, GHOST_kTabletModeEraser, GHOST_kTabletModeNone, GHOST_kTabletModeStylus, GHOST_System::m_windowManager, GHOST_TabletData::Pressure, GHOST_TabletData::Xtilt, and GHOST_TabletData::Ytilt.
Referenced by handleMouseEvent(), and processEvents().
GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent | ( | GHOST_TEventType | eventType, |
GHOST_WindowCocoa * | window | ||
) |
Handles a window event. Called by GHOST_WindowCocoa window delegate
eventType | The type of window event |
window | The window on which the event occurred |
Definition at line 1023 of file GHOST_SystemCocoa.mm.
References convertButton(), getMilliSeconds(), GHOST_kEventButtonUp, GHOST_kEventWindowActivate, GHOST_kEventWindowClose, GHOST_kEventWindowDeactivate, GHOST_kEventWindowMove, GHOST_kEventWindowSize, GHOST_kEventWindowUpdate, GHOST_kFailure, GHOST_kSuccess, m_ignoreWindowSizedMessages, m_outsideLoopEventProcessed, GHOST_System::m_windowManager, GHOST_System::pushEvent(), GHOST_WindowManager::setActiveWindow(), GHOST_WindowManager::setWindowInactive(), and GHOST_System::validWindow().
Referenced by CocoaWindowDelegate::windowDidBecomeKey:, CocoaWindowDelegate::windowDidExpose:, CocoaWindowDelegate::windowDidMove:, CocoaWindowDelegate::windowDidResignKey:, CocoaWindowDelegate::windowDidResize:, CocoaWindowDelegate::windowWillClose:, and CocoaWindowDelegate::windowWillMove:.
GHOST_TSuccess GHOST_SystemCocoa::init | ( | ) | [protected, virtual] |
Initializes the system. For now, it justs registers the window class (WNDCLASS).
Reimplemented from GHOST_System.
Definition at line 595 of file GHOST_SystemCocoa.mm.
References CocoaAppDelegate::setSystemCocoa:.
void GHOST_SystemCocoa::notifyExternalEventProcessed | ( | ) |
External objects should call this when they send an event outside processEvents.
Definition at line 1017 of file GHOST_SystemCocoa.mm.
References m_outsideLoopEventProcessed.
bool GHOST_SystemCocoa::processEvents | ( | bool | waitForEvent | ) | [virtual] |
Gets events from the system and stores them in the queue.
waitForEvent | Flag to wait for an event (or return immediately). |
The event queue polling function
Implements GHOST_ISystem.
Definition at line 868 of file GHOST_SystemCocoa.mm.
References handleApplicationBecomeActiveEvent(), handleKeyEvent(), handleMouseEvent(), handleTabletEvent(), m_ignoreWindowSizedMessages, m_needDelayedApplicationBecomeActiveEventProcessing, m_outsideLoopEventProcessed, NSEventTypeBeginGesture, NSEventTypeEndGesture, NSEventTypeMagnify, and NSEventTypeRotate.
void GHOST_SystemCocoa::putClipboard | ( | GHOST_TInt8 * | buffer, |
bool | selection | ||
) | const [virtual] |
Puts buffer to system clipboard
buffer | The buffer to be copied |
selection | Indicates which buffer to copy too, only used on X11 |
Implements GHOST_System.
Definition at line 1791 of file GHOST_SystemCocoa.mm.
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition | ( | GHOST_TInt32 | x, |
GHOST_TInt32 | y | ||
) | [virtual] |
Updates the location of the cursor (location in screen coordinates).
x | The x-coordinate of the cursor. |
y | The y-coordinate of the cursor. |
Implements GHOST_ISystem.
Definition at line 798 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getActiveWindow(), getMilliSeconds(), GHOST_kEventCursorMove, GHOST_kFailure, GHOST_kSuccess, m_outsideLoopEventProcessed, GHOST_System::m_windowManager, GHOST_System::pushEvent(), and setMouseCursorPosition().
GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition | ( | GHOST_TInt32 | x, |
GHOST_TInt32 | y | ||
) | [protected] |
Performs the actual cursor position update (location in screen coordinates).
x | The x-coordinate of the cursor. |
y | The y-coordinate of the cursor. |
Definition at line 816 of file GHOST_SystemCocoa.mm.
References GHOST_WindowManager::getActiveWindow(), GHOST_kFailure, GHOST_kSuccess, and GHOST_System::m_windowManager.
Referenced by handleMouseEvent(), and setCursorPosition().
int GHOST_SystemCocoa::toggleConsole | ( | int | action | ) | [inline, virtual] |
Implements GHOST_ISystem.
Definition at line 230 of file GHOST_SystemCocoa.h.
GHOST_TInt32 GHOST_SystemCocoa::m_cursorDelta_x [protected] |
Stores the mouse cursor delta due to setting a new cursor position Needed because cocoa event delta cursor move takes setCursorPosition changes too.
Definition at line 294 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), and handleMouseEvent().
GHOST_TInt32 GHOST_SystemCocoa::m_cursorDelta_y [protected] |
Definition at line 294 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), and handleMouseEvent().
bool GHOST_SystemCocoa::m_hasMultiTouchTrackpad [protected] |
Multitouch trackpad availability
Definition at line 297 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), and handleMouseEvent().
bool GHOST_SystemCocoa::m_ignoreWindowSizedMessages [protected] |
Ignores window size messages (when window is dragged).
Definition at line 289 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), handleWindowEvent(), and processEvents().
bool GHOST_SystemCocoa::m_isGestureInProgress [protected] |
Multitouch gesture in progress, useful to distinguish trackpad from mouse scroll events
Definition at line 300 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), and handleMouseEvent().
GHOST_TUns32 GHOST_SystemCocoa::m_modifierMask [protected] |
State of the modifiers.
Definition at line 286 of file GHOST_SystemCocoa.h.
Referenced by getModifierKeys(), GHOST_SystemCocoa(), handleApplicationBecomeActiveEvent(), and handleKeyEvent().
Raised window is not yet known by the window manager, so delay application become active event handling
Definition at line 280 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), handleApplicationBecomeActiveEvent(), and processEvents().
bool GHOST_SystemCocoa::m_outsideLoopEventProcessed [protected] |
Event has been processed directly by Cocoa (or NDOF manager) and has sent a ghost event to be dispatched
Definition at line 277 of file GHOST_SystemCocoa.h.
Referenced by GHOST_SystemCocoa(), handleApplicationBecomeActiveEvent(), handleDraggingEvent(), handleQuitRequest(), handleWindowEvent(), notifyExternalEventProcessed(), processEvents(), and setCursorPosition().
GHOST_TUns32 GHOST_SystemCocoa::m_pressedMouseButtons [protected] |
Mouse buttons state
Definition at line 283 of file GHOST_SystemCocoa.h.
Referenced by getButtons(), and GHOST_SystemCocoa().
GHOST_TUns64 GHOST_SystemCocoa::m_start_time [protected] |
Start time at initialization.
Definition at line 274 of file GHOST_SystemCocoa.h.
Referenced by getMilliSeconds(), and GHOST_SystemCocoa().