Commit d8fe66d4 by Jessica Hawkwell

moar functionaliteh

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