/**
 * $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 __DISPLAYHANDLERIMAGEDATA_H
#define __DISPLAYHANDLERIMAGEDATA_H

// Standard includes
#include <stdlib.h>

// iWear includes
#include <iwear_output_griffin/displayhandler.h>
#include <iwear_output_griffin/displayeventimagedata.h>

namespace iwear{
namespace output{

/**
 * @author Carsten Rachuy
 */
class DisplayHandlerImageData : public DisplayHandler {

 public:

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

    /**
     * Command for the handler to store the output data
     * supported internally and, if the application 
     * is the currently active one, display it
     */
    virtual void handle(OutputData* output_data);

    /**
     * Command for the handler to discard the
     * appropriate output data, throw it away and
     * stop updating the screen with it's content
     */
    virtual void discard(OutputData* output_data);

    /**
     * This method is called when a application switch
     * occured and has to be processed by the handler.
     */
    virtual void switch_focus_to(const uid& application_id);

    /**
     * The main 'display' method which blits the appropriate
     * data which should be displayed into the SDL_Surface provided
     */
    virtual void render(SDL_Surface* sdl_surface);

    /**
     * Return the number of output data objects this very module can
     * handle. We can display two images at the moment.
     */
    inline const uint32_t get_number_of_displayable_output_data(void){
	return 2;
    }

 private:

    /**
     * The currently to-be-displayed images
     */
    vector<SDL_Surface*> images;

    /**
     * A map from application_uid to pairs from SDL surfaces and data with the images
     * We use the vector, because we have to display more than one
     * image on the screen eventually
     */
    map<uid, vector < pair<ImageData*,SDL_Surface*> > > managed_applications;

};


} // namespace output
} // namespace iwear

#endif // __DISPLAYHANDLERIMAGEDATA_H
