diff options
Diffstat (limited to 'src/FbTk/FbPixmap.hh')
-rw-r--r-- | src/FbTk/FbPixmap.hh | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh new file mode 100644 index 0000000..94d37de --- /dev/null +++ b/src/FbTk/FbPixmap.hh | |||
@@ -0,0 +1,76 @@ | |||
1 | // FbPixmap.hh for FbTk - Fluxbox ToolKit | ||
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: FbPixmap.hh,v 1.4 2003/04/29 08:52:51 fluxgen Exp $ | ||
23 | |||
24 | #ifndef FBTK_FBPIXMAP_HH | ||
25 | #define FBTK_FBPIXMAP_HH | ||
26 | |||
27 | #include "FbDrawable.hh" | ||
28 | |||
29 | #include <X11/Xlib.h> | ||
30 | |||
31 | namespace FbTk { | ||
32 | |||
33 | /// a wrapper for X Pixmap | ||
34 | class FbPixmap:public FbDrawable { | ||
35 | public: | ||
36 | FbPixmap(); | ||
37 | /// copy pixmap | ||
38 | explicit FbPixmap(const FbPixmap ©); | ||
39 | /// creates a FbPixmap from X pixmap | ||
40 | explicit FbPixmap(Pixmap pm); | ||
41 | FbPixmap(Drawable src, | ||
42 | unsigned int width, unsigned int height, | ||
43 | int depth); | ||
44 | |||
45 | ~FbPixmap(); | ||
46 | |||
47 | void copy(const FbPixmap &the_copy); | ||
48 | /// scales the pixmap to specified size | ||
49 | void scale(unsigned int width, unsigned int height); | ||
50 | /// drops pixmap and returns it | ||
51 | Pixmap release(); | ||
52 | |||
53 | FbPixmap &operator = (const FbPixmap ©); | ||
54 | /// sets new pixmap | ||
55 | FbPixmap &operator = (Pixmap pm); | ||
56 | |||
57 | inline Drawable drawable() const { return m_pm; } | ||
58 | inline unsigned int width() const { return m_width; } | ||
59 | inline unsigned int height() const { return m_height; } | ||
60 | inline int depth() const { return m_depth; } | ||
61 | |||
62 | |||
63 | private: | ||
64 | void free(); | ||
65 | void create(Drawable src, | ||
66 | unsigned int width, unsigned int height, | ||
67 | int depth); | ||
68 | Pixmap m_pm; | ||
69 | int m_depth; | ||
70 | unsigned int m_width, m_height; | ||
71 | }; | ||
72 | |||
73 | }; // end namespace FbTk | ||
74 | |||
75 | #endif // FBTK_FBPIXMAP_HH | ||
76 | |||