fix bindgen

This commit is contained in:
Nishi 2026-04-19 06:35:19 +09:00
commit a1f7444342
Signed by: nishi
GPG key ID: 27EF69B208EB9343
4 changed files with 14 additions and 10 deletions

View file

@ -19,8 +19,6 @@ format:
OBJS = src/core.o src/widget/base.o
include objs.mk
src/widget/base.o: src/widget/base.cc src/widget/baseauto.cc
test$(EXEC): test.o
$(CXX) -L. -Wl,-R$(MILSKO)/src -Wl,-R$(MILSKO)/lib -Wl,-R. -o $@ test.o -lMwCXX

View file

@ -13,6 +13,7 @@ struct typeinfo {
std::string struct_name;
std::string widget_type;
int pointer;
int unsigned_num;
};
struct property {
@ -38,6 +39,8 @@ static std::string get_ctype(typeinfo type, int name = 1, int do_ptr = 1) {
if(type.type == "integer") {
ret += "int";
} else if(type.type == "short") {
ret += "short";
} else if(type.type == "string") {
ret += "MwCXX::String";
} else if(type.type == "pixmap") {
@ -54,6 +57,8 @@ static std::string get_ctype(typeinfo type, int name = 1, int do_ptr = 1) {
}
}
if(type.unsigned_num) ret = "unsigned " + ret;
if(do_ptr && type.pointer) ret += "*";
if(name && type.name != "") {
@ -99,11 +104,12 @@ static typeinfo xml_to_type(xl_node_t* node) {
char* s;
typeinfo ret;
ret.type = node->name;
ret.name = ((s = xl_get_attribute(node, "name")) != NULL) ? s : "";
ret.struct_name = ((s = xl_get_attribute(node, "defname")) != NULL) ? s : "";
ret.widget_type = ((s = xl_get_attribute(node, "type")) != NULL) ? s : "";
ret.pointer = ATTR_TO_BOOL(node, "pointer");
ret.type = node->name;
ret.name = ((s = xl_get_attribute(node, "name")) != NULL) ? s : "";
ret.struct_name = ((s = xl_get_attribute(node, "defname")) != NULL) ? s : "";
ret.widget_type = ((s = xl_get_attribute(node, "type")) != NULL) ? s : "";
ret.pointer = ATTR_TO_BOOL(node, "pointer");
ret.unsigned_num = ATTR_TO_BOOL(node, "unsigned");
return ret;
}

View file

@ -4,7 +4,7 @@
#include <MwCXX/Widget/All.h>
namespace MwCXX {
MwCXX::Window* MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, int flag);
MwCXX::Window* MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, unsigned int flag);
MwCXX::Button* MessageBoxGetChild(MwCXX::Window* handle, int child);
void MessageBoxDestroy(MwCXX::Window* handle);
}; // namespace MwCXX

View file

@ -1,6 +1,6 @@
#include <MwCXX/Dialog/MessageBox.h>
MwCXX::Window* MwCXX::MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, int flag) {
MwCXX::Window* MwCXX::MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, unsigned int flag) {
return new MwCXX::Window(MwMessageBox(handle->GetWidget(),
#ifdef MWCXX_USE_C_STRING
text
@ -14,7 +14,7 @@ MwCXX::Window* MwCXX::MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX:
title.c_str()
#endif
,
(int)flag),
(unsigned int)flag),
handle);
}
MwCXX::Button* MwCXX::MessageBoxGetChild(MwCXX::Window* handle, int child) {