Blender V2.61 - r43446

GHOST_SystemCarbon.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #ifndef _GHOST_SYSTEM_CARBON_H_
00034 #define _GHOST_SYSTEM_CARBON_H_
00035 
00036 #ifndef __APPLE__
00037 #error Apple OSX only!
00038 #endif // __APPLE__
00039 
00040 #define __CARBONSOUND__
00041 #include <Carbon/Carbon.h>
00042 
00043 #include "GHOST_System.h"
00044 
00045 class GHOST_EventCursor;
00046 class GHOST_EventKey;
00047 class GHOST_EventWindow;
00048 
00055 class GHOST_SystemCarbon : public GHOST_System {
00056 public:
00060     GHOST_SystemCarbon();
00061 
00065     ~GHOST_SystemCarbon();
00066 
00067     /***************************************************************************************
00068      ** Time(r) functionality
00069      ***************************************************************************************/
00070 
00077     virtual GHOST_TUns64 getMilliSeconds() const;
00078 
00079     /***************************************************************************************
00080      ** Display/window management functionality
00081      ***************************************************************************************/
00082 
00087     virtual GHOST_TUns8 getNumDisplays() const;
00088 
00093     virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const;
00094     
00109     virtual GHOST_IWindow* createWindow(
00110         const STR_String& title,
00111         GHOST_TInt32 left,
00112         GHOST_TInt32 top,
00113         GHOST_TUns32 width,
00114         GHOST_TUns32 height,
00115         GHOST_TWindowState state,
00116         GHOST_TDrawingContextType type,
00117         const bool stereoVisual,
00118         const GHOST_TUns16 numOfAASamples = 0,
00119         const GHOST_TEmbedderWindowID parentWindow = 0 
00120     );
00121     
00122     virtual GHOST_TSuccess beginFullScreen(
00123         const GHOST_DisplaySetting& setting, 
00124         GHOST_IWindow** window,
00125         const bool stereoVisual
00126     );
00127     
00128     virtual GHOST_TSuccess endFullScreen( void );
00129     
00130     /***************************************************************************************
00131      ** Event management functionality
00132      ***************************************************************************************/
00133 
00139     virtual bool processEvents(bool waitForEvent);
00140     
00141     /***************************************************************************************
00142      ** Cursor management functionality
00143      ***************************************************************************************/
00144 
00151     virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const;
00152 
00159     virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
00160 
00161     /***************************************************************************************
00162      ** Access to mouse button and keyboard states.
00163      ***************************************************************************************/
00164 
00170     virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys& keys) const;
00171 
00177     virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const;
00178 
00184     virtual GHOST_TUns8* getClipboard(bool selection) const;
00185     
00191     virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
00192 
00196     int toggleConsole(int action) { return 0; }
00197 
00198 protected:
00204     virtual GHOST_TSuccess init();
00205 
00210     virtual GHOST_TSuccess exit();
00211 
00212     
00218     OSStatus handleTabletEvent(EventRef event);
00224     OSStatus handleMouseEvent(EventRef event);
00225 
00231     OSStatus handleKeyEvent(EventRef event);
00232 
00238     OSStatus handleWindowEvent(EventRef event);
00239 
00245     bool handleMouseDown(EventRef event);
00246 
00252     bool handleMenuCommand(GHOST_TInt32 menuResult);
00253 
00254     /* callback for blender generated events */
00255     //  static OSStatus blendEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData);
00256 
00257 
00261     static OSStatus sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData);
00262     
00264     static OSErr sAEHandlerLaunch(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
00265     static OSErr sAEHandlerOpenDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
00266     static OSErr sAEHandlerPrintDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
00267     static OSErr sAEHandlerQuit(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
00268 
00273     //static void s_timerCallback(TMTaskPtr tmTask);
00274 
00276     EventHandlerRef m_handler;
00277     
00279     GHOST_TUns64 m_start_time;
00280     
00282     UInt32 m_modifierMask;
00283 
00285     bool m_ignoreWindowSizedMessages;
00286 };
00287 
00288 #endif // _GHOST_SYSTEM_CARBON_H_
00289