diff options
Diffstat (limited to 'src/FbTk/GContext.cc')
-rw-r--r-- | src/FbTk/GContext.cc | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/FbTk/GContext.cc b/src/FbTk/GContext.cc new file mode 100644 index 0000000..e0f66a4 --- /dev/null +++ b/src/FbTk/GContext.cc | |||
@@ -0,0 +1,81 @@ | |||
1 | // GContext.cc 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: GContext.cc,v 1.5 2003/11/28 22:50:55 fluxgen Exp $ | ||
23 | |||
24 | #include "GContext.hh" | ||
25 | |||
26 | #include "App.hh" | ||
27 | #include "FbDrawable.hh" | ||
28 | #include "FbPixmap.hh" | ||
29 | #include "Color.hh" | ||
30 | #include "Font.hh" | ||
31 | |||
32 | namespace FbTk { | ||
33 | |||
34 | GContext::GContext(const FbTk::FbDrawable &drawable): | ||
35 | m_display(FbTk::App::instance()->display()), | ||
36 | m_gc(XCreateGC(m_display, | ||
37 | drawable.drawable(), | ||
38 | 0, 0)) { | ||
39 | setGraphicsExposure(false); | ||
40 | } | ||
41 | |||
42 | GContext::GContext(Drawable drawable): | ||
43 | m_display(FbTk::App::instance()->display()), | ||
44 | m_gc(XCreateGC(m_display, | ||
45 | drawable, | ||
46 | 0, 0)) { | ||
47 | setGraphicsExposure(false); | ||
48 | } | ||
49 | |||
50 | GContext::GContext(Drawable d, const GContext &gc): | ||
51 | m_display(FbTk::App::instance()->display()), | ||
52 | m_gc(XCreateGC(m_display, | ||
53 | d, | ||
54 | 0, 0)) { | ||
55 | setGraphicsExposure(false); | ||
56 | copy(gc); | ||
57 | } | ||
58 | |||
59 | GContext::~GContext() { | ||
60 | if (m_gc) | ||
61 | XFreeGC(m_display, m_gc); | ||
62 | } | ||
63 | |||
64 | /// not implemented! | ||
65 | //void GContext::setFont(const FbTk::Font &font) { | ||
66 | //!! TODO | ||
67 | //} | ||
68 | void GContext::copy(GC gc) { | ||
69 | // copy gc with mask: all | ||
70 | XCopyGC(m_display, gc, ~0, m_gc); | ||
71 | } | ||
72 | |||
73 | void GContext::copy(const GContext &gc) { | ||
74 | // copy X gc | ||
75 | copy(gc.gc()); | ||
76 | |||
77 | //!! TODO: copy our extended gcontext | ||
78 | |||
79 | } | ||
80 | |||
81 | } // end namespace FbTk | ||