copy stuff
fluxgen fluxgen
2 files changed,
31 insertions(+),
5 deletions(-)
M
src/FbTk/GContext.cc
→
src/FbTk/GContext.cc
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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,11 +43,19 @@ 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() { if (m_gc) XFreeGC(m_display, m_gc);@@ -57,5 +65,17 @@ /// not implemented!
//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
M
src/FbTk/GContext.hh
→
src/FbTk/GContext.hh
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ /// for FbTk drawable
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 @@ inline void setSubwindowMode(int mode) {
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; };