summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbTk/GContext.cc26
-rw-r--r--src/FbTk/GContext.hh10
2 files changed, 31 insertions, 5 deletions
diff --git a/src/FbTk/GContext.cc b/src/FbTk/GContext.cc
index 6b41726..e0f66a4 100644
--- a/src/FbTk/GContext.cc
+++ b/src/FbTk/GContext.cc
@@ -19,7 +19,7 @@
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.cc,v 1.4 2003/10/09 16:48:09 rathnor Exp $ 22// $Id: GContext.cc,v 1.5 2003/11/28 22:50:55 fluxgen Exp $
23 23
24#include "GContext.hh" 24#include "GContext.hh"
25 25
@@ -43,9 +43,17 @@ GContext::GContext(Drawable drawable):
43 m_display(FbTk::App::instance()->display()), 43 m_display(FbTk::App::instance()->display()),
44 m_gc(XCreateGC(m_display, 44 m_gc(XCreateGC(m_display,
45 drawable, 45 drawable,
46 0, 0)) 46 0, 0)) {
47{ 47 setGraphicsExposure(false);
48}
49
50GContext::GContext(Drawable d, const GContext &gc):
51 m_display(FbTk::App::instance()->display()),
52 m_gc(XCreateGC(m_display,
53 d,
54 0, 0)) {
48 setGraphicsExposure(false); 55 setGraphicsExposure(false);
56 copy(gc);
49} 57}
50 58
51GContext::~GContext() { 59GContext::~GContext() {
@@ -57,5 +65,17 @@ GContext::~GContext() {
57//void GContext::setFont(const FbTk::Font &font) { 65//void GContext::setFont(const FbTk::Font &font) {
58 //!! TODO 66 //!! TODO
59//} 67//}
68void GContext::copy(GC gc) {
69 // copy gc with mask: all
70 XCopyGC(m_display, gc, ~0, m_gc);
71}
72
73void GContext::copy(const GContext &gc) {
74 // copy X gc
75 copy(gc.gc());
76
77 //!! TODO: copy our extended gcontext
78
79}
60 80
61} // end namespace FbTk 81} // end namespace FbTk
diff --git a/src/FbTk/GContext.hh b/src/FbTk/GContext.hh
index c192879..3f01b8c 100644
--- a/src/FbTk/GContext.hh
+++ b/src/FbTk/GContext.hh
@@ -19,7 +19,7 @@
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.4 2003/10/09 16:48:09 rathnor Exp $ 22// $Id: GContext.hh,v 1.5 2003/11/28 22:50:55 fluxgen Exp $
23 23
24#ifndef FBTK_GCONTEXT_HH 24#ifndef FBTK_GCONTEXT_HH
25#define FBTK_GCONTEXT_HH 25#define FBTK_GCONTEXT_HH
@@ -41,7 +41,7 @@ public:
41 explicit GContext(const FbTk::FbDrawable &drawable); 41 explicit GContext(const FbTk::FbDrawable &drawable);
42 /// for X drawable 42 /// for X drawable
43 explicit GContext(Drawable drawable); 43 explicit GContext(Drawable drawable);
44 44 GContext(Drawable d, const FbTk::GContext &gc);
45 virtual ~GContext(); 45 virtual ~GContext();
46 46
47 inline void setForeground(const FbTk::Color &color) { 47 inline void setForeground(const FbTk::Color &color) {
@@ -89,9 +89,15 @@ public:
89 XSetSubwindowMode(m_display, m_gc, mode); 89 XSetSubwindowMode(m_display, m_gc, mode);
90 } 90 }
91 91
92 void copy(GC gc);
93 void copy(const GContext &gc);
94 inline GContext &operator = (const GContext &copy_gc) { copy(copy_gc); return *this; }
95 inline GContext &operator = (GC copy_gc) { copy(copy_gc); return *this; }
92 inline GC gc() const { return m_gc; } 96 inline GC gc() const { return m_gc; }
93 97
94private: 98private:
99 GContext(const GContext &cont);
100
95 Display *m_display; // worth caching 101 Display *m_display; // worth caching
96 GC m_gc; 102 GC m_gc;
97}; 103};