|
Blender
V2.59
|
00001 /* 00002 * $Id: GHOST_SystemCocoa.h 38908 2011-08-02 04:28:05Z merwin $ 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): Maarten Gribnau 05/2001 00025 * Damien Plisson 09/2009 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 */ 00029 00035 #ifndef _GHOST_SYSTEM_COCOA_H_ 00036 #define _GHOST_SYSTEM_COCOA_H_ 00037 00038 #ifndef __APPLE__ 00039 #error Apple OSX only! 00040 #endif // __APPLE__ 00041 00042 //#define __CARBONSOUND__ 00043 00044 00045 #include "GHOST_System.h" 00046 00047 class GHOST_EventCursor; 00048 class GHOST_EventKey; 00049 class GHOST_EventWindow; 00050 class GHOST_WindowCocoa; 00051 00052 00053 class GHOST_SystemCocoa : public GHOST_System { 00054 public: 00058 GHOST_SystemCocoa(); 00059 00063 ~GHOST_SystemCocoa(); 00064 00065 /*************************************************************************************** 00066 ** Time(r) functionality 00067 ***************************************************************************************/ 00068 00075 virtual GHOST_TUns64 getMilliSeconds() const; 00076 00077 /*************************************************************************************** 00078 ** Display/window management functionality 00079 ***************************************************************************************/ 00080 00085 virtual GHOST_TUns8 getNumDisplays() const; 00086 00091 virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const; 00092 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 = false, 00118 const GHOST_TUns16 numOfAASamples = 0, 00119 const GHOST_TEmbedderWindowID parentWindow = 0 00120 ); 00121 00122 /*************************************************************************************** 00123 ** Event management functionality 00124 ***************************************************************************************/ 00125 00131 virtual bool processEvents(bool waitForEvent); 00132 00137 GHOST_TUns8 handleQuitRequest(); 00138 00143 bool handleOpenDocumentRequest(void *filepathStr); 00144 00154 GHOST_TSuccess handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, 00155 GHOST_WindowCocoa* window, int mouseX, int mouseY, void* data); 00156 00157 /*************************************************************************************** 00158 ** Cursor management functionality 00159 ***************************************************************************************/ 00160 00167 virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const; 00168 00175 virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y); 00176 00177 /*************************************************************************************** 00178 ** Access to mouse button and keyboard states. 00179 ***************************************************************************************/ 00180 00186 virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys& keys) const; 00187 00193 virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const; 00194 00200 virtual GHOST_TUns8* getClipboard(bool selection) const; 00201 00207 virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const; 00208 00215 GHOST_TSuccess handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa* window); 00216 00221 GHOST_TSuccess handleApplicationBecomeActiveEvent(); 00222 00226 void notifyExternalEventProcessed(); 00227 00231 int toggleConsole(int action) { return 0; } 00232 00233 00234 protected: 00240 virtual GHOST_TSuccess init(); 00241 00248 GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType); 00249 00255 GHOST_TSuccess handleMouseEvent(void *eventPtr); 00256 00262 GHOST_TSuccess handleKeyEvent(void *eventPtr); 00263 00270 GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y); 00271 00273 GHOST_TUns64 m_start_time; 00274 00276 bool m_outsideLoopEventProcessed; 00277 00279 bool m_needDelayedApplicationBecomeActiveEventProcessing; 00280 00282 GHOST_TUns32 m_pressedMouseButtons; 00283 00285 GHOST_TUns32 m_modifierMask; 00286 00288 bool m_ignoreWindowSizedMessages; 00289 00293 GHOST_TInt32 m_cursorDelta_x, m_cursorDelta_y; 00294 00296 bool m_hasMultiTouchTrackpad; 00297 00299 bool m_isGestureInProgress; 00300 }; 00301 00302 #endif // _GHOST_SYSTEM_COCOA_H_ 00303