working
This commit is contained in:
parent
90e572aad8
commit
04c4e319c5
4 changed files with 86 additions and 13 deletions
|
|
@ -494,8 +494,6 @@ static std::string function_source(xl_node_t* node) {
|
||||||
std::string str = get_ctype(type, 0);
|
std::string str = get_ctype(type, 0);
|
||||||
|
|
||||||
strm << "return new " + str.substr(0, str.size() - 1) + "(";
|
strm << "return new " + str.substr(0, str.size() - 1) + "(";
|
||||||
} else if(type.type == "string") {
|
|
||||||
strm << "const char* _ret = ";
|
|
||||||
} else {
|
} else {
|
||||||
strm << "return (" + get_ctype(type, 0) + ")";
|
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"));
|
if(widget != NULL) strm << ", " + std::string(xl_get_attribute(widget, "name"));
|
||||||
}
|
}
|
||||||
strm << ");" << std::endl;
|
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;
|
strm << "}" << std::endl;
|
||||||
|
|
||||||
return strm.str();
|
return strm.str();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define MWCXX_USE_C_STRING
|
// #define MWCXX_USE_C_STRING
|
||||||
|
|
||||||
namespace MwCXX {
|
namespace MwCXX {
|
||||||
#ifdef MWCXX_USE_C_STRING
|
#ifdef MWCXX_USE_C_STRING
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,22 @@ namespace MwCXX {
|
||||||
int Pending();
|
int Pending();
|
||||||
void Loop();
|
void Loop();
|
||||||
|
|
||||||
|
void Show(int toggle);
|
||||||
|
void HideCursor();
|
||||||
|
void GrabPointer(int toggle);
|
||||||
|
void AddTickList();
|
||||||
|
void ForceRender();
|
||||||
|
void Reparent(MwCXX::Base* new_parent);
|
||||||
|
|
||||||
MwCXX::Base* GetParent();
|
MwCXX::Base* GetParent();
|
||||||
|
std::vector<MwCXX::Base*> GetChildren();
|
||||||
|
|
||||||
MwWidget GetWidget();
|
MwWidget GetWidget();
|
||||||
|
MwCXX::String GetName();
|
||||||
|
MwPoint GetCursorCoord();
|
||||||
|
MwRect GetScreenSize();
|
||||||
|
int GetCoordinateType();
|
||||||
|
void GetClipboard(int clipboard_type);
|
||||||
|
|
||||||
#include <MwCXX/Widget/BaseAuto.h>
|
#include <MwCXX/Widget/BaseAuto.h>
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -84,10 +84,79 @@ void MwCXX::Base::Loop() {
|
||||||
MwLoop(this->widget);
|
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() {
|
MwCXX::Base* MwCXX::Base::GetParent() {
|
||||||
return this->parent;
|
return this->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<MwCXX::Base*> MwCXX::Base::GetChildren() {
|
||||||
|
return this->children;
|
||||||
|
}
|
||||||
|
|
||||||
MwWidget MwCXX::Base::GetWidget() {
|
MwWidget MwCXX::Base::GetWidget() {
|
||||||
return this->widget;
|
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);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue