diff options
author | Sebastian Geerken <devnull@localhost> | 2013-09-15 14:59:06 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-09-15 14:59:06 +0200 |
commit | 2435de82b60cadb0283ef1636fbe078cf2beac0f (patch) | |
tree | 479915a54287c33e349912227b9c9944dd640586 /dw/style.hh | |
parent | 0ab5863987ec411ebf1ead15ff64de4b7766666e (diff) |
Very simple implementation of ExternalImgRenderer (used to immediately draw imgbuf updates); concretization for widgets.
Diffstat (limited to 'dw/style.hh')
-rw-r--r-- | dw/style.hh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/dw/style.hh b/dw/style.hh index c09a52f0..217ed4b8 100644 --- a/dw/style.hh +++ b/dw/style.hh @@ -723,6 +723,48 @@ private: ~StyleImage (); public: + /** + * \brief Useful (but not mandatory) base class for updates of + * areas with background images. + */ + class ExternalImgRenderer: public ImgRenderer + { + public: + void setBuffer (core::Imgbuf *buffer, bool resize); + void drawRow (int row); + + /** + * \brief If this method returns false, nothing is done at all. + */ + virtual bool readyToDraw () = 0; + + /** + * \brief Return the total area this background image is + * attached to, in canvas coordinates. + */ + virtual void getArea (int *x, int *y, int *width, int *height) = 0; + + /** + * \brief Return the "reference area". + * + * See comment of "drawBackground". + */ + virtual void getRefArea (int *xRef, int *yRef, int *widthRef, + int *heightRef) = 0; + + + /** + * \brief Return the style this background image is part of. + */ + virtual Style *getStyle () = 0; + + /** + * \brief Draw (or queue for drawing) an area, which is given in + * canvas coordinates. + */ + virtual void draw (int x, int y, int width, int height) = 0; + }; + static StyleImage *create () { return new StyleImage (); } inline void ref () { refCount++; } @@ -731,6 +773,19 @@ public: inline Imgbuf *getImgbuf () { return imgbuf; } inline ImgRenderer *getMainImgRenderer () { return imgRendererDist; } + + /** + * \brief Add an additional ImgRenderer, especially used for + * drawing. + */ + inline void putExternalImgRenderer (ImgRenderer *ir) + { imgRendererDist->put (ir); } + + /** + * \brief Remove a previously added additional ImgRenderer. + */ + inline void removeExternalImgRenderer (ImgRenderer *ir) + { imgRendererDist->remove (ir); } }; void drawBorder (View *view, Layout *layout, Rectangle *area, |