]> icculus.org git repositories - mikachu/openbox.git/blob - otk/rendertexture.hh
drawSolidBackground seems to work :)
[mikachu/openbox.git] / otk / rendertexture.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __rendertexture_hh
3 #define __rendertexture_hh
4
5 #include "rendercolor.hh"
6
7 namespace otk {
8
9 //! Superclass for all the Textures
10 class RenderTexture {
11 public:
12   enum ReliefType {
13     Flat,
14     Raised,
15     Sunken
16   };
17   enum BevelType {
18     Bevel1,
19     Bevel2
20   };
21   enum GradientType {
22     Solid,
23     Horizontal,
24     Vertical,
25     Diagonal,
26     CrossDiagonal,
27     PipeCross,
28     Rectangle,
29     Pyramid,
30     Elliptic
31   };
32
33 private:
34   //! If true, the texture is not rendered at all, so all options are ignored
35   bool _parent_relative;
36   //! The relief type of the texture
37   ReliefType _relief;
38   //! The way the bevel should be drawn
39   BevelType _bevel;
40   //! If a flat border is drawn on the outside, ignored for all ReliefType
41   //! values except ReliefType::Flat
42   bool _border;
43   //! The type of gradient to fill the texture with (if any)
44   GradientType _gradient;
45   //! If interlace lines should be drawn over the texture
46   bool _interlaced;
47
48   //! The base color for the texture, the only color when the texture is solid.
49   //! This must always be defined
50   const RenderColor *_color;
51   //! The shadow color for the bevel. This must be defined if
52   //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
53   const RenderColor *_bevel_dark_color;
54   //! The light color for the bevel. This must be defined if
55   //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
56   const RenderColor *_bevel_light_color;
57   //! The color for the flat border if RenderTexture::_border is true. This
58   //! must be defined if it is true
59   const RenderColor *_border_color;
60   //! The color for the interlace lines if RenderTexture. This must be defined
61   //! if it is true
62   const RenderColor *_interlace_color;
63
64 public:
65   RenderTexture(bool parent_relative, ReliefType relief, BevelType bevel,
66                 bool border, GradientType gradient, bool interlaced,
67                 const RenderColor *color, const RenderColor *bevel_dark_color,
68                 const RenderColor *bevel_light_color,
69                 const RenderColor *border_color,
70                 const RenderColor *interlace_color)
71     : _parent_relative(parent_relative),
72       _relief(relief),
73       _bevel(bevel),
74       _border(border),
75       _gradient(gradient),
76       _interlaced(interlaced),
77       _color(color),
78       _bevel_dark_color(bevel_dark_color),
79       _bevel_light_color(bevel_light_color),
80       _border_color(border_color),
81       _interlace_color(interlace_color)
82     {
83       assert(_relief == Flat || (_bevel_dark_color && _bevel_light_color));
84       assert(!_border || _border_color);
85       assert(!_interlaced || _interlace_color);
86       assert(_color);
87     }
88
89   //! If true, the texture is not rendered at all, so all options are ignored
90   inline bool parentRelative() const { return _parent_relative; }
91   //! The relief type of the texture
92   inline ReliefType relief() const { return _relief; }
93   //! The way the bevel should be drawn
94   inline BevelType bevel() const { return _bevel; }
95   //! If a flat border is drawn on the outside, ignored for all ReliefType
96   //! values except ReliefType::Flat
97   inline bool border() const { return _border; }
98   //! The type of gradient to fill the texture with (if any)
99   inline GradientType gradient() const { return _gradient; }
100   //! If interlace lines should be drawn over the texture
101   inline bool interlaced() const { return _interlaced; }
102
103   //! The base color for the texture, the only color when the texture is solid.
104   //! This must always be defined
105   inline const RenderColor& color() const { return *_color; }
106   //! The shadow color for the bevel. This must be defined if
107   //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
108   inline const RenderColor& bevelDarkColor() const
109     { return *_bevel_dark_color; }
110   //! The light color for the bevel. This must be defined if
111   //! RenderTexture::)relief is not RenderTexture::ReliefType::Flat
112   inline const RenderColor& bevelLightColor() const
113     { return *_bevel_light_color; }
114   //! The color for the flat border if RenderTexture::_border is true. This
115   //! must be defined if it is true
116   inline const RenderColor& borderColor() const { return *_border_color; }
117   //! The color for the interlace lines if RenderTexture. This must be defined
118   //! if it is true
119   inline const RenderColor& interlaceColor() const
120     { return *_interlace_color; }
121 };
122
123 }
124
125 #endif // __rendertexture_hh