/* -*-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_INPUT_AREA
#define PRODUCER_INPUT_AREA

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

#include <vector>
#include <map>

#include <Producer/Types>

namespace Producer{

class RenderSurface;


class PR_EXPORT InputArea: public Referenced
{
    public:

        InputArea();

        //void    addInputRectangle( Producer::RenderSurface *rs, InputRectangle ir );
        void    addRenderSurface( Producer::RenderSurface *rs );
        bool    isRealized();
    
        int     getNumRenderSurfaces();
        RenderSurface *getRenderSurface(int index);

        int     getNumWindows();
        Window  getWindow(int index);
        
        void    normalizeMouseMotion( Window win, int mx, int my, float &nmx, float &nmy );
        void    transformMouseMotion( Window win, int mx, int my, float &nmx, float &nmy );

        void    normalizeXY( float &x, float &y );

        void    getExtents( float &minX, float &maxX, float &minY, float &maxY );
        void    getCenter( float &cx, float &cy );

    protected:

        virtual ~InputArea();

        std::vector<RenderSurface *> _mapdata;
        std::map<Window,RenderSurface *> _winmap;
        bool _init();
        bool _initialized;
        float _minX, _maxX, _minY, _maxY;
        bool    _waitForRealize();

};

}

#endif
