src/Graphics/MessageView.hh
author Tero Marttila <terom@fixme.fi>
Wed, 21 Jan 2009 23:07:22 +0200
branchnew_graphics
changeset 412 721c60072091
parent 411 106aaf6eadfe
permissions -rw-r--r--
new graphics code compiles... no, it doesn't work yet
#ifndef GRAPHICS_MESSAGE_VIEW_HH
#define GRAPHICS_MESSAGE_VIEW_HH

#include "View.hh"

#include <ClanLib/display.h>
#include <string>
#include <vector>

namespace graphics
{

/**
 * Offset between consecutive lines
 */
const PixelDimension MESSAGE_VIEW_LINE_OFFSET = 5;

struct Message {
    CL_Color color;
    std::string message;

    Message (CL_Color color, std::string message) : color(color), message(message) { }
};

class MessageView : public View {
protected:
    std::vector<Message> messages;

public:
    /**
     * Define the area where messages are drawn
     */
    MessageView (const PixelArea &area);

    /**
     * Add a message to the list of messages displayed
     */
    void add_message (CL_Color color, std::string message);
    
    /**
     * Draw as many messages as fits
     */
    virtual void draw (Display &display);
};

}

#endif