Blender V2.61 - r43446
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

GHOST_SystemCarbon Class Reference

#include <GHOST_SystemCarbon.h>

Inheritance diagram for GHOST_SystemCarbon:
Inheritance graph
[legend]

List of all members.

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_IWindowcreateWindow (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_TUns8getClipboard (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

Detailed Description

OSX/Carbon Implementation of GHOST_System class.

See also:
GHOST_System.
Author:
Maarten Gribnau
Date:
May 21, 2001

Definition at line 55 of file GHOST_SystemCarbon.h.


Constructor & Destructor Documentation

GHOST_SystemCarbon::GHOST_SystemCarbon ( )
GHOST_SystemCarbon::~GHOST_SystemCarbon ( )

Destructor.

Definition at line 370 of file GHOST_SystemCarbon.cpp.


Member Function Documentation

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.

Parameters:
titleThe name of the window (displayed in the title bar of the window if the OS supports it).
leftThe coordinate of the left edge of the window.
topThe coordinate of the top edge of the window.
widthThe width the window.
heightThe height the window.
stateThe state of the window when opened.
typeThe type of drawing context installed in this window.
parentWindowParent (embedder) window
Returns:
The new window (or 0 if creation failed).

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.

Returns:
Indication of success.

Reimplemented from GHOST_System.

Definition at line 455 of file GHOST_SystemCarbon.cpp.

GHOST_TSuccess GHOST_SystemCarbon::exit ( ) [protected, virtual]

Closes the system down.

Returns:
A success value.

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).

Parameters:
buttonsThe state of the buttons.
Returns:
Indication of success.

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

Parameters:
selectionIndicate which buffer to return
Returns:
Returns the selected buffer

Implements GHOST_System.

Definition at line 1155 of file GHOST_SystemCarbon.cpp.

References err, and NULL.

GHOST_TSuccess GHOST_SystemCarbon::getCursorPosition ( GHOST_TInt32 x,
GHOST_TInt32 y 
) const [virtual]

Returns the current location of the cursor (location in screen coordinates)

Parameters:
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns:
Indication of success.

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.

Returns:
The dimension of the main display.

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.

Returns:
The number of milliseconds.

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.

Parameters:
keysThe state of all modifier keys (true == pressed).
Returns:
Indication of success.

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.

Returns:
The number of displays.

Implements GHOST_ISystem.

Definition at line 385 of file GHOST_SystemCarbon.cpp.

OSStatus GHOST_SystemCarbon::handleKeyEvent ( EventRef  event) [protected]
bool GHOST_SystemCarbon::handleMenuCommand ( GHOST_TInt32  menuResult) [protected]

Handles a Mac menu command.

Parameters:
menuResultA Mac menu/item identifier.
Returns:
Indication whether the event was handled.

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.

Parameters:
eventA Mac event.
Returns:
Indication whether the event was handled.

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]
OSStatus GHOST_SystemCarbon::handleTabletEvent ( EventRef  event) [protected]

Handles a tablet event.

Parameters:
eventA Mac event.
Returns:
Indication whether the event was handled.

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]
GHOST_TSuccess GHOST_SystemCarbon::init ( ) [protected, virtual]

Initializes the system. For now, it justs registers the window class (WNDCLASS).

Returns:
A success value.

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.

Parameters:
waitForEventFlag to wait for an event (or return immediately).
Returns:
Indication of the presence of events.

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

Parameters:
bufferThe buffer to be copied
selectionIndicates which buffer to copy too, only used on X11

Implements GHOST_System.

Definition at line 1194 of file GHOST_SystemCarbon.cpp.

References err, NULL, and strlen().

OSErr GHOST_SystemCarbon::sAEHandlerLaunch ( const AppleEvent *  event,
AppleEvent *  reply,
SInt32  refCon 
) [static, protected]

Apple Event Handlers

Definition at line 593 of file GHOST_SystemCarbon.cpp.

Referenced by init().

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).

Parameters:
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns:
Indication of success.

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]
int GHOST_SystemCarbon::toggleConsole ( int  action) [inline, virtual]
See also:
GHOST_ISystem

Implements GHOST_ISystem.

Definition at line 196 of file GHOST_SystemCarbon.h.


Member Data Documentation

EventHandlerRef GHOST_SystemCarbon::m_handler [protected]

Callback for Mac Timer tasks that expire.

Parameters:
tmTaskPointer to the timer task that expired. Event handler reference.

Definition at line 276 of file GHOST_SystemCarbon.h.

Referenced by init().

Ignores window size messages (when window is dragged).

Definition at line 285 of file GHOST_SystemCarbon.h.

Referenced by GHOST_SystemCarbon(), handleMouseDown(), and handleWindowEvent().

State of the modifiers.

Definition at line 282 of file GHOST_SystemCarbon.h.

Referenced by handleKeyEvent().

Start time at initialization.

Definition at line 279 of file GHOST_SystemCarbon.h.

Referenced by getMilliSeconds(), and GHOST_SystemCarbon().


The documentation for this class was generated from the following files: