/* -*-c++-*- Producer - Copyright (C) 2001-2004  Don Burns
 *
 * This library is open source and may be redistributed and/or modified under
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * OpenSceneGraph Public License for more details.
 */

#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

