]> Dogcows Code - chaz/openbox/blob - otk/rendertexture.hh
part of a hardcoded style done
[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 //! 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 secondary color for a gradient texture.
52 //! This is only defined for gradients
53 const RenderColor *_secondary_color;
54 //! The shadow color for the bevel. This must be defined if
55 //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
56 const RenderColor *_bevel_dark_color;
57 //! The light color for the bevel. This must be defined if
58 //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
59 const RenderColor *_bevel_light_color;
60 //! The color for the flat border if RenderTexture::_border is true. This
61 //! must be defined if it is true
62 const RenderColor *_border_color;
63 //! The color for the interlace lines if RenderTexture. This must be defined
64 //! if it is true
65 const RenderColor *_interlace_color;
66
67 public:
68 RenderTexture(bool parent_relative, ReliefType relief, BevelType bevel,
69 bool border, GradientType gradient, bool interlaced,
70 const RenderColor::RGB &color,
71 const RenderColor::RGB &secondary_color,
72 const RenderColor::RGB &bevel_dark_color,
73 const RenderColor::RGB &bevel_light_color,
74 const RenderColor::RGB &border_color,
75 const RenderColor::RGB &interlace_color)
76 : _parent_relative(parent_relative),
77 _relief(relief),
78 _bevel(bevel),
79 _border(border),
80 _gradient(gradient),
81 _interlaced(interlaced),
82 _color(new RenderColor(color)),
83 _secondary_color(new RenderColor(secondary_color)),
84 _bevel_dark_color(new RenderColor(bevel_dark_color)),
85 _bevel_light_color(new RenderColor(bevel_light_color)),
86 _border_color(new RenderColor(border_color)),
87 _interlace_color(new RenderColor(interlace_color))
88 {
89 assert(_relief == Flat || (_bevel_dark_color && _bevel_light_color));
90 assert(!_border || _border_color);
91 assert(!_interlaced || _interlace_color);
92 assert(_color);
93 }
94
95 virtual ~RenderTexture() {
96 delete _color;
97 delete _secondary_color;
98 delete _bevel_dark_color;
99 delete _bevel_light_color;
100 delete _border_color;
101 delete _interlace_color;
102 }
103
104 //! If true, the texture is not rendered at all, so all options are ignored
105 inline bool parentRelative() const { return _parent_relative; }
106 //! The relief type of the texture
107 inline ReliefType relief() const { return _relief; }
108 //! The way the bevel should be drawn
109 inline BevelType bevel() const { return _bevel; }
110 //! If a flat border is drawn on the outside, ignored for all ReliefType
111 //! values except ReliefType::Flat
112 inline bool border() const { return _border; }
113 //! The type of gradient to fill the texture with (if any)
114 inline GradientType gradient() const { return _gradient; }
115 //! If interlace lines should be drawn over the texture
116 inline bool interlaced() const { return _interlaced; }
117
118 //! The base color for the texture, the only color when the texture is solid.
119 //! This must always be defined
120 inline const RenderColor& color() const { return *_color; }
121 //! The secondary color for gradient textures.
122 //! This is only defined for gradients
123 inline const RenderColor& secondary_color() const
124 { return *_secondary_color; }
125 //! The shadow color for the bevel. This must be defined if
126 //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
127 inline const RenderColor& bevelDarkColor() const
128 { return *_bevel_dark_color; }
129 //! The light color for the bevel. This must be defined if
130 //! RenderTexture::)relief is not RenderTexture::ReliefType::Flat
131 inline const RenderColor& bevelLightColor() const
132 { return *_bevel_light_color; }
133 //! The color for the flat border if RenderTexture::_border is true. This
134 //! must be defined if it is true
135 inline const RenderColor& borderColor() const { return *_border_color; }
136 //! The color for the interlace lines if RenderTexture. This must be defined
137 //! if it is true
138 inline const RenderColor& interlaceColor() const
139 { return *_interlace_color; }
140 };
141
142 }
143
144 #endif // __rendertexture_hh
This page took 0.044314 seconds and 4 git commands to generate.