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): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00035 #ifndef _GHOST_ISYSTEM_H_ 00036 #define _GHOST_ISYSTEM_H_ 00037 00038 #include "GHOST_Types.h" 00039 #include "GHOST_ITimerTask.h" 00040 #include "GHOST_IWindow.h" 00041 00042 class GHOST_IEventConsumer; 00043 00127 class GHOST_ISystem 00128 { 00129 public: 00134 static GHOST_TSuccess createSystem(); 00135 00140 static GHOST_TSuccess disposeSystem(); 00141 00146 static GHOST_ISystem* getSystem(); 00147 00148 protected: 00153 GHOST_ISystem() {} 00154 00159 virtual ~GHOST_ISystem() {} 00160 00161 public: 00162 /*************************************************************************************** 00163 ** Time(r) functionality 00164 ***************************************************************************************/ 00165 00172 virtual GHOST_TUns64 getMilliSeconds() const = 0; 00173 00184 virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay, 00185 GHOST_TUns64 interval, 00186 GHOST_TimerProcPtr timerProc, 00187 GHOST_TUserDataPtr userData = 0) = 0; 00188 00194 virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask* timerTask) = 0; 00195 00196 /*************************************************************************************** 00197 ** Display/window management functionality 00198 ***************************************************************************************/ 00199 00204 virtual GHOST_TUns8 getNumDisplays() const = 0; 00205 00210 virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const = 0; 00211 00228 virtual GHOST_IWindow* createWindow( 00229 const STR_String& title, 00230 GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, 00231 GHOST_TWindowState state, GHOST_TDrawingContextType type, 00232 const bool stereoVisual = false, 00233 const GHOST_TUns16 numOfAASamples = 0, 00234 const GHOST_TEmbedderWindowID parentWindow = 0) = 0; 00235 00241 virtual GHOST_TSuccess disposeWindow(GHOST_IWindow* window) = 0; 00242 00248 virtual bool validWindow(GHOST_IWindow* window) = 0; 00249 00257 virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, 00258 const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0) = 0; 00259 00264 virtual GHOST_TSuccess endFullScreen(void) = 0; 00265 00270 virtual bool getFullScreen(void) = 0; 00271 00272 /*************************************************************************************** 00273 ** Event management functionality 00274 ***************************************************************************************/ 00275 00281 virtual bool processEvents(bool waitForEvent) = 0; 00282 00287 virtual bool dispatchEvents() = 0; 00288 00294 virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer) = 0; 00295 00301 virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer* consumer) = 0; 00302 00303 /*************************************************************************************** 00304 ** Cursor management functionality 00305 ***************************************************************************************/ 00306 00313 virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0; 00314 00322 virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0; 00323 00324 /*************************************************************************************** 00325 ** Access to mouse button and keyboard states. 00326 ***************************************************************************************/ 00327 00334 virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool& isDown) const = 0; 00335 00342 virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0; 00343 00353 virtual int toggleConsole(int action) = 0; 00354 00355 /*************************************************************************************** 00356 ** Access to clipboard. 00357 ***************************************************************************************/ 00358 00364 virtual GHOST_TUns8* getClipboard(bool selection) const = 0; 00365 00369 virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0; 00370 00371 00372 protected: 00377 virtual GHOST_TSuccess init() = 0; 00378 00383 virtual GHOST_TSuccess exit() = 0; 00384 00386 static GHOST_ISystem* m_system; 00387 00388 #ifdef WITH_CXX_GUARDEDALLOC 00389 public: 00390 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem"); } 00391 void operator delete( void *mem ) { MEM_freeN(mem); } 00392 #endif 00393 }; 00394 00395 #endif // _GHOST_ISYSTEM_H_ 00396