diff options
Diffstat (limited to 'src/FbTk/GContext.hh')
-rw-r--r-- | src/FbTk/GContext.hh | 63 |
1 files changed, 48 insertions, 15 deletions
diff --git a/src/FbTk/GContext.hh b/src/FbTk/GContext.hh index 6175b2d..c192879 100644 --- a/src/FbTk/GContext.hh +++ b/src/FbTk/GContext.hh | |||
@@ -19,19 +19,20 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: GContext.hh,v 1.3 2003/09/11 19:57:38 fluxgen Exp $ | 22 | // $Id: GContext.hh,v 1.4 2003/10/09 16:48:09 rathnor Exp $ |
23 | 23 | ||
24 | #ifndef FBTK_GCONTEXT_HH | 24 | #ifndef FBTK_GCONTEXT_HH |
25 | #define FBTK_GCONTEXT_HH | 25 | #define FBTK_GCONTEXT_HH |
26 | 26 | ||
27 | #include "Color.hh" | ||
28 | #include "FbPixmap.hh" | ||
29 | |||
27 | #include <X11/Xlib.h> | 30 | #include <X11/Xlib.h> |
28 | 31 | ||
29 | namespace FbTk { | 32 | namespace FbTk { |
30 | 33 | ||
31 | class FbDrawable; | 34 | class FbDrawable; |
32 | class FbPixmap; | ||
33 | class Font; | 35 | class Font; |
34 | class Color; | ||
35 | 36 | ||
36 | /// wrapper for X GC | 37 | /// wrapper for X GC |
37 | class GContext { | 38 | class GContext { |
@@ -43,23 +44,55 @@ public: | |||
43 | 44 | ||
44 | virtual ~GContext(); | 45 | virtual ~GContext(); |
45 | 46 | ||
46 | void setForeground(const FbTk::Color &color); | 47 | inline void setForeground(const FbTk::Color &color) { |
47 | void setForeground(long pixel_value); | 48 | setForeground(color.pixel()); |
48 | void setBackground(const FbTk::Color &color); | 49 | } |
49 | void setBackground(long pixel_value); | 50 | |
51 | inline void setForeground(long pixel_value) { | ||
52 | XSetForeground(m_display, m_gc, | ||
53 | pixel_value); | ||
54 | } | ||
55 | |||
56 | inline void setBackground(const FbTk::Color &color) { | ||
57 | setBackground(color.pixel()); | ||
58 | } | ||
59 | |||
60 | inline void setBackground(long pixel_value) { | ||
61 | XSetBackground(m_display, m_gc, pixel_value); | ||
62 | } | ||
63 | |||
50 | /// not implemented | 64 | /// not implemented |
51 | void setFont(const FbTk::Font &font); | 65 | inline void setFont(const FbTk::Font &font) {} |
66 | |||
52 | /// set font id | 67 | /// set font id |
53 | void setFont(int fid); | 68 | inline void setFont(int fid) { |
54 | void setClipMask(const FbTk::FbPixmap &pm); | 69 | XSetFont(m_display, m_gc, fid); |
55 | void setClipOrigin(int x, int y); | 70 | } |
56 | void setGraphicsExposure(bool value); | 71 | |
57 | void setFunction(int func); | 72 | inline void setClipMask(const FbTk::FbPixmap &mask) { |
58 | void setSubwindowMode(int mode); | 73 | XSetClipMask(m_display, m_gc, mask.drawable()); |
74 | } | ||
75 | |||
76 | inline void setClipOrigin(int x, int y) { | ||
77 | XSetClipOrigin(m_display, m_gc, x, y); | ||
78 | } | ||
79 | |||
80 | inline void setGraphicsExposure(bool value) { | ||
81 | XSetGraphicsExposures(m_display, m_gc, value); | ||
82 | } | ||
83 | |||
84 | inline void setFunction(int func) { | ||
85 | XSetFunction(m_display, m_gc, func); | ||
86 | } | ||
87 | |||
88 | inline void setSubwindowMode(int mode) { | ||
89 | XSetSubwindowMode(m_display, m_gc, mode); | ||
90 | } | ||
59 | 91 | ||
60 | GC gc() const { return m_gc; } | 92 | inline GC gc() const { return m_gc; } |
61 | 93 | ||
62 | private: | 94 | private: |
95 | Display *m_display; // worth caching | ||
63 | GC m_gc; | 96 | GC m_gc; |
64 | }; | 97 | }; |
65 | 98 | ||