]> Dogcows Code - chaz/openbox/blob - src/Texture.hh
sync with bb-cvs.
[chaz/openbox] / src / Texture.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // Texture.hh for Blackbox - an X11 Window manager
3 // Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry <shaleh at debian.org>
4 // Copyright (c) 1997 - 2000, 2002 Bradley T Hughes <bhughes at trolltech.com>
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a
7 // copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 // DEALINGS IN THE SOFTWARE.
23
24 #ifndef TEXTURE_HH
25 #define TEXTURE_HH
26
27 #include "Color.hh"
28 #include "Util.hh"
29 class BImageControl;
30
31 #include <string>
32
33 class BTexture {
34 public:
35 enum Type {
36 // bevel options
37 Flat = (1l<<0),
38 FlatBorder = (1l<<1),
39 Sunken = (1l<<2),
40 Raised = (1l<<3),
41 // textures
42 Solid = (1l<<4),
43 Gradient = (1l<<5),
44 // gradients
45 Horizontal = (1l<<6),
46 Vertical = (1l<<7),
47 Diagonal = (1l<<8),
48 CrossDiagonal = (1l<<9),
49 Rectangle = (1l<<10),
50 Pyramid = (1l<<11),
51 PipeCross = (1l<<12),
52 Elliptic = (1l<<13),
53 // bevel types
54 Bevel1 = (1l<<14),
55 Bevel2 = (1l<<15),
56 // inverted image
57 Invert = (1l<<16),
58 // parent relative image
59 Parent_Relative = (1l<<17),
60 // fake interlaced image
61 Interlaced = (1l<<18)
62 };
63
64 BTexture(const BaseDisplay * const _display = 0,
65 unsigned int _screen = ~(0u), BImageControl* _ctrl = 0);
66 BTexture(const std::string &_description,
67 const BaseDisplay * const _display = 0,
68 unsigned int _screen = ~(0u), BImageControl* _ctrl = 0);
69
70 void setColor(const BColor &_color);
71 void setColorTo(const BColor &_colorTo) { ct = _colorTo; }
72
73 const BColor &color(void) const { return c; }
74 const BColor &colorTo(void) const { return ct; }
75 const BColor &lightColor(void) const { return lc; }
76 const BColor &shadowColor(void) const { return sc; }
77
78 unsigned long texture(void) const { return t; }
79 void setTexture(const unsigned long _texture) { t = _texture; }
80 void addTexture(const unsigned long _texture) { t |= _texture; }
81
82 BTexture &operator=(const BTexture &tt);
83 inline bool operator==(const BTexture &tt)
84 { return (c == tt.c && ct == tt.ct && lc == tt.lc &&
85 sc == tt.sc && t == tt.t); }
86 inline bool operator!=(const BTexture &tt)
87 { return (! operator==(tt)); }
88
89 const BaseDisplay *display(void) const { return dpy; }
90 unsigned int screen(void) const { return scrn; }
91 void setDisplay(const BaseDisplay * const _display,
92 const unsigned int _screen);
93 void setImageControl(BImageControl* _ctrl) { ctrl = _ctrl; }
94 const std::string &description(void) const { return descr; }
95 void setDescription(const std::string &d);
96
97 Pixmap render(const unsigned int width, const unsigned int height,
98 const Pixmap old = 0);
99
100 private:
101 BColor c, ct, lc, sc;
102 std::string descr;
103 unsigned long t;
104 const BaseDisplay *dpy;
105 BImageControl *ctrl;
106 unsigned int scrn;
107 };
108
109 #endif // TEXTURE_HH
This page took 0.03939 seconds and 4 git commands to generate.