]> icculus.org git repositories - mikachu/openbox.git/blob - otk/surface.hh
add comments
[mikachu/openbox.git] / otk / surface.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __surface_hh
3 #define __surface_hh
4
5 #include "point.hh"
6 #include "truerendercontrol.hh"
7 #include "pseudorendercontrol.hh"
8
9 extern "C" {
10 #include <X11/Xlib.h>
11 #define _XFT_NO_COMPAT_ // no Xft 1 API
12 #include <X11/Xft/Xft.h>
13 }
14
15 namespace otk {
16
17 class ScreenInfo;
18 class RenderColor;
19
20 class Surface {
21   int _screen;
22   Point _size;
23   Pixmap _pixmap;
24   XftDraw *_xftdraw;
25
26 protected:
27   void createObjects();
28   void destroyObjects();
29
30   void setPixmap(XImage *image);
31   void setPixmap(const RenderColor &color);
32   
33 public:
34   Surface(int screen, const Point &size);
35   virtual ~Surface();
36
37   inline int screen(void) const { return _screen; }
38
39   virtual const Point& size() const { return _size; }
40   virtual int width() const { return _size.x(); }
41   virtual int height() const { return _size.y(); }
42
43   virtual Pixmap pixmap() const { return _pixmap; }
44
45   // The RenderControl classes use the internal objects in this class to render
46   // to it. Noone else needs them tho, so they are private.
47   friend class RenderControl;
48   friend class TrueRenderControl;
49   friend class PseudoRenderControl;
50 };
51
52 }
53
54 #endif // __surface_hh