00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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 ©_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;
00108 GC m_gc;
00109 };
00110
00111 }
00112
00113 #endif // FBTK_GCONTEXT_HH