LCOV - code coverage report
Current view: top level - eq - windowSystem.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 4 4 100.0 %
Date: 2016-03-29 17:14:22 Functions: 4 5 80.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2006-2014, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *                    2011, Daniel Pfeifer <daniel@pfeifer-mail.de>
       4             :  *                    2014, Daniel Nachbaur <danielnachbaur@gmail.com>
       5             :  *
       6             :  * This library is free software; you can redistribute it and/or modify it under
       7             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       8             :  * by the Free Software Foundation.
       9             :  *
      10             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      11             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      12             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      13             :  * details.
      14             :  *
      15             :  * You should have received a copy of the GNU Lesser General Public License
      16             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      17             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      18             :  */
      19             : 
      20             : #ifndef EQ_WINDOWSYSTEM_H
      21             : #define EQ_WINDOWSYSTEM_H
      22             : 
      23             : #include <eq/api.h>
      24             : #include <eq/types.h>
      25             : 
      26             : namespace eq
      27             : {
      28             : 
      29             : /**
      30             :  * The interface for windowing toolkits.
      31             :  *
      32             :  * This class is intended to be overwritten by an (anonymous) class with exactly
      33             :  * one static instance. The constructor will register this factory instance for
      34             :  * use with the WindowSystem frontend. See glx/windowSystem.cpp for an example.
      35             :  *
      36             :  * The implementation provides access to operating system dependent
      37             :  * functionality needed by Equalizer, and hides these specifics behind
      38             :  * interfaces.
      39             :  */
      40             : class WindowSystemIF
      41             : {
      42             : public:
      43             :     /** Destroy the window system instance. @version 1.6 */
      44          40 :     virtual ~WindowSystemIF() {}
      45             : 
      46             : protected:
      47             :     /** Create a new window system instance. @version 1.6 */
      48             :     EQ_API WindowSystemIF();
      49             : 
      50             :     /** @internal */
      51             :     static uint32_t _setupLists( util::ObjectManager& gl, const void* key,
      52             :                                  const int num );
      53             : 
      54             :     /** @return the unique name of the window system. @version 1.6 */
      55             :     virtual std::string getName() const = 0;
      56             : 
      57             :     /** @return a new system pipe. @version 1.6 */
      58             :     virtual SystemPipe* createPipe( Pipe* pipe ) = 0;
      59             : 
      60             :     /** @return a new event message pump @version 1.6 */
      61             :     virtual MessagePump* createMessagePump() = 0;
      62             : 
      63             :     /** @return a new system window @version 1.7.2 */
      64             :     virtual SystemWindow* createWindow( Window* window,
      65             :                                         const WindowSettings& settings ) = 0;
      66             : 
      67             :     /**
      68             :      * Create a set of display lists for the given font.
      69             :      *
      70             :      * The implementation is expected to set up one display list per ASCII
      71             :      * character, and store the name of the first list in the given object
      72             :      * manager using the given key.
      73             :      *
      74             :      * @param gl the object manager for display list allocation.
      75             :      * @param key the key for display list allocation.
      76             :      * @param name the name of the font, OS-specific.
      77             :      * @param size the font size in points.
      78             :      * @return true if the font was created, false otherwise.
      79             :      * @warning experimental, might not be supported in the future.
      80             :      */
      81             :     virtual bool setupFont( util::ObjectManager& gl, const void* key,
      82             :                             const std::string& name,
      83             :                             const uint32_t size ) const = 0;
      84             : 
      85             :     /** Perform per-process initialization for a Config. @version 1.6 */
      86          54 :     virtual void configInit( Node* /*node*/ ) {}
      87             : 
      88             :     /** Perform per-process de-initialization for a Config. @version 1.6 */
      89          54 :     virtual void configExit( Node* /*node*/ ) {}
      90             : 
      91             :     /**
      92             :      * @return true if events have to be dispatched in the main thread.
      93             :      * @version 1.7.4
      94             :      */
      95          75 :     virtual bool hasMainThreadEvents() const { return false; }
      96             : 
      97             : private:
      98             :     WindowSystemIF* _next;
      99             :     friend class WindowSystem;
     100             : };
     101             : 
     102             : /** @internal
     103             :  * Access to the instantiated window systems.
     104             :  * @sa Pipe::getWindowSystem()
     105             :  */
     106             : class WindowSystem
     107             : {
     108             : public:
     109             :     EQ_API explicit WindowSystem( const std::string& name );
     110             : 
     111             :     static bool supports( const std::string& type );
     112             : 
     113             :     static void configInit( Node* node );
     114             :     static void configExit( Node* node );
     115             : 
     116             :     EQ_API std::string getName() const;
     117             : 
     118             :     EQ_API SystemWindow* createWindow( Window* window,
     119             :                                        const WindowSettings& settings );
     120             :     EQ_API SystemPipe* createPipe( Pipe* pipe );
     121             :     EQ_API MessagePump* createMessagePump();
     122             :     EQ_API bool setupFont( util::ObjectManager& gl, const void* key,
     123             :                            const std::string& name, const uint32_t size ) const;
     124             :     EQ_API bool hasMainThreadEvents() const;
     125             : 
     126             :     EQ_API bool operator == ( const WindowSystem& other ) const;
     127             :     EQ_API bool operator != ( const WindowSystem& other ) const;
     128             : 
     129             : private:
     130             :     WindowSystem();
     131             :     WindowSystemIF* _impl;
     132             :     void _chooseImpl( const std::string& name );
     133             : };
     134             : 
     135             : /** Print the window system name to the given output stream. @version 1.0 */
     136             : EQ_API std::ostream& operator << ( std::ostream& os, const WindowSystem& );
     137             : 
     138             : /** co::Object serializer. @version 1.1.3 */
     139             : EQ_API co::DataOStream& operator << ( co::DataOStream& os, const WindowSystem& );
     140             : 
     141             : /** WindowSystem deserializer. @version 1.1.3 */
     142             : EQ_API co::DataIStream& operator >> ( co::DataIStream& is, WindowSystem& ws );
     143             : 
     144             : } // namespace eq
     145             : 
     146             : #endif // EQ_WINDOWSYSTEM_H

Generated by: LCOV version 1.11