Commit d8fe66d4 by Jessica Hawkwell

moar functionaliteh

1 parent 46910efe
......@@ -41,9 +41,12 @@ namespace nitrogen {
}
std::string* Object::toString() {
std::string* str;
str->append(getTypeName(this));
return str;
std::string* out
out->append(getTypeName(*this));
out->append("(");
out->append(std::to_string((uintptr_t)*this));
out->append(")");
return out;
}
Object& Object::operator()() {
......
......@@ -67,7 +67,7 @@ namespace nitrogen {
virtual void translate(int x, int y) = 0;
virtual void dispose() = 0;
virtual std::string* toString() = 0;
//virtual std::string* toString() = 0;
virtual Graphics& operator()() = 0;
virtual Graphics& operator=(Graphics& right) = 0;
//virtual bool operator!=(Graphics& right) = 0;
......
......@@ -37,10 +37,6 @@
namespace nitrogen {
namespace nwt {
// Xorg stuffies
Display* NativeGraphics::xdisp;
Drawable* NativeGraphics::xdraw;
GC* NativeGraphics::xgc;
NativeGraphics::NativeGraphics() {
mask = 0L;
......@@ -109,9 +105,7 @@ namespace nitrogen {
}
void NativeGraphics::drawString(std::string* str, int x, int y) {
char * cstr = new char [str->length()+1];
//char * basic = str->c_str();
XDrawString(xdisp, xdraw, xgc, x, y, str->c_str(), font->getSize());
XDrawString(xdisp, xdraw, xgc, x, y, str->c_str(), str->length());
}
void NativeGraphics::drawString(std::string& str, int x, int y) {
......@@ -165,5 +159,51 @@ namespace nitrogen {
void NativeGraphics::createClip() {
}
// overrides
NativeGraphics& NativeGraphics::operator()() {
NativeGraphics* ng = new NativeGraphics();
return ng;
}
NativeGraphics& NativeGraphics::operator=(NativeGraphics& right) {
if (*this != right) {
*mask = *right.mask;
cx = right.cx;
cy = right.cy;
tx = right.tx;
ty = right.ty;
width = right.width;
height = right.height;
*font = *right.font;
*color = *right.color;
*xdisp = *right.xdisp;
*xdraw = *right.xdraw;
*xgc = *right.xgc;
}
return *this;
}
//bool operator!=(Graphics& right)
bool NativeGraphics::operator==(NativeGraphics& right) {
if ( *mask != *right.mask ) { return false; }
if ( cx != right.cx ) { return false; }
if ( cy != right.cy ) { return false; }
if ( tx != right.tx ) { return false; }
if ( ty != right.ty ) { return false; }
if ( width != right.width ) { return false; }
if ( height != right.height ) { return false; }
if ( *font != *right.font ) { return false; }
if ( *color != *right.color ) { return false; }
if ( *xdisp != *right.xdisp ) { return false; }
if ( *xdraw != *right.xdraw ) { return false; }
if ( *xgc != *right.xgc ) { return false; }
return true;
}
}
}
......@@ -70,6 +70,12 @@ namespace nitrogen {
void translate(int x, int y) override;
void dispose() override;
//std::string* toString();
NativeGraphics& operator()() override;
NativeGraphics& operator=(NativeGraphics& right) override;
//bool operator!=(NativeGraphics& right);
bool operator==(NativeGraphics& right) override;
protected:
unsigned long mask;
int cx;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!