diff --git a/bindgen.cc b/bindgen.cc index 7b69b30..9f97968 100644 --- a/bindgen.cc +++ b/bindgen.cc @@ -494,8 +494,6 @@ static std::string function_source(xl_node_t* node) { std::string str = get_ctype(type, 0); strm << "return new " + str.substr(0, str.size() - 1) + "("; - } else if(type.type == "string") { - strm << "const char* _ret = "; } else { strm << "return (" + get_ctype(type, 0) + ")"; } @@ -544,13 +542,6 @@ static std::string function_source(xl_node_t* node) { if(widget != NULL) strm << ", " + std::string(xl_get_attribute(widget, "name")); } strm << ");" << std::endl; - if(ret != NULL && type.type == "string") { - strm << "#ifdef MWCXX_USE_C_STRING" << std::endl; - strm << " return _ret;" << std::endl; - strm << "#else" << std::endl; - strm << " return MwCXX::String(_ret);" << std::endl; - strm << "#endif" << std::endl; - } strm << "}" << std::endl; return strm.str(); diff --git a/include/MwCXX/MachDep.h b/include/MwCXX/MachDep.h index 3e9ec4c..0d16c52 100644 --- a/include/MwCXX/MachDep.h +++ b/include/MwCXX/MachDep.h @@ -6,7 +6,7 @@ #include #include -#define MWCXX_USE_C_STRING +// #define MWCXX_USE_C_STRING namespace MwCXX { #ifdef MWCXX_USE_C_STRING diff --git a/include/MwCXX/Widget/Base.h b/include/MwCXX/Widget/Base.h index ac9dd9d..42ea740 100644 --- a/include/MwCXX/Widget/Base.h +++ b/include/MwCXX/Widget/Base.h @@ -28,9 +28,22 @@ namespace MwCXX { int Pending(); void Loop(); - MwCXX::Base* GetParent(); + void Show(int toggle); + void HideCursor(); + void GrabPointer(int toggle); + void AddTickList(); + void ForceRender(); + void Reparent(MwCXX::Base* new_parent); - MwWidget GetWidget(); + MwCXX::Base* GetParent(); + std::vector GetChildren(); + + MwWidget GetWidget(); + MwCXX::String GetName(); + MwPoint GetCursorCoord(); + MwRect GetScreenSize(); + int GetCoordinateType(); + void GetClipboard(int clipboard_type); #include }; diff --git a/src/widget/base.cc b/src/widget/base.cc index 74f3f63..9e4dfc2 100644 --- a/src/widget/base.cc +++ b/src/widget/base.cc @@ -84,10 +84,79 @@ void MwCXX::Base::Loop() { MwLoop(this->widget); } +void MwCXX::Base::Show(int toggle) { + MwShow(this->widget, toggle); +} + +void MwCXX::Base::HideCursor() { + MwHideCursor(this->widget); +} + +void MwCXX::Base::GrabPointer(int toggle) { + MwGrabPointer(this->widget, toggle); +} + +void MwCXX::Base::AddTickList() { + MwAddTickList(this->widget); +} + +void MwCXX::Base::ForceRender() { + MwForceRender(this->widget); +} + +void MwCXX::Base::Reparent(MwCXX::Base* new_parent) { + int i; + + for(i = 0; i < this->parent->children.size(); i++) { + if(this->parent->children[i] == this) { + this->parent->children.erase(this->parent->children.begin() + i); + + break; + } + } + + MwReparent(this->widget, new_parent->widget); + + this->parent = new_parent; + new_parent->children.push_back(this); +} + MwCXX::Base* MwCXX::Base::GetParent() { return this->parent; } +std::vector MwCXX::Base::GetChildren() { + return this->children; +} + MwWidget MwCXX::Base::GetWidget() { return this->widget; } + +MwCXX::String MwCXX::Base::GetName() { + return (MwCXX::String)MwGetName(this->widget); +} + +MwPoint MwCXX::Base::GetCursorCoord() { + MwPoint p; + + MwGetCursorCoord(this->widget, &p); + + return p; +} + +MwRect MwCXX::Base::GetScreenSize() { + MwRect rc; + + MwGetScreenSize(this->widget, &rc); + + return rc; +} + +int MwCXX::Base::GetCoordinateType() { + return MwGetCoordinateType(this->widget); +} + +void MwCXX::Base::GetClipboard(int clipboard_type) { + MwGetClipboard(this->widget, clipboard_type); +}