src/Graphics/View.hh
author Tero Marttila <terom@fixme.fi>
Tue, 27 Jan 2009 00:27:05 +0200
branch0.1.1-pre
changeset 440 0ddae5a7282f
parent 413 7dddc163489a
permissions -rw-r--r--
create version 0.1.1 prerelease branch
#ifndef GRAPHICS_VIEW_HH
#define GRAPHICS_VIEW_HH

namespace graphics
{

class View;

}

#include "Drawable.hh"
#include "Display.hh"
#include "../Types.hh"

namespace graphics
{

/**
 * A view is some area of the display that displays something
 */
class View /* : public Drawable */ {
protected:
    /**
     * The area of the screen that is ours to draw on
     */
    PixelArea area;

public:
    /**
     * Set the initial area that is drawn into
     */
    View (const PixelArea &area) :
        area(area)
    {

    }

    /**
     * Draw into the view area
     */
    virtual void draw (Display &display) = 0;

    /**
     * Update the view area
     */
    virtual void resize (const PixelArea &new_area) {
        this->area = new_area;
    }

    /**
     * Get current width
     */
    PixelDimension getWidth (void) const {
        return area.right - area.left;
    }

    /**
     * Get current height
     */
    PixelDimension getHeight (void) const {
        return area.bottom - area.top;
    }
};

}

#endif