Blender  V2.59
GHOST_System.h
Go to the documentation of this file.
00001 /*
00002  * $Id: GHOST_System.h 38926 2011-08-02 10:20:47Z 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_H_
00035 #define _GHOST_SYSTEM_H_
00036 
00037 #include "GHOST_ISystem.h"
00038 
00039 #include "GHOST_Debug.h"
00040 #include "GHOST_Buttons.h"
00041 #include "GHOST_ModifierKeys.h"
00042 #include "GHOST_EventManager.h"
00043 #ifdef GHOST_DEBUG
00044 #include "GHOST_EventPrinter.h"
00045 #endif // GHOST_DEBUG
00046 
00047 class GHOST_DisplayManager;
00048 class GHOST_Event;
00049 class GHOST_TimerManager;
00050 class GHOST_Window;
00051 class GHOST_WindowManager;
00052 class GHOST_NDOFManager;
00053 
00063 class GHOST_System : public GHOST_ISystem
00064 {
00065 protected:
00070         GHOST_System();
00071 
00076         virtual ~GHOST_System();
00077 
00078 public:
00079         /***************************************************************************************
00080          ** Time(r) functionality
00081          ***************************************************************************************/
00082 
00089         virtual GHOST_TUns64 getMilliSeconds() const;
00090 
00101         virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData = 0);
00102 
00108         virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask* timerTask);
00109 
00110         /***************************************************************************************
00111          ** Display/window management functionality
00112          ***************************************************************************************/
00113         
00127         virtual GHOST_TSuccess disposeWindow(GHOST_IWindow* window);
00128 
00134         virtual bool validWindow(GHOST_IWindow* window);
00135 
00144         virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
00145                 const bool stereoVisual);
00146 
00151         virtual GHOST_TSuccess endFullScreen(void);
00152 
00157         virtual bool getFullScreen(void);
00158 
00159 
00160         /***************************************************************************************
00161          ** Event management functionality
00162          ***************************************************************************************/
00163 
00177         virtual bool dispatchEvents();
00178 
00184         virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer);
00185 
00191         virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer* consumer);
00192 
00193         /***************************************************************************************
00194          ** Cursor management functionality
00195          ***************************************************************************************/
00196 
00202         /***************************************************************************************
00203          ** Access to mouse button and keyboard states.
00204          ***************************************************************************************/
00205 
00212         virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool& isDown) const;
00213 
00220         virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const;
00221         
00222         /***************************************************************************************
00223          ** Other (internal) functionality.
00224          ***************************************************************************************/
00225 
00232         virtual GHOST_TSuccess pushEvent(GHOST_IEvent* event);
00233 
00238         inline virtual GHOST_TimerManager* getTimerManager() const;
00239 
00244         virtual inline GHOST_EventManager* getEventManager() const;
00245 
00250         virtual inline GHOST_WindowManager* getWindowManager() const;
00251 
00252 #ifdef WITH_INPUT_NDOF
00253 
00257         virtual inline GHOST_NDOFManager* getNDOFManager() const;
00258 #endif
00259 
00265         virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys& keys) const = 0;
00266 
00272         virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const = 0;
00273 
00280          virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
00281           
00287           virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
00288 
00289         
00290 protected:
00295         virtual GHOST_TSuccess init();
00296 
00301         virtual GHOST_TSuccess exit();
00302 
00308         virtual GHOST_TSuccess createFullScreenWindow(GHOST_Window** window,
00309                 const bool stereoVisual);
00310 
00312         GHOST_DisplayManager* m_displayManager;
00313 
00315         GHOST_TimerManager* m_timerManager;
00316 
00318         GHOST_WindowManager* m_windowManager;
00319 
00321         GHOST_EventManager* m_eventManager;
00322 
00323 #ifdef WITH_INPUT_NDOF
00324 
00325         GHOST_NDOFManager* m_ndofManager;
00326 #endif
00327         
00329 #ifdef GHOST_DEBUG
00330         GHOST_EventPrinter* m_eventPrinter;
00331 #endif // GHOST_DEBUG
00332 
00334         GHOST_DisplaySetting m_preFullScreenSetting;
00335 };
00336 
00337 inline GHOST_TimerManager* GHOST_System::getTimerManager() const
00338 {
00339         return m_timerManager;
00340 }
00341 
00342 inline GHOST_EventManager* GHOST_System::getEventManager() const
00343 {
00344         return m_eventManager;
00345 }
00346 
00347 inline GHOST_WindowManager* GHOST_System::getWindowManager() const
00348 {
00349         return m_windowManager;
00350 }
00351 
00352 #ifdef WITH_INPUT_NDOF
00353 inline GHOST_NDOFManager* GHOST_System::getNDOFManager() const
00354 {
00355         return m_ndofManager;
00356 }
00357 #endif
00358 
00359 #endif // _GHOST_SYSTEM_H_
00360