/**
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 * In particular this file is part of the Framework Griffin
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework 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 GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __LAYOUTMANAGER_H
#define __LAYOUTMANAGER_H

// Standard includes
#include <stdlib.h>

// iWear includes
#include <iwear/thread.h>
#include <iwear/threadlocked.h>
#include <iwear/uid.h>
#include <iwear_output_griffin/layoutinformation.h>

// Other includes
#include <SDL/SDL.h>


namespace iwear{
namespace output{

/**
 * @author Carsten Rachuy
 */
class LayoutManager : public ThreadLocked {

 public:

    /**
     * Constructor
     */
    LayoutManager(Configuration& configuration);
    
    /**
     * Destructor
     */
    virtual ~LayoutManager(void);

    /**
     * Add a data object
     */
    void add_data(const uid& application_id, const string& type);

    /**
     * Remove a data object
     */
    void remove_data(const uid& application_id, const string& type);

    /**
     * Generate Layout for an application / type pair
     */
    SDL_Rect* get_render_area(const uid& application_id, const string& type);

    /**
     * Get information on changed render areas
     */
    bool render_area_changed(const uid& application_id, const string& type);


 private:
    
    /**
     * Configuration
     */
    Configuration& configuration;

    /**
     * Registered applications
     */
    map<uid, LayoutInformation* > application_layouts;

    /**
     * Deafult
     */
    SDL_Rect* default_image_area;
    SDL_Rect* default_text_area;
    SDL_Rect* default_menu_area;
    SDL_Rect* default_widget_area;


};


} // namespace output
} // namespace iwear

#endif // __LAYOUTMANAGER_H

