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