Blender  V2.59
GHOST_ISystem.h
Go to the documentation of this file.
00001 /*
00002  * $Id: GHOST_ISystem.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): none yet.
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00036 #ifndef _GHOST_ISYSTEM_H_
00037 #define _GHOST_ISYSTEM_H_
00038 
00039 #include "GHOST_Types.h"
00040 #include "GHOST_ITimerTask.h"
00041 #include "GHOST_IWindow.h"
00042 
00043 class GHOST_IEventConsumer;
00044 
00128 class GHOST_ISystem
00129 {
00130 public:
00135         static GHOST_TSuccess createSystem();
00136 
00141         static GHOST_TSuccess disposeSystem();
00142 
00147         static GHOST_ISystem* getSystem();
00148 
00149 protected:
00154         GHOST_ISystem() {}
00155 
00160         virtual ~GHOST_ISystem() {}
00161 
00162 public:
00163         /***************************************************************************************
00164          ** Time(r) functionality
00165          ***************************************************************************************/
00166 
00173         virtual GHOST_TUns64 getMilliSeconds() const = 0;
00174 
00185         virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData = 0) = 0;
00186 
00192         virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask* timerTask) = 0;
00193 
00194         /***************************************************************************************
00195          ** Display/window management functionality
00196          ***************************************************************************************/
00197 
00202         virtual GHOST_TUns8 getNumDisplays() const = 0;
00203 
00208         virtual void getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const = 0;
00209         
00226         virtual GHOST_IWindow* createWindow(
00227                 const STR_String& title,
00228                 GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
00229                 GHOST_TWindowState state, GHOST_TDrawingContextType type,
00230                 const bool stereoVisual = false,
00231                 const GHOST_TUns16 numOfAASamples = 0,
00232                 const GHOST_TEmbedderWindowID parentWindow = 0) = 0;
00233 
00239         virtual GHOST_TSuccess disposeWindow(GHOST_IWindow* window) = 0;
00240 
00246         virtual bool validWindow(GHOST_IWindow* window) = 0;
00247 
00255         virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
00256                 const bool stereoVisual) = 0;
00257 
00262         virtual GHOST_TSuccess endFullScreen(void) = 0;
00263 
00268         virtual bool getFullScreen(void) = 0;
00269 
00270         /***************************************************************************************
00271          ** Event management functionality
00272          ***************************************************************************************/
00273 
00279         virtual bool processEvents(bool waitForEvent) = 0;
00280         
00285         virtual bool dispatchEvents() = 0;
00286 
00292         virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer) = 0;
00293 
00299         virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer* consumer) = 0;
00300 
00301         /***************************************************************************************
00302          ** Cursor management functionality
00303          ***************************************************************************************/
00304 
00311         virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
00312 
00320         virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
00321 
00322         /***************************************************************************************
00323          ** Access to mouse button and keyboard states.
00324          ***************************************************************************************/
00325 
00332         virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool& isDown) const = 0;
00333 
00340         virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0;
00341 
00351         virtual int toggleConsole(int action) = 0;
00352         
00353         /***************************************************************************************
00354          ** Access to clipboard.
00355          ***************************************************************************************/
00356         
00362          virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
00363 
00367         virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
00368 
00369         
00370 protected:
00375         virtual GHOST_TSuccess init() = 0;
00376 
00381         virtual GHOST_TSuccess exit() = 0;
00382 
00384         static GHOST_ISystem* m_system;
00385 
00386 #ifdef WITH_CXX_GUARDEDALLOC
00387 public:
00388         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem"); }
00389         void operator delete( void *mem ) { MEM_freeN(mem); }
00390 #endif
00391 };
00392 
00393 #endif // _GHOST_ISYSTEM_H_
00394