aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Texture.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Texture.hh')
-rw-r--r--src/FbTk/Texture.hh102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/FbTk/Texture.hh b/src/FbTk/Texture.hh
new file mode 100644
index 0000000..336086a
--- /dev/null
+++ b/src/FbTk/Texture.hh
@@ -0,0 +1,102 @@
1// Texture.hh for Fluxbox Window Manager
2// Copyright (c) 2002-2003 Henrik Kinnunen (fluxbox<at>users.sourceforge.net)
3//
4// from Image.hh for Blackbox - an X11 Window manager
5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
6//
7// Permission is hereby granted, free of charge, to any person obtaining a
8// copy of this software and associated documentation files (the "Software"),
9// to deal in the Software without restriction, including without limitation
10// the rights to use, copy, modify, merge, publish, distribute, sublicense,
11// and/or sell copies of the Software, and to permit persons to whom the
12// Software is furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in
15// all copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE.
24
25// $Id: Texture.hh,v 1.6 2003/12/16 17:06:52 fluxgen Exp $
26
27#ifndef FBTK_TEXTURE_HH
28#define FBTK_TEXTURE_HH
29
30#include "Color.hh"
31#include "FbPixmap.hh"
32
33namespace FbTk {
34
35/**
36 Holds texture type and info
37*/
38class Texture {
39public:
40
41 enum Bevel {
42 FLAT = 0x00002,
43 SUNKEN = 0x00004,
44 RAISED = 0x00008
45 };
46
47 enum Textures {
48 NONE = 0x00000,
49 SOLID = 0x00010,
50 GRADIENT = 0x00020
51 };
52
53 enum Gradients {
54 HORIZONTAL = 0x00040,
55 VERTICAL = 0x00080,
56 DIAGONAL = 0x00100,
57 CROSSDIAGONAL = 0x00200,
58 RECTANGLE = 0x00400,
59 PYRAMID = 0x00800,
60 PIPECROSS = 0x01000,
61 ELLIPTIC = 0x02000
62 };
63
64 enum {
65 BEVEL1 = 0x04000,
66 BEVEL2 = 0x08000, // bevel types
67 INVERT = 0x10000, ///< inverted image
68 PARENTRELATIVE = 0x20000,
69 INTERLACED = 0x40000,
70 TILED = 0x80000 ///< tiled pixmap
71 };
72
73 Texture():m_type(0) { }
74
75 void setType(unsigned long t) { m_type = t; }
76 void addType(unsigned long t) { m_type |= t; }
77 void setFromString(const char * const str);
78
79 Color &color() { return m_color; }
80 Color &colorTo() { return m_color_to; }
81 Color &hiColor() { return m_hicolor; }
82 Color &loColor() { return m_locolor; }
83
84 FbPixmap &pixmap() { return m_pixmap; }
85
86 const Color &color() const { return m_color; }
87 const Color &colorTo() const { return m_color_to; }
88 const Color &hiColor() const { return m_hicolor; }
89 const Color &loColor() const { return m_locolor; }
90 const FbTk::FbPixmap &pixmap() const { return m_pixmap; }
91 inline unsigned long type() const { return m_type; }
92 inline bool usePixmap() const { return !( type() == (FLAT | SOLID) && pixmap().drawable() == 0); }
93
94private:
95 FbTk::Color m_color, m_color_to, m_hicolor, m_locolor;
96 FbTk::FbPixmap m_pixmap;
97 unsigned long m_type;
98};
99
100} // end namespace FbTk
101
102#endif // FBTK_TEXTURE_HH