Equalizer
1.4.1
|
00001 00002 /* Copyright (c) 2006-2011, Stefan Eilemann <eile@equalizergraphics.com> 00003 * 2011, Daniel Pfeifer <daniel@pfeifer-mail.de> 00004 * 00005 * This library is free software; you can redistribute it and/or modify it under 00006 * the terms of the GNU Lesser General Public License version 2.1 as published 00007 * by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, but WITHOUT 00010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00012 * details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this library; if not, write to the Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00017 */ 00018 00019 #ifndef EQ_WINDOWSYSTEM_H 00020 #define EQ_WINDOWSYSTEM_H 00021 00022 #include <eq/client/api.h> 00023 #include <eq/client/types.h> 00024 00025 namespace eq 00026 { 00027 00029 class WindowSystemIF 00030 { 00031 protected: 00032 EQ_API WindowSystemIF(); 00033 virtual ~WindowSystemIF() {} 00034 00035 private: 00036 virtual std::string getName() const = 0; 00037 00038 virtual SystemWindow* createWindow(Window* window) const = 0; 00039 virtual SystemPipe* createPipe(Pipe* pipe) const = 0; 00040 virtual MessagePump* createMessagePump() const = 0; 00041 virtual bool setupFont( ObjectManager& gl, const void* key, 00042 const std::string& name, const uint32_t size ) const = 0; 00043 00044 virtual void configInit( Node* node ) {} 00045 virtual void configExit( Node* node ) {} 00046 00047 protected: 00048 static uint32_t _setupLists( ObjectManager& gl, const void* key, 00049 const int num ); 00050 00051 private: 00052 WindowSystemIF* _next; 00053 friend class WindowSystem; 00054 }; 00055 00056 #ifndef EQ_2_0_API 00057 enum WindowSystemEnum 00058 { 00059 WINDOW_SYSTEM_NONE = 0, // must be first 00060 WINDOW_SYSTEM_AGL, 00061 WINDOW_SYSTEM_GLX, 00062 WINDOW_SYSTEM_WGL, 00063 WINDOW_SYSTEM_ALL // must be last 00064 }; 00065 #endif 00066 00068 class WindowSystem 00069 { 00070 public: 00071 EQ_API WindowSystem(); 00072 EQ_API WindowSystem( std::string const& type ); 00073 #ifndef EQ_2_0_API 00074 EQ_API WindowSystem( const WindowSystemEnum type ); 00075 ~WindowSystem() {} 00076 00077 EQ_API bool operator == ( const WindowSystemEnum other ) const; 00078 EQ_API bool operator != ( const WindowSystemEnum other ) const; 00079 EQ_API operator WindowSystemEnum() const; 00080 #endif 00081 00082 static bool supports( std::string const& type ); 00083 00084 static void configInit( Node* node ); 00085 static void configExit( Node* node ); 00086 00087 EQ_API std::string getName() const; 00088 00089 EQ_API SystemWindow* createWindow( Window* window ) const; 00090 EQ_API SystemPipe* createPipe( Pipe* pipe ) const; 00091 EQ_API MessagePump* createMessagePump() const; 00092 EQ_API bool setupFont( ObjectManager& gl, const void* key, 00093 const std::string& name, const uint32_t size ) const; 00094 00095 EQ_API bool operator == ( const WindowSystem& other ) const; 00096 EQ_API bool operator != ( const WindowSystem& other ) const; 00097 00098 private: 00099 const WindowSystemIF* _impl; 00100 void _chooseImpl( const std::string& name ); 00101 }; 00102 00104 EQ_API std::ostream& operator << ( std::ostream& os, const WindowSystem& ); 00105 00107 EQ_API co::DataOStream& operator << ( co::DataOStream& os, const WindowSystem& ); 00108 00110 EQ_API co::DataIStream& operator >> ( co::DataIStream& is, WindowSystem& ws ); 00111 00112 } // namespace eq 00113 00114 #endif // EQ_WINDOWSYSTEM_H