/* -*-c++-*- header - Open Producer - Copyright (C) 2002 Don Burns
 * Distributed under the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE (LGPL)
 * as published by the Free Software Foundation.
 */
#ifndef PRODUCER_WINDOW3D
#define PRODUCER_WINDOW3D 1

#include <Producer/Export>
#include <Producer/Referenced>

#include <string>

#include <Producer/KeyboardMouse>
#include <Producer/Trackball>

namespace Producer {

class PR_EXPORT Window3D : public Referenced
{
    public :
        class KeyboardCallback : public Referenced
        {
            public:
                KeyboardCallback() {}
                virtual void operator()(KeyCharacter) = 0;
            protected:
                virtual ~KeyboardCallback() {}
        };

        Window3D( 
            const std::string name="Producer::Window3D", 
            int posx = 0,
            int posy = 0,
            unsigned int width =(unsigned int)-1, 
            unsigned int height=(unsigned int)-1, 
            unsigned int parent=0 );

        unsigned int width( void ) const;
        unsigned int height( void ) const;
        void getDimensions( unsigned int &width, unsigned int &height );
        void swapBuffers( void );
        void sync( int n=0 );

        void setKeyboardCallback( KeyboardCallback *);
        int mouseX(void);
        int mouseY(void);
        unsigned int mouseButton(void);
        void enableTrackball( void );
        void disableTrackball( void );
        Matrix::value_type *getTrackballMatrix(void);
        void setTrackballScale( float s );

        Trackball &getTrackball();
    
        bool done();

        ~Window3D() ;

    private :

        // ensure that you can't copy Window3D.
        Window3D( const Window3D& ) : Referenced() {}
        Window3D& operator = ( const Window3D& ) { return *this;}

        class Implementation;
        Implementation *_implementation;
};

}

#endif

