aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/GContext.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/GContext.cc')
-rw-r--r--src/FbTk/GContext.cc87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/FbTk/GContext.cc b/src/FbTk/GContext.cc
new file mode 100644
index 0000000..dae8fac
--- /dev/null
+++ b/src/FbTk/GContext.cc
@@ -0,0 +1,87 @@
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#include "Font.hh"
31
32namespace FbTk {
33
34Display *GContext::m_display = 0;
35
36GContext::GContext(const FbTk::FbDrawable &drawable):
37 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
38 drawable.drawable(),
39 0, 0)) {
40 if (m_display == 0)
41 m_display = FbTk::App::instance()->display();
42
43 setGraphicsExposure(false);
44}
45
46GContext::GContext(Drawable drawable):
47 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
48 drawable,
49 0, 0)) {
50 if (m_display == 0)
51 m_display = FbTk::App::instance()->display();
52 setGraphicsExposure(false);
53}
54
55GContext::GContext(Drawable d, const GContext &gc):
56 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
57 d,
58 0, 0)) {
59 if (m_display == 0)
60 m_display = FbTk::App::instance()->display();
61 setGraphicsExposure(false);
62 copy(gc);
63}
64
65GContext::~GContext() {
66 if (m_gc)
67 XFreeGC(m_display, m_gc);
68}
69
70/// not implemented!
71//void GContext::setFont(const FbTk::Font &font) {
72 //!! TODO
73//}
74void GContext::copy(GC gc) {
75 // copy gc with mask: all
76 XCopyGC(m_display, gc, ~0, m_gc);
77}
78
79void GContext::copy(const GContext &gc) {
80 // copy X gc
81 copy(gc.gc());
82
83 //!! TODO: copy our extended gcontext
84
85}
86
87} // end namespace FbTk