diff options
author | Henrik Kinnunen <fluxgen@fluxbox.org> | 2007-10-17 16:02:07 (GMT) |
---|---|---|
committer | Henrik Kinnunen <fluxgen@fluxbox.org> | 2007-10-17 16:02:07 (GMT) |
commit | 48e3a31cab2c6b515c26e69878f606a6d4d6df6f (patch) | |
tree | 976a0798689d3aa51548f422a41f35240807e354 /src/FbTk/GContext.cc | |
download | fbpager-48e3a31cab2c6b515c26e69878f606a6d4d6df6f.zip fbpager-48e3a31cab2c6b515c26e69878f606a6d4d6df6f.tar.bz2 |
initial commit
Diffstat (limited to 'src/FbTk/GContext.cc')
-rw-r--r-- | src/FbTk/GContext.cc | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/FbTk/GContext.cc b/src/FbTk/GContext.cc new file mode 100644 index 0000000..71f03e1 --- /dev/null +++ b/src/FbTk/GContext.cc | |||
@@ -0,0 +1,86 @@ | |||
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.6 2004/01/09 01:19:48 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 | |||
31 | namespace FbTk { | ||
32 | |||
33 | Display *GContext::m_display = 0; | ||
34 | |||
35 | GContext::GContext(const FbTk::FbDrawable &drawable): | ||
36 | m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(), | ||
37 | drawable.drawable(), | ||
38 | 0, 0)) { | ||
39 | if (m_display == 0) | ||
40 | m_display = FbTk::App::instance()->display(); | ||
41 | |||
42 | setGraphicsExposure(false); | ||
43 | } | ||
44 | |||
45 | GContext::GContext(Drawable drawable): | ||
46 | m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(), | ||
47 | drawable, | ||
48 | 0, 0)) { | ||
49 | if (m_display == 0) | ||
50 | m_display = FbTk::App::instance()->display(); | ||
51 | setGraphicsExposure(false); | ||
52 | } | ||
53 | |||
54 | GContext::GContext(Drawable d, const GContext &gc): | ||
55 | m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(), | ||
56 | d, | ||
57 | 0, 0)) { | ||
58 | if (m_display == 0) | ||
59 | m_display = FbTk::App::instance()->display(); | ||
60 | setGraphicsExposure(false); | ||
61 | copy(gc); | ||
62 | } | ||
63 | |||
64 | GContext::~GContext() { | ||
65 | if (m_gc) | ||
66 | XFreeGC(m_display, m_gc); | ||
67 | } | ||
68 | |||
69 | /// not implemented! | ||
70 | //void GContext::setFont(const FbTk::Font &font) { | ||
71 | //!! TODO | ||
72 | //} | ||
73 | void GContext::copy(GC gc) { | ||
74 | // copy gc with mask: all | ||
75 | XCopyGC(m_display, gc, ~0, m_gc); | ||
76 | } | ||
77 | |||
78 | void GContext::copy(const GContext &gc) { | ||
79 | // copy X gc | ||
80 | copy(gc.gc()); | ||
81 | |||
82 | //!! TODO: copy our extended gcontext | ||
83 | |||
84 | } | ||
85 | |||
86 | } // end namespace FbTk | ||