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

#include "Drawable.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)
    {

    }

    /**
     * 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