00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "GContext.hh"
00025
00026 #include "App.hh"
00027 #include "FbDrawable.hh"
00028 #include "FbPixmap.hh"
00029 #include "Color.hh"
00030 #include "Font.hh"
00031
00032 namespace FbTk {
00033
00034 Display *GContext::m_display = 0;
00035
00036 GContext::GContext(const FbTk::FbDrawable &drawable):
00037 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
00038 drawable.drawable(),
00039 0, 0)) {
00040 if (m_display == 0)
00041 m_display = FbTk::App::instance()->display();
00042
00043 setGraphicsExposure(false);
00044 }
00045
00046 GContext::GContext(Drawable drawable):
00047 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
00048 drawable,
00049 0, 0)) {
00050 if (m_display == 0)
00051 m_display = FbTk::App::instance()->display();
00052 setGraphicsExposure(false);
00053 }
00054
00055 GContext::GContext(Drawable d, const GContext &gc):
00056 m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
00057 d,
00058 0, 0)) {
00059 if (m_display == 0)
00060 m_display = FbTk::App::instance()->display();
00061 setGraphicsExposure(false);
00062 copy(gc);
00063 }
00064
00065 GContext::~GContext() {
00066 if (m_gc)
00067 XFreeGC(m_display, m_gc);
00068 }
00069
00071
00073
00074 void GContext::copy(GC gc) {
00075
00076 XCopyGC(m_display, gc, ~0, m_gc);
00077 }
00078
00079 void GContext::copy(const GContext &gc) {
00080
00081 copy(gc.gc());
00082
00084
00085 }
00086
00087 }