Blender  V3.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
GHOST_ISystem Interface Referenceabstract

#include <GHOST_ISystem.h>

Inheritance diagram for GHOST_ISystem:
GHOST_System GHOST_SystemCocoa GHOST_SystemNULL GHOST_SystemSDL GHOST_SystemWayland GHOST_SystemWin32 GHOST_SystemX11

Public Member Functions

virtual uint64_t getMilliSeconds () const =0
 
virtual GHOST_ITimerTaskinstallTimer (uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=NULL)=0
 
virtual GHOST_TSuccess removeTimer (GHOST_ITimerTask *timerTask)=0
 
virtual uint8_t getNumDisplays () const =0
 
virtual void getMainDisplayDimensions (uint32_t &width, uint32_t &height) const =0
 
virtual void getAllDisplayDimensions (uint32_t &width, uint32_t &height) const =0
 
virtual GHOST_IWindowcreateWindow (const char *title, int32_t left, int32_t top, uint32_t width, uint32_t 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 disposeWindow (GHOST_IWindow *window)=0
 
virtual GHOST_IContextcreateOffscreenContext (GHOST_GLSettings glSettings)=0
 
virtual GHOST_TSuccess disposeContext (GHOST_IContext *context)=0
 
virtual bool validWindow (GHOST_IWindow *window)=0
 
virtual GHOST_TSuccess beginFullScreen (const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual, const bool alphaBackground=0)=0
 
virtual GHOST_TSuccess updateFullScreen (const GHOST_DisplaySetting &setting, GHOST_IWindow **window)=0
 
virtual GHOST_TSuccess endFullScreen (void)=0
 
virtual bool getFullScreen (void)=0
 
virtual bool useNativePixel (void)=0
 
virtual bool supportsCursorWarp ()=0
 
virtual bool supportsWindowPosition ()=0
 
virtual void useWindowFocus (const bool use_focus)=0
 
virtual GHOST_IWindowgetWindowUnderCursor (int32_t x, int32_t y)=0
 
virtual bool processEvents (bool waitForEvent)=0
 
virtual void dispatchEvents ()=0
 
virtual GHOST_TSuccess addEventConsumer (GHOST_IEventConsumer *consumer)=0
 
virtual GHOST_TSuccess removeEventConsumer (GHOST_IEventConsumer *consumer)=0
 
virtual GHOST_TSuccess getCursorPositionClientRelative (const GHOST_IWindow *window, int32_t &x, int32_t &y) const =0
 
virtual GHOST_TSuccess setCursorPositionClientRelative (GHOST_IWindow *window, int32_t x, int32_t y)=0
 
virtual GHOST_TSuccess getCursorPosition (int32_t &x, int32_t &y) const =0
 
virtual GHOST_TSuccess setCursorPosition (int32_t x, int32_t y)=0
 
virtual GHOST_TSuccess getModifierKeyState (GHOST_TModifierKey mask, bool &isDown) const =0
 
virtual GHOST_TSuccess getButtonState (GHOST_TButton mask, bool &isDown) const =0
 
virtual void setMultitouchGestures (const bool use)=0
 
virtual void setTabletAPI (GHOST_TTabletAPI api)=0
 
virtual int setConsoleWindowState (GHOST_TConsoleWindowState action)=0
 
virtual char * getClipboard (bool selection) const =0
 
virtual void putClipboard (const char *buffer, bool selection) const =0
 
virtual GHOST_TSuccess showMessageBox (const char *, const char *, const char *, const char *, const char *, GHOST_DialogOptions) const =0
 
virtual void initDebug (GHOST_Debug debug)=0
 
virtual bool isDebugEnabled ()=0
 

Static Public Member Functions

static GHOST_TSuccess createSystem ()
 
static GHOST_TSuccess disposeSystem ()
 
static GHOST_ISystemgetSystem ()
 
static GHOST_TBacktraceFn getBacktraceFn ()
 
static void setBacktraceFn (GHOST_TBacktraceFn backtrace_fn)
 

Protected Member Functions

 GHOST_ISystem ()
 
virtual ~GHOST_ISystem ()
 
virtual GHOST_TSuccess init ()=0
 
virtual GHOST_TSuccess exit ()=0
 

Static Protected Attributes

static GHOST_ISystemm_system = nullptr
 
static GHOST_TBacktraceFn m_backtrace_fn = nullptr
 

Detailed Description

Interface for classes that provide access to the operating system. There should be only one system class in an application. Therefore, the routines to create and dispose the system are static. Provides:

  1. Time(r) management.
  2. Display/window management (windows are only created on the main display).
  3. Event management.
  4. Cursor shape management (no custom cursors for now).
  5. Access to the state of the mouse buttons and the keyboard.
  6. Menus for windows with events generated when they are accessed (this is work in progress).

Definition at line 116 of file GHOST_ISystem.h.

Constructor & Destructor Documentation

◆ GHOST_ISystem()

GHOST_ISystem::GHOST_ISystem ( )
inlineprotected

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

Definition at line 144 of file GHOST_ISystem.h.

◆ ~GHOST_ISystem()

virtual GHOST_ISystem::~GHOST_ISystem ( )
inlineprotectedvirtual

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

Definition at line 152 of file GHOST_ISystem.h.

Member Function Documentation

◆ addEventConsumer()

virtual GHOST_TSuccess GHOST_ISystem::addEventConsumer ( GHOST_IEventConsumer consumer)
pure virtual

Adds the given event consumer to our list.

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

Implemented in GHOST_System.

Referenced by GHOST_AddEventConsumer(), and main().

◆ beginFullScreen()

virtual GHOST_TSuccess GHOST_ISystem::beginFullScreen ( const GHOST_DisplaySetting setting,
GHOST_IWindow **  window,
const bool  stereoVisual,
const bool  alphaBackground = 0 
)
pure virtual

Begins full screen mode.

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

Implemented in GHOST_System.

Referenced by GHOST_BeginFullScreen(), and Application::processEvent().

◆ createOffscreenContext()

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

Create a new off-screen context. Never explicitly delete the context, use disposeContext() instead.

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

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

Referenced by GHOST_CreateOpenGLContext().

◆ createSystem()

GHOST_TSuccess GHOST_ISystem::createSystem ( )
static

Creates the one and only system.

Returns
An indication of success.

Definition at line 36 of file GHOST_ISystem.cpp.

References GHOST_kFailure, GHOST_kSuccess, init(), and m_system.

Referenced by GHOST_CreateSystem(), and main().

◆ createWindow()

virtual GHOST_IWindow* GHOST_ISystem::createWindow ( const char *  title,
int32_t  left,
int32_t  top,
uint32_t  width,
uint32_t  height,
GHOST_TWindowState  state,
GHOST_TDrawingContextType  type,
GHOST_GLSettings  glSettings,
const bool  exclusive = false,
const bool  is_dialog = false,
const GHOST_IWindow parentWindow = NULL 
)
pure virtual

Create a new window. The new window is added to the list of windows managed. Never explicitly delete the window, use disposeWindow() instead.

Parameters
titleThe name of the window (displayed in the title bar of the window if the OS supports it).
leftThe coordinate of the left edge of the window.
topThe coordinate of the top edge of the window.
widthThe width the window.
heightThe height the window.
stateThe state of the window when opened.
typeThe type of drawing context installed in this window.
glSettingsMisc OpenGL settings.
exclusiveUse to show the window on top and ignore others (used full-screen).
is_dialogStay on top of parent window, no icon in taskbar, can't be minimized.
parentWindowParent (embedder) window
Returns
The new window (or 0 if creation failed).

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

Referenced by Application::Application(), GHOST_System::createFullScreenWindow(), and GHOST_CreateWindow().

◆ dispatchEvents()

virtual void GHOST_ISystem::dispatchEvents ( )
pure virtual

Retrieves events from the queue and send them to the event consumers.

Implemented in GHOST_System.

Referenced by GHOST_DispatchEvents(), and main().

◆ disposeContext()

virtual GHOST_TSuccess GHOST_ISystem::disposeContext ( GHOST_IContext context)
pure virtual

Dispose of a context.

Parameters
contextPointer to the context to be disposed.
Returns
Indication of success.

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

Referenced by GHOST_DisposeOpenGLContext().

◆ disposeSystem()

GHOST_TSuccess GHOST_ISystem::disposeSystem ( )
static

Disposes the one and only system.

Returns
An indication of success.

Definition at line 88 of file GHOST_ISystem.cpp.

References GHOST_kFailure, GHOST_kSuccess, and m_system.

Referenced by GHOST_DisposeSystem(), and main().

◆ disposeWindow()

virtual GHOST_TSuccess GHOST_ISystem::disposeWindow ( GHOST_IWindow window)
pure virtual

Dispose a window.

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

Implemented in GHOST_System.

Referenced by GHOST_DisposeWindow(), Application::processEvent(), and Application::~Application().

◆ endFullScreen()

virtual GHOST_TSuccess GHOST_ISystem::endFullScreen ( void  )
pure virtual

Ends full screen mode.

Returns
Indication of success.

Implemented in GHOST_System.

Referenced by GHOST_EndFullScreen(), and Application::processEvent().

◆ exit()

virtual GHOST_TSuccess GHOST_ISystem::exit ( )
protectedpure virtual

Shut the system down.

Returns
Indication of success.

Implemented in GHOST_SystemWin32, and GHOST_System.

◆ getAllDisplayDimensions()

virtual void GHOST_ISystem::getAllDisplayDimensions ( uint32_t width,
uint32_t height 
) const
pure virtual

Returns the combine dimensions of all monitors.

Returns
The dimension of the workspace.

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

Referenced by GHOST_GetAllDisplayDimensions().

◆ getBacktraceFn()

GHOST_TBacktraceFn GHOST_ISystem::getBacktraceFn ( )
static

Definition at line 106 of file GHOST_ISystem.cpp.

References m_backtrace_fn.

Referenced by ghost_wayland_log_handler().

◆ getButtonState()

virtual GHOST_TSuccess GHOST_ISystem::getButtonState ( GHOST_TButton  mask,
bool isDown 
) const
pure virtual

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

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

Implemented in GHOST_System.

Referenced by GHOST_GetButtonState().

◆ getClipboard()

virtual char* GHOST_ISystem::getClipboard ( bool  selection) const
pure virtual

Returns the selection buffer

Returns
"unsigned char" from X11 XA_CUT_BUFFER0 buffer

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

Referenced by GHOST_getClipboard().

◆ getCursorPosition()

virtual GHOST_TSuccess GHOST_ISystem::getCursorPosition ( int32_t x,
int32_t y 
) const
pure virtual

Returns the current location of the cursor (location in screen coordinates)

Parameters
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns
Indication of success.

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

Referenced by GHOST_System::getCursorPositionClientRelative().

◆ getCursorPositionClientRelative()

virtual GHOST_TSuccess GHOST_ISystem::getCursorPositionClientRelative ( const GHOST_IWindow window,
int32_t x,
int32_t y 
) const
pure virtual

Returns the current location of the cursor (location in window coordinates)

Parameters
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns
Indication of success.

Implemented in GHOST_SystemWayland, and GHOST_System.

Referenced by GHOST_GetCursorPosition().

◆ getFullScreen()

virtual bool GHOST_ISystem::getFullScreen ( void  )
pure virtual

Returns current full screen mode status.

Returns
The current status.

Implemented in GHOST_System.

Referenced by GHOST_GetFullScreen(), and Application::processEvent().

◆ getMainDisplayDimensions()

virtual void GHOST_ISystem::getMainDisplayDimensions ( uint32_t width,
uint32_t height 
) const
pure virtual

Returns the dimensions of the main display on this system.

Returns
The dimension of the main display.

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

Referenced by GHOST_GetMainDisplayDimensions().

◆ getMilliSeconds()

virtual uint64_t GHOST_ISystem::getMilliSeconds ( ) const
pure virtual

Returns the system time. Returns the number of milliseconds since the start of the system process. Based on ANSI clock() routine.

Returns
The number of milliseconds.

Implemented in GHOST_SystemX11, GHOST_SystemWin32, GHOST_SystemNULL, GHOST_SystemCocoa, and GHOST_System.

Referenced by GHOST_GetMilliSeconds().

◆ getModifierKeyState()

virtual GHOST_TSuccess GHOST_ISystem::getModifierKeyState ( GHOST_TModifierKey  mask,
bool isDown 
) const
pure virtual

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.

Implemented in GHOST_System.

Referenced by GHOST_GetModifierKeyState(), and Application::processEvent().

◆ getNumDisplays()

virtual uint8_t GHOST_ISystem::getNumDisplays ( ) const
pure virtual

Returns the number of displays on this system.

Returns
The number of displays.

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

Referenced by GHOST_GetNumDisplays().

◆ getSystem()

GHOST_ISystem * GHOST_ISystem::getSystem ( )
static

◆ getWindowUnderCursor()

virtual GHOST_IWindow* GHOST_ISystem::getWindowUnderCursor ( int32_t  x,
int32_t  y 
)
pure virtual

Get the Window under the cursor.

Parameters
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns
The window under the cursor or nullptr if none.

Implemented in GHOST_SystemNULL, GHOST_SystemCocoa, and GHOST_System.

Referenced by GHOST_GetWindowUnderCursor().

◆ init()

virtual GHOST_TSuccess GHOST_ISystem::init ( )
protectedpure virtual

Initialize the system.

Returns
Indication of success.

Implemented in GHOST_SystemX11, GHOST_SystemWin32, GHOST_SystemNULL, GHOST_SystemCocoa, and GHOST_System.

Referenced by createSystem().

◆ initDebug()

virtual void GHOST_ISystem::initDebug ( GHOST_Debug  debug)
pure virtual

Specify whether debug messages are to be shown.

Parameters
debugFlag for systems to debug.

Implemented in GHOST_SystemWin32, and GHOST_System.

Referenced by GHOST_SystemInitDebug().

◆ installTimer()

virtual GHOST_ITimerTask* GHOST_ISystem::installTimer ( uint64_t  delay,
uint64_t  interval,
GHOST_TimerProcPtr  timerProc,
GHOST_TUserDataPtr  userData = NULL 
)
pure virtual

Installs a timer. Note that, 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 (in milliseconds).
timerProcThe callback invoked when the interval expires.
userDataPlaceholder for user data.
Returns
A timer task (0 if timer task installation failed).

Implemented in GHOST_System.

Referenced by Application::Application(), GHOST_InstallTimer(), and Application::processEvent().

◆ isDebugEnabled()

virtual bool GHOST_ISystem::isDebugEnabled ( )
pure virtual

Check whether debug messages are to be shown.

Implemented in GHOST_System.

Referenced by GHOST_X11_ApplicationErrorHandler(), and GHOST_X11_ApplicationIOErrorHandler().

◆ processEvents()

virtual bool GHOST_ISystem::processEvents ( bool  waitForEvent)
pure virtual

Retrieves events from the system and stores them in the queue.

Parameters
waitForEventFlag to wait for an event (or return immediately).
Returns
Indication of the presence of events.

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

Referenced by GHOST_ProcessEvents(), and main().

◆ putClipboard()

virtual void GHOST_ISystem::putClipboard ( const char *  buffer,
bool  selection 
) const
pure virtual

◆ removeEventConsumer()

virtual GHOST_TSuccess GHOST_ISystem::removeEventConsumer ( GHOST_IEventConsumer consumer)
pure virtual

Removes the given event consumer to our list.

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

Implemented in GHOST_System.

Referenced by GHOST_RemoveEventConsumer(), and main().

◆ removeTimer()

virtual GHOST_TSuccess GHOST_ISystem::removeTimer ( GHOST_ITimerTask timerTask)
pure virtual

Removes a timer.

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

Implemented in GHOST_System.

Referenced by GHOST_RemoveTimer(), and Application::processEvent().

◆ setBacktraceFn()

void GHOST_ISystem::setBacktraceFn ( GHOST_TBacktraceFn  backtrace_fn)
static

Definition at line 111 of file GHOST_ISystem.cpp.

References m_backtrace_fn.

Referenced by GHOST_SetBacktraceHandler().

◆ setConsoleWindowState()

virtual int GHOST_ISystem::setConsoleWindowState ( GHOST_TConsoleWindowState  action)
pure virtual

Set the Console State

Parameters
actionconsole state
Returns
current status (1 -visible, 0 - hidden)

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

Referenced by GHOST_setConsoleWindowState().

◆ setCursorPosition()

virtual GHOST_TSuccess GHOST_ISystem::setCursorPosition ( int32_t  x,
int32_t  y 
)
pure virtual

Updates the location of the cursor (location in screen coordinates). Not all operating systems allow the cursor to be moved (without the input device being moved).

Parameters
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns
Indication of success.

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

Referenced by Application::processEvent(), and GHOST_System::setCursorPositionClientRelative().

◆ setCursorPositionClientRelative()

virtual GHOST_TSuccess GHOST_ISystem::setCursorPositionClientRelative ( GHOST_IWindow window,
int32_t  x,
int32_t  y 
)
pure virtual

Updates the location of the cursor (location in window coordinates).

Parameters
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns
Indication of success.

Implemented in GHOST_SystemWayland, and GHOST_System.

Referenced by GHOST_SetCursorPosition().

◆ setMultitouchGestures()

virtual void GHOST_ISystem::setMultitouchGestures ( const bool  use)
pure virtual

Enable multitouch gestures if supported.

Parameters
useEnable or disable.

Implemented in GHOST_System.

Referenced by GHOST_SetMultitouchGestures().

◆ setTabletAPI()

virtual void GHOST_ISystem::setTabletAPI ( GHOST_TTabletAPI  api)
pure virtual

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

Parameters
apiEnum indicating which API to use.

Implemented in GHOST_SystemWin32, and GHOST_System.

Referenced by GHOST_SetTabletAPI().

◆ showMessageBox()

virtual GHOST_TSuccess GHOST_ISystem::showMessageBox ( const char *  ,
const char *  ,
const char *  ,
const char *  ,
const char *  ,
GHOST_DialogOptions   
) const
pure virtual

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.

Implemented in GHOST_SystemX11, GHOST_SystemWin32, and GHOST_System.

Referenced by GHOST_ShowMessageBox().

◆ supportsCursorWarp()

virtual bool GHOST_ISystem::supportsCursorWarp ( )
pure virtual

Return true when warping the cursor is supported.

Implemented in GHOST_System, and GHOST_SystemWayland.

Referenced by GHOST_SupportsCursorWarp().

◆ supportsWindowPosition()

virtual bool GHOST_ISystem::supportsWindowPosition ( )
pure virtual

Return true getting/setting the window position is supported.

Implemented in GHOST_System, and GHOST_SystemWayland.

Referenced by GHOST_SupportsWindowPosition().

◆ updateFullScreen()

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

Updates the resolution while in fullscreen mode.

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

Implemented in GHOST_System.

◆ useNativePixel()

virtual bool GHOST_ISystem::useNativePixel ( void  )
pure virtual

Native pixel size support (MacBook 'retina').

Implemented in GHOST_System.

Referenced by GHOST_UseNativePixels().

◆ useWindowFocus()

virtual void GHOST_ISystem::useWindowFocus ( const bool  use_focus)
pure virtual

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

Implemented in GHOST_System.

Referenced by GHOST_UseWindowFocus().

◆ validWindow()

virtual bool GHOST_ISystem::validWindow ( GHOST_IWindow window)
pure virtual

Returns whether a window is valid.

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

Implemented in GHOST_System.

Referenced by gearsTimerProc(), GHOST_ValidWindow(), Application::processEvent(), and Application::~Application().

Member Data Documentation

◆ m_backtrace_fn

GHOST_TBacktraceFn GHOST_ISystem::m_backtrace_fn = nullptr
staticprotected

Function to call that sets the back-trace.

Definition at line 519 of file GHOST_ISystem.h.

Referenced by getBacktraceFn(), and setBacktraceFn().

◆ m_system

GHOST_ISystem * GHOST_ISystem::m_system = nullptr
staticprotected

The one and only system

Copyright (C) 2001 NaN Technologies B.V.

Definition at line 516 of file GHOST_ISystem.h.

Referenced by createSystem(), disposeSystem(), and getSystem().


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