1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 /** \file
18  * \ingroup GHOST
19  * Declaration of GHOST_SystemNULL class.
20  */
21 
22 #pragma once
23 
24 #include "../GHOST_Types.h"
25 #include "GHOST_DisplayManagerNULL.h"
26 #include "GHOST_System.h"
27 #include "GHOST_WindowNULL.h"
28 
29 class GHOST_WindowNULL;
30 
31 class GHOST_SystemNULL : public GHOST_System {
32  public:
GHOST_SystemNULL()33   GHOST_SystemNULL() : GHOST_System()
34   { /* nop */
35   }
~GHOST_SystemNULL()36   ~GHOST_SystemNULL()
37   { /* nop */
38   }
processEvents(bool waitForEvent)39   bool processEvents(bool waitForEvent)
40   {
41     return false;
42   }
toggleConsole(int action)43   int toggleConsole(int action)
44   {
45     return 0;
46   }
getModifierKeys(GHOST_ModifierKeys & keys)47   GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const
48   {
49     return GHOST_kSuccess;
50   }
getButtons(GHOST_Buttons & buttons)51   GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const
52   {
53     return GHOST_kSuccess;
54   }
getClipboard(bool selection)55   GHOST_TUns8 *getClipboard(bool selection) const
56   {
57     return NULL;
58   }
putClipboard(GHOST_TInt8 * buffer,bool selection)59   void putClipboard(GHOST_TInt8 *buffer, bool selection) const
60   { /* nop */
61   }
getMilliSeconds()62   GHOST_TUns64 getMilliSeconds() const
63   {
64     return 0;
65   }
getNumDisplays()66   GHOST_TUns8 getNumDisplays() const
67   {
68     return GHOST_TUns8(1);
69   }
getCursorPosition(GHOST_TInt32 & x,GHOST_TInt32 & y)70   GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
71   {
72     return GHOST_kFailure;
73   }
setCursorPosition(GHOST_TInt32 x,GHOST_TInt32 y)74   GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
75   {
76     return GHOST_kFailure;
77   }
getMainDisplayDimensions(GHOST_TUns32 & width,GHOST_TUns32 & height)78   void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
79   { /* nop */
80   }
getAllDisplayDimensions(GHOST_TUns32 & width,GHOST_TUns32 & height)81   void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
82   { /* nop */
83   }
createOffscreenContext(GHOST_GLSettings glSettings)84   GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings)
85   {
86     return NULL;
87   }
disposeContext(GHOST_IContext * context)88   GHOST_TSuccess disposeContext(GHOST_IContext *context)
89   {
90     return GHOST_kFailure;
91   }
92 
init()93   GHOST_TSuccess init()
94   {
95     GHOST_TSuccess success = GHOST_System::init();
96 
97     if (success) {
98       m_displayManager = new GHOST_DisplayManagerNULL(this);
99 
100       if (m_displayManager) {
101         return GHOST_kSuccess;
102       }
103     }
104 
105     return GHOST_kFailure;
106   }
107 
createWindow(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,const bool is_dialog,const GHOST_IWindow * parentWindow)108   GHOST_IWindow *createWindow(const char *title,
109                               GHOST_TInt32 left,
110                               GHOST_TInt32 top,
111                               GHOST_TUns32 width,
112                               GHOST_TUns32 height,
113                               GHOST_TWindowState state,
114                               GHOST_TDrawingContextType type,
115                               GHOST_GLSettings glSettings,
116                               const bool exclusive,
117                               const bool is_dialog,
118                               const GHOST_IWindow *parentWindow)
119   {
120     return new GHOST_WindowNULL(this,
121                                 title,
122                                 left,
123                                 top,
124                                 width,
125                                 height,
126                                 state,
127                                 parentWindow,
128                                 type,
129                                 ((glSettings.flags & GHOST_glStereoVisual) != 0));
130   }
131 };
132