terom@410: #ifndef GRAPHICS_VIEW_HH terom@410: #define GRAPHICS_VIEW_HH terom@410: terom@410: #include "../Types.hh" terom@410: terom@410: namespace graphics terom@410: { terom@410: terom@410: /** terom@410: * A view is some area of the display that displays something terom@410: */ terom@410: class View : public Drawable { terom@410: protected: terom@410: /** terom@410: * The area of the screen that is ours to draw on terom@410: */ terom@410: PixelArea area; terom@410: terom@410: public: terom@410: /** terom@410: * Set the initial area that is drawn into terom@410: */ terom@410: View (const PixelArea &area) : terom@410: area(area) terom@410: { terom@410: terom@410: } terom@410: terom@410: /** terom@410: * Update the view area terom@410: */ terom@411: virtual void resize (const PixelArea &new_area) { terom@411: this->area = new_area; terom@411: } terom@411: terom@411: /** terom@411: * Get current width terom@411: */ terom@411: PixelDimension getWidth (void) const { terom@411: return area.right - area.left; terom@411: } terom@411: terom@411: /** terom@411: * Get current height terom@411: */ terom@411: PixelDimension getHeight (void) const { terom@411: return area.bottom - area.top; terom@410: } terom@410: }; terom@410: terom@410: } terom@410: terom@410: #endif