Debian Codegraph @

lib/Bitmap.hh

raw
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // Bitmap.hh for Blackbox - an X11 Window manager
3 // Copyright (c) 2001 - 2005 Sean 'Shaleh' Perry <[email protected]>
4 // Copyright (c) 1997 - 2000, 2002 - 2005
5 // Bradley T Hughes <bhughes at trolltech.com>
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 #ifndef __Bitmap_hh
26 #define __Bitmap_hh
27
28 #include "Util.hh"
29
30 namespace bt {
31
32 // forward declarations
33 class Bitmap;
34 class Display;
35 class Pen;
36 class Rect;
37
38 /*
39 Draws the specified bitmap with the specified pen on the specified
40 drawable in the specified area. Note: the bitmap will be drawn
41 using the color of the pen.
42 */
43 void drawBitmap(const Bitmap &bitmap, const Pen &pen,
44 ::Drawable drawable, const Rect &rect);
45
46 /*
47 The bitmap object. You can create custom bitmaps from raw data,
48 or use one of 5 standard bitmaps.
49 */
50 class Bitmap : public NoCopy {
51 public:
52 // standard bitmaps
53 static const Bitmap &leftArrow(unsigned int screen);
54 static const Bitmap &rightArrow(unsigned int screen);
55 static const Bitmap &upArrow(unsigned int screen);
56 static const Bitmap &downArrow(unsigned int screen);
57 static const Bitmap &checkMark(unsigned int screen);
58
59 inline Bitmap(void)
60 : _screen(~0u), _drawable(0ul), _width(0u), _height(0u)
61 { }
62 Bitmap(unsigned int scr, const unsigned char *data,
63 unsigned int w, unsigned int h);
64 ~Bitmap(void);
65
66 bool load(unsigned int scr, const unsigned char *data,
67 unsigned int w, unsigned int h);
68
69 inline unsigned int screen(void) const
70 { return _screen; }
71 inline ::Drawable drawable(void) const
72 { return _drawable; }
73 inline unsigned int width(void) const
74 { return _width; }
75 inline unsigned int height(void) const
76 { return _height; }
77
78 private:
79 unsigned int _screen;
80 ::Drawable _drawable;
81 unsigned int _width, _height;
82 };
83
84 } // namespace bt
85
86 #endif // __Bitmap_hh