]> Dogcows Code - chaz/openbox/blob - otk/rendertexture.hh
3b9d4baa61defb563eef36ee2453278693047930
[chaz/openbox] / 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 //! If a flat border is drawn on the outside, ignored for all ReliefType
39 //! values except ReliefType::Flat
40 bool _border;
41 //! The type of gradient to fill the texture with (if any)
42 GradientType _gradient;
43 //! If interlace lines should be drawn over the texture
44 bool _interlaced;
45
46 //! The base color for the texture, the only color when the texture is solid.
47 //! This must always be defined
48 const RenderColor *_color;
49 //! The shadow color for the bevel. This must be defined if
50 //! RenderTexture::relief is not RenderTexture::ReliefType::Flat
51 const RenderColor *_bevel_dark_color;
52 //! The light color for the bevel. This must be defined if
53 //! RenderTexture::relief is not RenderTexture::ReliefType::Flat
54 const RenderColor *_bevel_light_color;
55 //! The color for the flat border if RenderTexture::border is true. This must
56 //! be defined if it is true
57 const RenderColor *_border_color;
58
59 public:
60 RenderTexture(bool parent_relative, ReliefType relief, bool border,
61 GradientType gradient, bool interlaced,
62 const RenderColor *color, const RenderColor *bevel_dark_color,
63 const RenderColor *bevel_light_color,
64 const RenderColor *border_color)
65 : _parent_relative(parent_relative),
66 _relief(relief),
67 _border(border),
68 _gradient(gradient),
69 _interlaced(interlaced),
70 _color(color),
71 _bevel_dark_color(bevel_dark_color),
72 _bevel_light_color(bevel_light_color),
73 _border_color(border_color)
74 {
75 assert(_relief == Flat || (_bevel_dark_color && _bevel_light_color));
76 assert(!_border || _border_color);
77 assert(_color);
78 }
79
80 //! If true, the texture is not rendered at all, so all options are ignored
81 inline bool parentRelative() const { return _parent_relative; }
82 //! The relief type of the texture
83 inline ReliefType relief() const { return _relief; }
84 //! If a flat border is drawn on the outside, ignored for all ReliefType
85 //! values except ReliefType::Flat
86 inline bool border() const { return _border; }
87 //! The type of gradient to fill the texture with (if any)
88 inline GradientType gradient() const { return _gradient; }
89 //! If interlace lines should be drawn over the texture
90 inline bool interlaced() const { return _interlaced; }
91
92 //! The base color for the texture, the only color when the texture is solid.
93 //! This must always be defined
94 inline const RenderColor& color() const { return *_color; }
95 //! The shadow color for the bevel. This must be defined if
96 //! RenderTexture::relief is not RenderTexture::ReliefType::Flat
97 inline const RenderColor& bevelDarkColor() const
98 { return *_bevel_dark_color; }
99 //! The light color for the bevel. This must be defined if
100 //! RenderTexture::relief is not RenderTexture::ReliefType::Flat
101 inline const RenderColor& bevelLightColor() const
102 { return *_bevel_light_color; }
103 //! The color for the flat border if RenderTexture::border is true. This must
104 //! be defined if it is true
105 inline const RenderColor& borderColor() const { return *_border_color; }
106 };
107
108 }
109
110 #endif // __rendertexture_hh
This page took 0.036144 seconds and 4 git commands to generate.