news download themes documentation links










GContext.cc

00001 // GContext.cc for FbTk - fluxbox toolkit
00002 // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
00003 //
00004 // Permission is hereby granted, free of charge, to any person obtaining a
00005 // copy of this software and associated documentation files (the "Software"),
00006 // to deal in the Software without restriction, including without limitation
00007 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 // and/or sell copies of the Software, and to permit persons to whom the
00009 // Software is furnished to do so, subject to the following conditions:
00010 //
00011 // The above copyright notice and this permission notice shall be included in
00012 // all copies or substantial portions of the Software.
00013 //
00014 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00017 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00019 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00020 // DEALINGS IN THE SOFTWARE.
00021 
00022 // $Id: GContext.cc,v 1.6 2004/01/09 01:19:48 fluxgen Exp $
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 //void GContext::setFont(const FbTk::Font &font) {
00073 //}
00074 void GContext::copy(GC gc) {
00075     // copy gc with mask: all
00076     XCopyGC(m_display, gc, ~0, m_gc);
00077 }
00078 
00079 void GContext::copy(const GContext &gc) {
00080     // copy X gc
00081     copy(gc.gc());
00082     
00084 
00085 }
00086 
00087 } // end namespace FbTk

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA