copy stuff
This commit is contained in:
parent
9f4d10256d
commit
f6fa266493
2 changed files with 31 additions and 5 deletions
|
@ -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,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 @@ 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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue