]> git.tdb.fi Git - libs/gltk.git/blob - source/image.h
Improve widget part caching
[libs/gltk.git] / source / image.h
1 #ifndef MSP_GLTK_IMAGE_H_
2 #define MSP_GLTK_IMAGE_H_
3
4 #include <msp/gl/texture2d.h>
5 #include "widget.h"
6
7 namespace Msp {
8 namespace GLtk {
9
10 /**
11 A widget for displaying images.
12 */
13 class Image: public Widget
14 {
15 private:
16         const GL::Texture2D *image;
17         bool keep_aspect;
18
19 public:
20         Image(const GL::Texture2D * = 0);
21
22         virtual const char *get_class() const { return "image"; }
23
24         virtual void autosize();
25
26         void set_image(const GL::Texture2D *);
27         void set_keep_aspect(bool);
28
29 private:
30         virtual void rebuild_special(const Part &);
31 };
32
33 } // namespace GLtk
34 } // namespace Msp
35
36 #endif