Blender  V2.93
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
GHOST_System Class Referenceabstract

#include <GHOST_System.h>

Inherits GHOST_ISystem.

Inherited by GHOST_SystemCocoa, GHOST_SystemNULL, GHOST_SystemSDL, GHOST_SystemWayland, GHOST_SystemWin32, and GHOST_SystemX11.

Public Member Functions

virtual GHOST_TUns64 getMilliSeconds () const
 
GHOST_ITimerTaskinstallTimer (GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=NULL)
 
GHOST_TSuccess removeTimer (GHOST_ITimerTask *timerTask)
 
GHOST_TSuccess disposeWindow (GHOST_IWindow *window)
 
virtual GHOST_IContextcreateOffscreenContext (GHOST_GLSettings glSettings)=0
 
bool validWindow (GHOST_IWindow *window)
 
GHOST_TSuccess beginFullScreen (const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual, const bool alphaBackground)
 
GHOST_TSuccess updateFullScreen (const GHOST_DisplaySetting &setting, GHOST_IWindow **window)
 
GHOST_TSuccess endFullScreen (void)
 
bool getFullScreen (void)
 
bool useNativePixel (void)
 
void useWindowFocus (const bool use_focus)
 
void dispatchEvents ()
 
GHOST_TSuccess addEventConsumer (GHOST_IEventConsumer *consumer)
 
GHOST_TSuccess removeEventConsumer (GHOST_IEventConsumer *consumer)
 
GHOST_TSuccess getModifierKeyState (GHOST_TModifierKeyMask mask, bool &isDown) const
 
GHOST_TSuccess getButtonState (GHOST_TButtonMask mask, bool &isDown) const
 
void setTabletAPI (GHOST_TTabletAPI api)
 
GHOST_TTabletAPI getTabletAPI (void)
 
GHOST_TSuccess pushEvent (GHOST_IEvent *event)
 
GHOST_TimerManagergetTimerManager () const
 
GHOST_EventManagergetEventManager () const
 
GHOST_WindowManagergetWindowManager () const
 
virtual GHOST_TSuccess getModifierKeys (GHOST_ModifierKeys &keys) const =0
 
virtual GHOST_TSuccess getButtons (GHOST_Buttons &buttons) const =0
 
virtual GHOST_TUns8getClipboard (bool selection) const =0
 
virtual void putClipboard (GHOST_TInt8 *buffer, bool selection) const =0
 
virtual GHOST_TSuccess showMessageBox (const char *, const char *, const char *, const char *, const char *, GHOST_DialogOptions) const
 
virtual void initDebug (bool is_debug_enabled)
 
virtual bool isDebugEnabled ()
 
- Public Member Functions inherited from GHOST_ISystem
virtual GHOST_TUns8 getNumDisplays () const =0
 
virtual void getMainDisplayDimensions (GHOST_TUns32 &width, GHOST_TUns32 &height) const =0
 
virtual void getAllDisplayDimensions (GHOST_TUns32 &width, GHOST_TUns32 &height) const =0
 
virtual GHOST_IWindowcreateWindow (const char *title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parentWindow=NULL)=0
 
virtual GHOST_TSuccess disposeContext (GHOST_IContext *context)=0
 
virtual bool processEvents (bool waitForEvent)=0
 
virtual GHOST_TSuccess getCursorPosition (GHOST_TInt32 &x, GHOST_TInt32 &y) const =0
 
virtual GHOST_TSuccess setCursorPosition (GHOST_TInt32 x, GHOST_TInt32 y)=0
 
virtual int toggleConsole (int action)=0
 

Public Attributes

bool m_nativePixel
 
bool m_windowFocus
 

Protected Member Functions

 GHOST_System ()
 
virtual ~GHOST_System ()
 
virtual GHOST_TSuccess init ()
 
virtual GHOST_TSuccess exit ()
 
GHOST_TSuccess createFullScreenWindow (GHOST_Window **window, const GHOST_DisplaySetting &settings, const bool stereoVisual, const bool alphaBackground=0)
 
- Protected Member Functions inherited from GHOST_ISystem
 GHOST_ISystem ()
 
virtual ~GHOST_ISystem ()
 

Protected Attributes

GHOST_DisplayManagerm_displayManager
 
GHOST_TimerManagerm_timerManager
 
GHOST_WindowManagerm_windowManager
 
GHOST_EventManagerm_eventManager
 
GHOST_DisplaySetting m_preFullScreenSetting
 
GHOST_TTabletAPI m_tabletAPI
 
bool m_is_debug_enabled
 

Additional Inherited Members

- Static Public Member Functions inherited from GHOST_ISystem
static GHOST_TSuccess createSystem ()
 
static GHOST_TSuccess disposeSystem ()
 
static GHOST_ISystemgetSystem ()
 
- Static Protected Attributes inherited from GHOST_ISystem
static GHOST_ISystemm_system = NULL
 

Detailed Description

Implementation of platform independent functionality of the GHOST_ISystem interface. GHOST_System is an abstract class because not all methods of GHOST_ISystem are implemented.

See also
GHOST_ISystem.

Definition at line 53 of file GHOST_System.h.

Constructor & Destructor Documentation

◆ GHOST_System()

GHOST_System::GHOST_System ( )
protected

Constructor. Protected default constructor to force use of static createSystem member.

Definition at line 39 of file GHOST_System.cpp.

◆ ~GHOST_System()

GHOST_System::~GHOST_System ( )
protectedvirtual

Destructor. Protected default constructor to force use of static dispose member.

Definition at line 54 of file GHOST_System.cpp.

References exit().

Member Function Documentation

◆ addEventConsumer()

GHOST_TSuccess GHOST_System::addEventConsumer ( GHOST_IEventConsumer consumer)
virtual

Adds the given event consumer to our list.

Parameters
consumerThe event consumer to add.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 224 of file GHOST_System.cpp.

References GHOST_EventManager::addConsumer(), GHOST_kFailure, and m_eventManager.

◆ beginFullScreen()

GHOST_TSuccess GHOST_System::beginFullScreen ( const GHOST_DisplaySetting setting,
GHOST_IWindow **  window,
const bool  stereoVisual,
const bool  alphaBackground 
)
virtual

Begins full screen mode.

Parameters
settingThe new setting of the display.
windowWindow displayed in full screen.
stereoVisualStereo visual for quad buffered stereo. This window is invalid after full screen has been ended.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 127 of file GHOST_System.cpp.

References GHOST_WindowManager::beginFullScreen(), createFullScreenWindow(), GHOST_DisplayManager::getCurrentDisplaySetting(), GHOST_WindowManager::getFullScreen(), GHOST_ASSERT, GHOST_kFailure, GHOST_kSuccess, GHOST_PRINT, GHOST_DisplayManager::kMainDisplay, m_displayManager, m_preFullScreenSetting, m_windowManager, and GHOST_DisplayManager::setCurrentDisplaySetting().

◆ createFullScreenWindow()

GHOST_TSuccess GHOST_System::createFullScreenWindow ( GHOST_Window **  window,
const GHOST_DisplaySetting settings,
const bool  stereoVisual,
const bool  alphaBackground = 0 
)
protected

◆ createOffscreenContext()

virtual GHOST_IContext* GHOST_System::createOffscreenContext ( GHOST_GLSettings  glSettings)
pure virtual

Create a new offscreen context. Never explicitly delete the context, use disposeContext() instead.

Returns
The new context (or 0 if creation failed).

Implements GHOST_ISystem.

Implemented in GHOST_SystemWayland, GHOST_SystemX11, GHOST_SystemWin32, GHOST_SystemSDL, GHOST_SystemNULL, and GHOST_SystemCocoa.

◆ dispatchEvents()

void GHOST_System::dispatchEvents ( )
virtual

Inherited from GHOST_ISystem but left pure virtual

virtual bool processEvents(bool waitForEvent) = 0; Dispatches all the events on the stack. The event stack will be empty afterwards.

Implements GHOST_ISystem.

Definition at line 208 of file GHOST_System.cpp.

References GHOST_EventManager::dispatchEvents(), GHOST_TimerManager::fireTimers(), getMilliSeconds(), m_eventManager, and m_timerManager.

Referenced by GHOST_SystemWin32::s_wndProc().

◆ disposeWindow()

GHOST_TSuccess GHOST_System::disposeWindow ( GHOST_IWindow window)
virtual

Dispose a window.

Parameters
windowPointer to the window to be disposed.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 95 of file GHOST_System.cpp.

References endFullScreen(), GHOST_WindowManager::getFullScreenWindow(), GHOST_WindowManager::getWindowFound(), GHOST_kFailure, m_eventManager, m_windowManager, GHOST_WindowManager::removeWindow(), and GHOST_EventManager::removeWindowEvents().

◆ endFullScreen()

GHOST_TSuccess GHOST_System::endFullScreen ( void  )
virtual

◆ exit()

GHOST_TSuccess GHOST_System::exit ( )
protectedvirtual

Shut the system down.

Returns
Indication of success.

Implements GHOST_ISystem.

Reimplemented in GHOST_SystemWin32.

Definition at line 324 of file GHOST_System.cpp.

References endFullScreen(), getFullScreen(), GHOST_kSuccess, m_displayManager, m_eventManager, m_timerManager, m_windowManager, and NULL.

Referenced by GHOST_SystemWin32::exit(), and ~GHOST_System().

◆ getButtons()

virtual GHOST_TSuccess GHOST_System::getButtons ( GHOST_Buttons buttons) const
pure virtual

Returns the state of the mouse buttons (outside the message queue).

Parameters
buttonsThe state of the buttons.
Returns
Indication of success.

Implemented in GHOST_SystemWayland, GHOST_SystemX11, GHOST_SystemWin32, GHOST_SystemSDL, GHOST_SystemNULL, and GHOST_SystemCocoa.

Referenced by getButtonState().

◆ getButtonState()

GHOST_TSuccess GHOST_System::getButtonState ( GHOST_TButtonMask  mask,
bool &  isDown 
) const
virtual

Returns the state of a mouse button (outside the message queue).

Parameters
maskThe button state to retrieve.
isDownButton state.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 272 of file GHOST_System.cpp.

References GHOST_Buttons::get(), getButtons(), and mask().

◆ getClipboard()

virtual GHOST_TUns8* GHOST_System::getClipboard ( bool  selection) const
pure virtual

Returns the selection buffer

Parameters
selectionOnly used on X11.
Returns
Returns the clipboard data

Implements GHOST_ISystem.

Implemented in GHOST_SystemWayland, GHOST_SystemX11, GHOST_SystemWin32, GHOST_SystemSDL, GHOST_SystemNULL, and GHOST_SystemCocoa.

◆ getEventManager()

GHOST_EventManager * GHOST_System::getEventManager ( ) const
inline
Returns
A pointer to our event manager.

Definition at line 412 of file GHOST_System.h.

References m_eventManager.

Referenced by GHOST_SystemWayland::processEvents(), and GHOST_SystemWin32::s_wndProc().

◆ getFullScreen()

bool GHOST_System::getFullScreen ( void  )
virtual

Returns current full screen mode status.

Returns
The current status.

Implements GHOST_ISystem.

Definition at line 196 of file GHOST_System.cpp.

References GHOST_WindowManager::getFullScreen(), and m_windowManager.

Referenced by exit().

◆ getMilliSeconds()

GHOST_TUns64 GHOST_System::getMilliSeconds ( ) const
virtual

◆ getModifierKeys()

virtual GHOST_TSuccess GHOST_System::getModifierKeys ( GHOST_ModifierKeys keys) const
pure virtual

Returns the state of all modifier keys.

Parameters
keysThe state of all modifier keys (true == pressed).
Returns
Indication of success.

Implemented in GHOST_SystemWayland, GHOST_SystemX11, GHOST_SystemWin32, GHOST_SystemSDL, GHOST_SystemNULL, and GHOST_SystemCocoa.

Referenced by getModifierKeyState().

◆ getModifierKeyState()

GHOST_TSuccess GHOST_System::getModifierKeyState ( GHOST_TModifierKeyMask  mask,
bool &  isDown 
) const
virtual

Inherited from GHOST_ISystem but left pure virtual

GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)

Returns the state of a modifier key (outside the message queue).

Parameters
maskThe modifier key state to retrieve.
isDownThe state of a modifier key (true == pressed).
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 260 of file GHOST_System.cpp.

References GHOST_ModifierKeys::get(), getModifierKeys(), and mask().

◆ getTabletAPI()

GHOST_TTabletAPI GHOST_System::getTabletAPI ( void  )

◆ getTimerManager()

GHOST_TimerManager * GHOST_System::getTimerManager ( ) const
inline

◆ getWindowManager()

GHOST_WindowManager * GHOST_System::getWindowManager ( ) const
inline

◆ init()

GHOST_TSuccess GHOST_System::init ( void  )
protectedvirtual

◆ initDebug()

void GHOST_System::initDebug ( bool  is_debug_enabled)
virtual

Specify whether debug messages are to be shown.

Implements GHOST_ISystem.

Definition at line 390 of file GHOST_System.cpp.

References m_is_debug_enabled.

◆ installTimer()

GHOST_ITimerTask * GHOST_System::installTimer ( GHOST_TUns64  delay,
GHOST_TUns64  interval,
GHOST_TimerProcPtr  timerProc,
GHOST_TUserDataPtr  userData = NULL 
)
virtual

Installs a timer.

Note
On most operating systems, messages need to be processed in order for the timer callbacks to be invoked.
Parameters
delayThe time to wait for the first call to the #timerProc (in milliseconds).
intervalThe interval between calls to the #timerProc.
timerProcThe callback invoked when the interval expires.
userDataPlaceholder for user data.
Returns
A timer task (0 if timer task installation failed).

Implements GHOST_ISystem.

Definition at line 66 of file GHOST_System.cpp.

References GHOST_TimerManager::addTimer(), GHOST_TimerManager::fireTimers(), getMilliSeconds(), GHOST_kSuccess, m_timerManager, and NULL.

Referenced by keyboard_key().

◆ isDebugEnabled()

bool GHOST_System::isDebugEnabled ( )
virtual

Check whether debug messages are to be shown.

Implements GHOST_ISystem.

Definition at line 395 of file GHOST_System.cpp.

References m_is_debug_enabled.

◆ pushEvent()

GHOST_TSuccess GHOST_System::pushEvent ( GHOST_IEvent event)

◆ putClipboard()

virtual void GHOST_System::putClipboard ( GHOST_TInt8 buffer,
bool  selection 
) const
pure virtual

Put data to the Clipboard

Parameters
bufferThe buffer to copy to the clipboard.
selectionThe clipboard to copy too only used on X11.

Implements GHOST_ISystem.

Implemented in GHOST_SystemWayland, GHOST_SystemX11, GHOST_SystemWin32, GHOST_SystemSDL, GHOST_SystemNULL, and GHOST_SystemCocoa.

◆ removeEventConsumer()

GHOST_TSuccess GHOST_System::removeEventConsumer ( GHOST_IEventConsumer consumer)
virtual

Remove the given event consumer to our list.

Parameters
consumerThe event consumer to remove.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 236 of file GHOST_System.cpp.

References GHOST_kFailure, m_eventManager, and GHOST_EventManager::removeConsumer().

◆ removeTimer()

GHOST_TSuccess GHOST_System::removeTimer ( GHOST_ITimerTask timerTask)
virtual

Removes a timer.

Parameters
timerTaskTimer task to be removed.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 86 of file GHOST_System.cpp.

References GHOST_kFailure, m_timerManager, and GHOST_TimerManager::removeTimer().

Referenced by display_destroy(), and keyboard_key().

◆ setTabletAPI()

void GHOST_System::setTabletAPI ( GHOST_TTabletAPI  api)
virtual

Set which tablet API to use. Only affects Windows, other platforms have a single API.

Parameters
apiEnum indicating which API to use.

Implements GHOST_ISystem.

Definition at line 284 of file GHOST_System.cpp.

References m_tabletAPI.

◆ showMessageBox()

virtual GHOST_TSuccess GHOST_System::showMessageBox ( const char *  ,
const char *  ,
const char *  ,
const char *  ,
const char *  ,
GHOST_DialogOptions   
) const
inlinevirtual

Show a system message box

Parameters
titleThe title of the message box.
messageThe message to display.
help_labelHelp button label.
continue_labelContinue button label.
linkAn optional hyperlink.
dialog_optionsOptions how to display the message.

Implements GHOST_ISystem.

Reimplemented in GHOST_SystemX11, and GHOST_SystemWin32.

Definition at line 329 of file GHOST_System.h.

References GHOST_kFailure.

◆ updateFullScreen()

GHOST_TSuccess GHOST_System::updateFullScreen ( const GHOST_DisplaySetting setting,
GHOST_IWindow **  window 
)
virtual

Updates the resolution while in fullscreen mode.

Parameters
settingThe new setting of the display.
windowWindow displayed in full screen.
Returns
Indication of success.

Implements GHOST_ISystem.

Definition at line 162 of file GHOST_System.cpp.

References GHOST_WindowManager::getFullScreen(), GHOST_ASSERT, GHOST_kFailure, GHOST_DisplayManager::kMainDisplay, m_displayManager, m_windowManager, and GHOST_DisplayManager::setCurrentDisplaySetting().

◆ useNativePixel()

bool GHOST_System::useNativePixel ( void  )
virtual

Native pixel size support (MacBook 'retina').

Returns
The pixel size in float.

Implements GHOST_ISystem.

Definition at line 379 of file GHOST_System.cpp.

References m_nativePixel.

◆ useWindowFocus()

void GHOST_System::useWindowFocus ( const bool  use_focus)
virtual

Focus window after opening, or put them in the background.

Implements GHOST_ISystem.

Definition at line 385 of file GHOST_System.cpp.

References m_windowFocus.

◆ validWindow()

bool GHOST_System::validWindow ( GHOST_IWindow window)
virtual

Returns whether a window is valid.

Parameters
windowPointer to the window to be checked.
Returns
Indication of validity.

Implements GHOST_ISystem.

Definition at line 122 of file GHOST_System.cpp.

References GHOST_WindowManager::getWindowFound(), and m_windowManager.

Referenced by GHOST_SystemCocoa::handleDraggingEvent(), and GHOST_SystemCocoa::handleWindowEvent().

Member Data Documentation

◆ m_displayManager

GHOST_DisplayManager* GHOST_System::m_displayManager
protected

◆ m_eventManager

GHOST_EventManager* GHOST_System::m_eventManager
protected

◆ m_is_debug_enabled

bool GHOST_System::m_is_debug_enabled
protected

Definition at line 404 of file GHOST_System.h.

Referenced by initDebug(), and isDebugEnabled().

◆ m_nativePixel

bool GHOST_System::m_nativePixel

◆ m_preFullScreenSetting

GHOST_DisplaySetting GHOST_System::m_preFullScreenSetting
protected

Prints all the events. Settings of the display before the display went fullscreen.

Definition at line 399 of file GHOST_System.h.

Referenced by beginFullScreen(), and endFullScreen().

◆ m_tabletAPI

GHOST_TTabletAPI GHOST_System::m_tabletAPI
protected

Which tablet API to use.

Definition at line 402 of file GHOST_System.h.

Referenced by getTabletAPI(), and setTabletAPI().

◆ m_timerManager

GHOST_TimerManager* GHOST_System::m_timerManager
protected

The timer manager.

Definition at line 380 of file GHOST_System.h.

Referenced by dispatchEvents(), exit(), getTimerManager(), init(), installTimer(), and removeTimer().

◆ m_windowFocus

bool GHOST_System::m_windowFocus

◆ m_windowManager

GHOST_WindowManager* GHOST_System::m_windowManager
protected

The documentation for this class was generated from the following files: