From f6fa2664931d7577780c22eb5a2e738f322ec360 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Fri, 28 Nov 2003 22:50:55 +0000 Subject: copy stuff --- src/FbTk/GContext.cc | 26 +++++++++++++++++++++++--- src/FbTk/GContext.hh | 10 ++++++++-- 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: GContext.cc,v 1.4 2003/10/09 16:48:09 rathnor Exp $ +// $Id: GContext.cc,v 1.5 2003/11/28 22:50:55 fluxgen Exp $ #include "GContext.hh" @@ -43,9 +43,17 @@ GContext::GContext(Drawable drawable): m_display(FbTk::App::instance()->display()), m_gc(XCreateGC(m_display, drawable, - 0, 0)) -{ + 0, 0)) { + setGraphicsExposure(false); +} + +GContext::GContext(Drawable d, const GContext &gc): + m_display(FbTk::App::instance()->display()), + m_gc(XCreateGC(m_display, + d, + 0, 0)) { setGraphicsExposure(false); + copy(gc); } GContext::~GContext() { @@ -57,5 +65,17 @@ GContext::~GContext() { //void GContext::setFont(const FbTk::Font &font) { //!! TODO //} +void GContext::copy(GC gc) { + // copy gc with mask: all + XCopyGC(m_display, gc, ~0, m_gc); +} + +void GContext::copy(const GContext &gc) { + // copy X gc + copy(gc.gc()); + + //!! TODO: copy our extended gcontext + +} } // 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: GContext.hh,v 1.4 2003/10/09 16:48:09 rathnor Exp $ +// $Id: GContext.hh,v 1.5 2003/11/28 22:50:55 fluxgen Exp $ #ifndef FBTK_GCONTEXT_HH #define FBTK_GCONTEXT_HH @@ -41,7 +41,7 @@ public: explicit GContext(const FbTk::FbDrawable &drawable); /// for X drawable explicit GContext(Drawable drawable); - + GContext(Drawable d, const FbTk::GContext &gc); virtual ~GContext(); inline void setForeground(const FbTk::Color &color) { @@ -89,9 +89,15 @@ public: XSetSubwindowMode(m_display, m_gc, mode); } + void copy(GC gc); + void copy(const GContext &gc); + inline GContext &operator = (const GContext ©_gc) { copy(copy_gc); return *this; } + inline GContext &operator = (GC copy_gc) { copy(copy_gc); return *this; } inline GC gc() const { return m_gc; } private: + GContext(const GContext &cont); + Display *m_display; // worth caching GC m_gc; }; -- cgit v0.11.2