Blender V2.61 - r43446
|
#include <GHOST_SystemCarbon.h>
Public Member Functions | |
GHOST_SystemCarbon () | |
~GHOST_SystemCarbon () | |
virtual GHOST_TUns64 | getMilliSeconds () const |
virtual GHOST_TUns8 | getNumDisplays () const |
virtual void | getMainDisplayDimensions (GHOST_TUns32 &width, GHOST_TUns32 &height) const |
virtual GHOST_IWindow * | 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, const GHOST_TUns16 numOfAASamples=0, const GHOST_TEmbedderWindowID parentWindow=0) |
virtual GHOST_TSuccess | beginFullScreen (const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual) |
virtual GHOST_TSuccess | endFullScreen (void) |
virtual bool | processEvents (bool waitForEvent) |
virtual GHOST_TSuccess | getCursorPosition (GHOST_TInt32 &x, GHOST_TInt32 &y) const |
virtual GHOST_TSuccess | setCursorPosition (GHOST_TInt32 x, GHOST_TInt32 y) |
virtual GHOST_TSuccess | getModifierKeys (GHOST_ModifierKeys &keys) const |
virtual GHOST_TSuccess | getButtons (GHOST_Buttons &buttons) const |
virtual GHOST_TUns8 * | getClipboard (bool selection) const |
virtual void | putClipboard (GHOST_TInt8 *buffer, bool selection) const |
int | toggleConsole (int action) |
Protected Member Functions | |
virtual GHOST_TSuccess | init () |
virtual GHOST_TSuccess | exit () |
OSStatus | handleTabletEvent (EventRef event) |
OSStatus | handleMouseEvent (EventRef event) |
OSStatus | handleKeyEvent (EventRef event) |
OSStatus | handleWindowEvent (EventRef event) |
bool | handleMouseDown (EventRef event) |
bool | handleMenuCommand (GHOST_TInt32 menuResult) |
Static Protected Member Functions | |
static OSStatus | sEventHandlerProc (EventHandlerCallRef handler, EventRef event, void *userData) |
static OSErr | sAEHandlerLaunch (const AppleEvent *event, AppleEvent *reply, SInt32 refCon) |
static OSErr | sAEHandlerOpenDocs (const AppleEvent *event, AppleEvent *reply, SInt32 refCon) |
static OSErr | sAEHandlerPrintDocs (const AppleEvent *event, AppleEvent *reply, SInt32 refCon) |
static OSErr | sAEHandlerQuit (const AppleEvent *event, AppleEvent *reply, SInt32 refCon) |
Protected Attributes | |
EventHandlerRef | m_handler |
GHOST_TUns64 | m_start_time |
UInt32 | m_modifierMask |
bool | m_ignoreWindowSizedMessages |
OSX/Carbon Implementation of GHOST_System class.
Definition at line 55 of file GHOST_SystemCarbon.h.
GHOST_SystemCarbon::GHOST_SystemCarbon | ( | ) |
Constructor.
Definition at line 357 of file GHOST_SystemCarbon.cpp.
References GHOST_ASSERT, GHOST_DisplayManager::initialize(), GHOST_System::m_displayManager, m_ignoreWindowSizedMessages, and m_start_time.
GHOST_SystemCarbon::~GHOST_SystemCarbon | ( | ) |
Destructor.
Definition at line 370 of file GHOST_SystemCarbon.cpp.
GHOST_TSuccess GHOST_SystemCarbon::beginFullScreen | ( | const GHOST_DisplaySetting & | setting, |
GHOST_IWindow ** | window, | ||
const bool | stereoVisual | ||
) | [virtual] |
Definition at line 438 of file GHOST_SystemCarbon.cpp.
References GHOST_kFailure, and GHOST_kSuccess.
GHOST_IWindow * GHOST_SystemCarbon::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, | ||
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. |
parentWindow | Parent (embedder) window |
Implements GHOST_ISystem.
Definition at line 401 of file GHOST_SystemCarbon.cpp.
References GHOST_WindowManager::addWindow(), getMilliSeconds(), GHOST_IWindow::getValid(), GHOST_ASSERT, GHOST_kEventWindowSize, GHOST_PRINT, GHOST_System::m_windowManager, GHOST_System::pushEvent(), and GHOST_WindowManager::setActiveWindow().
GHOST_TSuccess GHOST_SystemCarbon::endFullScreen | ( | void | ) | [virtual] |
Ends full screen mode.
Reimplemented from GHOST_System.
Definition at line 455 of file GHOST_SystemCarbon.cpp.
GHOST_TSuccess GHOST_SystemCarbon::exit | ( | ) | [protected, virtual] |
Closes the system down.
Reimplemented from GHOST_System.
Definition at line 687 of file GHOST_SystemCarbon.cpp.
GHOST_TSuccess GHOST_SystemCarbon::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 570 of file GHOST_SystemCarbon.cpp.
References GHOST_Buttons::clear(), GHOST_kButtonMaskLeft, GHOST_kSuccess, and GHOST_Buttons::set().
GHOST_TUns8 * GHOST_SystemCarbon::getClipboard | ( | bool | selection | ) | const [virtual] |
Returns Clipboard data
selection | Indicate which buffer to return |
Implements GHOST_System.
Definition at line 1155 of file GHOST_SystemCarbon.cpp.
GHOST_TSuccess GHOST_SystemCarbon::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 527 of file GHOST_SystemCarbon.cpp.
References GHOST_kSuccess.
void GHOST_SystemCarbon::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 392 of file GHOST_SystemCarbon.cpp.
GHOST_TUns64 GHOST_SystemCarbon::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 375 of file GHOST_SystemCarbon.cpp.
References m_start_time.
Referenced by createWindow(), handleKeyEvent(), handleMouseDown(), handleMouseEvent(), handleWindowEvent(), processEvents(), sAEHandlerQuit(), and sEventHandlerProc().
GHOST_TSuccess GHOST_SystemCarbon::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 557 of file GHOST_SystemCarbon.cpp.
References GHOST_kModifierKeyLeftAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyLeftShift, GHOST_kModifierKeyOS, GHOST_kSuccess, and GHOST_ModifierKeys::set().
GHOST_TUns8 GHOST_SystemCarbon::getNumDisplays | ( | ) | const [virtual] |
Returns the number of displays on this system.
Implements GHOST_ISystem.
Definition at line 385 of file GHOST_SystemCarbon.cpp.
OSStatus GHOST_SystemCarbon::handleKeyEvent | ( | EventRef | event | ) | [protected] |
Handles a key event.
event | A Mac event. |
Definition at line 894 of file GHOST_SystemCarbon.cpp.
References convertKey(), convertRomanToLatin(), err, GHOST_WindowManager::getActiveWindow(), getMilliSeconds(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kKeyLeftAlt, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyOS, m_modifierMask, GHOST_System::m_windowManager, NULL, and GHOST_System::pushEvent().
Referenced by sEventHandlerProc().
bool GHOST_SystemCarbon::handleMenuCommand | ( | GHOST_TInt32 | menuResult | ) | [protected] |
Handles a Mac menu command.
menuResult | A Mac menu/item identifier. |
Definition at line 1073 of file GHOST_SystemCarbon.cpp.
References err.
Referenced by handleMouseDown().
bool GHOST_SystemCarbon::handleMouseDown | ( | EventRef | event | ) | [protected] |
Handles all basic Mac application stuff for a mouse down event.
event | A Mac event. |
Definition at line 965 of file GHOST_SystemCarbon.cpp.
References convertButton(), getMilliSeconds(), GHOST_ASSERT, GHOST_kEventButtonDown, GHOST_kEventWindowClose, GHOST_kEventWindowMove, handleMenuCommand(), m_ignoreWindowSizedMessages, NULL, GHOST_System::pushEvent(), and GHOST_System::validWindow().
Referenced by handleMouseEvent().
OSStatus GHOST_SystemCarbon::handleMouseEvent | ( | EventRef | event | ) | [protected] |
Handles a mouse event.
event | A Mac event. |
Definition at line 821 of file GHOST_SystemCarbon.cpp.
References convertButton(), err, GHOST_WindowManager::getActiveWindow(), getMilliSeconds(), GHOST_ASSERT, GHOST_kEventButtonDown, GHOST_kEventButtonUp, GHOST_kEventCursorMove, handleMouseDown(), handleTabletEvent(), GHOST_System::m_windowManager, NULL, and GHOST_System::pushEvent().
Referenced by sEventHandlerProc().
OSStatus GHOST_SystemCarbon::handleTabletEvent | ( | EventRef | event | ) | [protected] |
Handles a tablet event.
event | A Mac event. |
Definition at line 747 of file GHOST_SystemCarbon.cpp.
References GHOST_TabletData::Active, err, GHOST_WindowManager::getActiveWindow(), GHOST_kTabletModeEraser, GHOST_kTabletModeNone, GHOST_kTabletModeStylus, GHOST_System::m_windowManager, NULL, GHOST_TabletData::Pressure, GHOST_TabletData::Xtilt, and GHOST_TabletData::Ytilt.
Referenced by handleMouseEvent().
OSStatus GHOST_SystemCarbon::handleWindowEvent | ( | EventRef | event | ) | [protected] |
Handles a window event.
event | A Mac event. |
Definition at line 693 of file GHOST_SystemCarbon.cpp.
References err, GHOST_Window::getCursorShape(), GHOST_Window::getCursorVisibility(), getMilliSeconds(), GHOST_kEventWindowActivate, GHOST_kEventWindowClose, GHOST_kEventWindowDeactivate, GHOST_kEventWindowSize, GHOST_kEventWindowUpdate, GHOST_WindowCarbon::loadCursor(), m_ignoreWindowSizedMessages, GHOST_System::m_windowManager, NULL, GHOST_System::pushEvent(), GHOST_WindowManager::setActiveWindow(), GHOST_WindowManager::setWindowInactive(), GHOST_WindowCarbon::updateDrawingContext(), and GHOST_System::validWindow().
Referenced by sEventHandlerProc().
GHOST_TSuccess GHOST_SystemCarbon::init | ( | ) | [protected, virtual] |
Initializes the system. For now, it justs registers the window class (WNDCLASS).
Reimplemented from GHOST_System.
Definition at line 659 of file GHOST_SystemCarbon.cpp.
References kEvents, m_handler, sAEHandlerLaunch(), sAEHandlerOpenDocs(), sAEHandlerPrintDocs(), sAEHandlerQuit(), and sEventHandlerProc().
bool GHOST_SystemCarbon::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). |
Implements GHOST_ISystem.
Definition at line 464 of file GHOST_SystemCarbon.cpp.
References GHOST_TimerManager::fireTimers(), GHOST_System::getFullScreen(), GHOST_WindowManager::getFullScreenWindow(), getMilliSeconds(), GHOST_System::getTimerManager(), GHOST_kEventWindowUpdate, GHOST_kFireTimeNever, i, GHOST_System::m_windowManager, next, GHOST_TimerManager::nextFireTime(), NULL, and GHOST_System::pushEvent().
void GHOST_SystemCarbon::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 1194 of file GHOST_SystemCarbon.cpp.
OSErr GHOST_SystemCarbon::sAEHandlerLaunch | ( | const AppleEvent * | event, |
AppleEvent * | reply, | ||
SInt32 | refCon | ||
) | [static, protected] |
OSErr GHOST_SystemCarbon::sAEHandlerOpenDocs | ( | const AppleEvent * | event, |
AppleEvent * | reply, | ||
SInt32 | refCon | ||
) | [static, protected] |
Definition at line 600 of file GHOST_SystemCarbon.cpp.
References err, g_firstFileBuf, g_hasFirstFile, and i.
Referenced by init().
OSErr GHOST_SystemCarbon::sAEHandlerPrintDocs | ( | const AppleEvent * | event, |
AppleEvent * | reply, | ||
SInt32 | refCon | ||
) | [static, protected] |
Definition at line 642 of file GHOST_SystemCarbon.cpp.
Referenced by init().
OSErr GHOST_SystemCarbon::sAEHandlerQuit | ( | const AppleEvent * | event, |
AppleEvent * | reply, | ||
SInt32 | refCon | ||
) | [static, protected] |
Definition at line 649 of file GHOST_SystemCarbon.cpp.
References getMilliSeconds(), GHOST_kEventQuit, NULL, and GHOST_System::pushEvent().
Referenced by init().
GHOST_TSuccess GHOST_SystemCarbon::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 539 of file GHOST_SystemCarbon.cpp.
References GHOST_kSuccess.
OSStatus GHOST_SystemCarbon::sEventHandlerProc | ( | EventHandlerCallRef | handler, |
EventRef | event, | ||
void * | userData | ||
) | [static, protected] |
Callback for Carbon when it has events.
Definition at line 1100 of file GHOST_SystemCarbon.cpp.
References data, err, GHOST_WindowManager::getActiveWindow(), getMilliSeconds(), GHOST_kEventNDOFButton, GHOST_kEventNDOFMotion, handleKeyEvent(), handleMouseEvent(), handleWindowEvent(), kEventClassBlender, GHOST_System::m_eventManager, GHOST_System::m_windowManager, and GHOST_EventManager::pushEvent().
Referenced by init().
int GHOST_SystemCarbon::toggleConsole | ( | int | action | ) | [inline, virtual] |
Implements GHOST_ISystem.
Definition at line 196 of file GHOST_SystemCarbon.h.
EventHandlerRef GHOST_SystemCarbon::m_handler [protected] |
Callback for Mac Timer tasks that expire.
tmTask | Pointer to the timer task that expired. Event handler reference. |
Definition at line 276 of file GHOST_SystemCarbon.h.
Referenced by init().
bool GHOST_SystemCarbon::m_ignoreWindowSizedMessages [protected] |
Ignores window size messages (when window is dragged).
Definition at line 285 of file GHOST_SystemCarbon.h.
Referenced by GHOST_SystemCarbon(), handleMouseDown(), and handleWindowEvent().
UInt32 GHOST_SystemCarbon::m_modifierMask [protected] |
State of the modifiers.
Definition at line 282 of file GHOST_SystemCarbon.h.
Referenced by handleKeyEvent().
GHOST_TUns64 GHOST_SystemCarbon::m_start_time [protected] |
Start time at initialization.
Definition at line 279 of file GHOST_SystemCarbon.h.
Referenced by getMilliSeconds(), and GHOST_SystemCarbon().