news download themes documentation links










GContext.hh

00001 // GContext.hh 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.hh,v 1.8 2004/01/11 12:53:46 fluxgen Exp $
00023 
00024 #ifndef FBTK_GCONTEXT_HH
00025 #define FBTK_GCONTEXT_HH
00026 
00027 #include "Color.hh"
00028 #include "FbPixmap.hh"
00029 
00030 #include <X11/Xlib.h>
00031 
00032 namespace FbTk {
00033 
00034 class FbDrawable;
00035 class Font;
00036 
00038 class GContext {
00039 public:
00041     explicit GContext(const FbTk::FbDrawable &drawable);
00043     explicit GContext(Drawable drawable);
00044     GContext(Drawable d, const FbTk::GContext &gc);
00045     virtual ~GContext();
00046 
00047     inline void setForeground(const FbTk::Color &color) {
00048         setForeground(color.pixel());
00049     }
00050 
00051     inline void setForeground(long pixel_value) {
00052         XSetForeground(m_display, m_gc,
00053                        pixel_value);
00054     }
00055 
00056     inline void setBackground(const FbTk::Color &color) {
00057         setBackground(color.pixel());
00058     }
00059 
00060     inline void setBackground(long pixel_value) {
00061         XSetBackground(m_display, m_gc, pixel_value);
00062     }
00063 
00065     inline void setFont(const FbTk::Font &) {}
00066 
00068     inline void setFont(int fid) {
00069         XSetFont(m_display, m_gc, fid);
00070     }
00071 
00072     inline void setClipMask(const FbTk::FbPixmap &mask) {
00073         XSetClipMask(m_display, m_gc, mask.drawable());
00074     }
00075 
00076     inline void setClipOrigin(int x, int y) {
00077         XSetClipOrigin(m_display, m_gc, x, y);
00078     }
00079 
00080     inline void setGraphicsExposure(bool value) {
00081         XSetGraphicsExposures(m_display, m_gc, value);
00082     }
00083 
00084     inline void setFunction(int func) {
00085         XSetFunction(m_display, m_gc, func);
00086     }
00087 
00088     inline void setSubwindowMode(int mode) {
00089         XSetSubwindowMode(m_display, m_gc, mode);
00090     }
00091     inline void setFillStyle(int style) {
00092         XSetFillStyle(m_display, m_gc, style);
00093     }
00094     inline void setFillRule(int rule) {
00095         XSetFillRule(m_display, m_gc, rule);
00096     }
00097 
00098     void copy(GC gc);
00099     void copy(const GContext &gc);
00100     inline GContext &operator = (const GContext &copy_gc) { copy(copy_gc); return *this; }
00101     inline GContext &operator = (GC copy_gc) { copy(copy_gc); return *this; }
00102     inline GC gc() const { return m_gc; }
00103 
00104 private:
00105     GContext(const GContext &cont);
00106 
00107     static Display *m_display; // worth caching
00108     GC m_gc;
00109 };
00110 
00111 } // end namespace FbTk
00112 
00113 #endif // FBTK_GCONTEXT_HH

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