Blender V2.61 - r43446
|
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): Maarten Gribnau 05/2001 00024 * Damien Plisson 09/2009 00025 * 00026 * ***** END GPL LICENSE BLOCK ***** 00027 */ 00028 00034 #ifndef _GHOST_SYSTEM_COCOA_H_ 00035 #define _GHOST_SYSTEM_COCOA_H_ 00036 00037 #ifndef __APPLE__ 00038 #error Apple OSX only! 00039 #endif // __APPLE__ 00040 00041 //#define __CARBONSOUND__ 00042 00043 00044 #include "GHOST_System.h" 00045 00046 class GHOST_EventCursor; 00047 class GHOST_EventKey; 00048 class GHOST_EventWindow; 00049 class GHOST_WindowCocoa; 00050 00051 00052 class GHOST_SystemCocoa : public GHOST_System { 00053 public: 00057 GHOST_SystemCocoa(); 00058 00062 ~GHOST_SystemCocoa(); 00063 00064 /*************************************************************************************** 00065 ** Time(r) functionality 00066 ***************************************************************************************/ 00067 00074 virtual GHOST_TUns64 getMilliSeconds() const; 00075 00076 /*************************************************************************************** 00077 ** Display/window management functionality 00078 ***************************************************************************************/ 00079 00084 virtual GHOST_TUns8 getNumDisplays() const; 00085 00090 virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const; 00091 00108 virtual GHOST_IWindow* createWindow( 00109 const STR_String& title, 00110 GHOST_TInt32 left, 00111 GHOST_TInt32 top, 00112 GHOST_TUns32 width, 00113 GHOST_TUns32 height, 00114 GHOST_TWindowState state, 00115 GHOST_TDrawingContextType type, 00116 const bool stereoVisual = false, 00117 const GHOST_TUns16 numOfAASamples = 0, 00118 const GHOST_TEmbedderWindowID parentWindow = 0 00119 ); 00120 00121 /*************************************************************************************** 00122 ** Event management functionality 00123 ***************************************************************************************/ 00124 00130 virtual bool processEvents(bool waitForEvent); 00131 00136 GHOST_TUns8 handleQuitRequest(); 00137 00142 bool handleOpenDocumentRequest(void *filepathStr); 00143 00153 GHOST_TSuccess handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, 00154 GHOST_WindowCocoa* window, int mouseX, int mouseY, void* data); 00155 00156 /*************************************************************************************** 00157 ** Cursor management functionality 00158 ***************************************************************************************/ 00159 00166 virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const; 00167 00174 virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y); 00175 00176 /*************************************************************************************** 00177 ** Access to mouse button and keyboard states. 00178 ***************************************************************************************/ 00179 00185 virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys& keys) const; 00186 00192 virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const; 00193 00199 virtual GHOST_TUns8* getClipboard(bool selection) const; 00200 00206 virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const; 00207 00214 GHOST_TSuccess handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa* window); 00215 00220 GHOST_TSuccess handleApplicationBecomeActiveEvent(); 00221 00225 void notifyExternalEventProcessed(); 00226 00230 int toggleConsole(int action) { return 0; } 00231 00232 00233 protected: 00239 virtual GHOST_TSuccess init(); 00240 00249 GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType); 00250 00256 GHOST_TSuccess handleMouseEvent(void *eventPtr); 00257 00263 GHOST_TSuccess handleKeyEvent(void *eventPtr); 00264 00271 GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y); 00272 00274 GHOST_TUns64 m_start_time; 00275 00277 bool m_outsideLoopEventProcessed; 00278 00280 bool m_needDelayedApplicationBecomeActiveEventProcessing; 00281 00283 GHOST_TUns32 m_pressedMouseButtons; 00284 00286 GHOST_TUns32 m_modifierMask; 00287 00289 bool m_ignoreWindowSizedMessages; 00290 00294 GHOST_TInt32 m_cursorDelta_x, m_cursorDelta_y; 00295 00297 bool m_hasMultiTouchTrackpad; 00298 00300 bool m_isGestureInProgress; 00301 }; 00302 00303 #endif // _GHOST_SYSTEM_COCOA_H_ 00304