seems to work

This commit is contained in:
Nishi 2026-04-17 22:25:28 +09:00
commit d7d6ae1479
Signed by: nishi
GPG key ID: 27EF69B208EB9343
47 changed files with 533 additions and 38 deletions

View file

@ -31,4 +31,4 @@ libMwCXX$(SO): $(OBJS)
$(CXX) -fPIC -c -Iinclude -I$(MILSKO)/include -I$(XEMIL)/include -o $@ $< $(CXX) -fPIC -c -Iinclude -I$(MILSKO)/include -I$(XEMIL)/include -o $@ $<
clean: clean:
rm -f *.so *.dll *.o */*.o */*/*.o *.exe bindgen.exe rm -f *.so *.dll *.o */*.o */*/*.o *.exe bindgen.exe bindgen

View file

@ -16,16 +16,22 @@ struct typeinfo {
struct property { struct property {
typeinfo type; typeinfo type;
int common; int common;
};
struct handler {
int common;
int has_arg;
typeinfo arg_type; typeinfo arg_type;
}; };
std::map<std::string, std::ofstream> files; std::map<std::string, std::ofstream> files;
std::map<std::string, property> props; std::map<std::string, property> props;
std::map<std::string, handler> handlers;
std::locale locale; std::locale locale;
static std::string get_ctype(typeinfo type, int name = 1) { static std::string get_ctype(typeinfo type, int name = 1, int do_ptr = 1) {
std::string ret = ""; std::string ret = "";
if(type.type == "integer") { if(type.type == "integer") {
@ -40,7 +46,7 @@ static std::string get_ctype(typeinfo type, int name = 1) {
ret += type.struct_name; ret += type.struct_name;
} }
if(type.pointer) ret += "*"; if(do_ptr && type.pointer) ret += "*";
if(name && type.name != "") { if(name && type.name != "") {
ret += " " + type.name; ret += " " + type.name;
@ -93,26 +99,19 @@ static typeinfo xml_to_type(xl_node_t* node) {
return ret; return ret;
} }
static std::string first_upper(std::string str) { static std::string upperfirst(std::string str) {
return uppercase(str.substr(0, 1)) + str.substr(1); return uppercase(str.substr(0, 1)) + str.substr(1);
} }
static void scan_property(xl_node_t* node) { static void scan_property(xl_node_t* node) {
property prop; property prop;
char* s; char* s;
xl_node_t* child = node->first_child;
if(node->type != XL_NODE_NODE) return; if(node->type != XL_NODE_NODE) return;
prop.type = xml_to_type(node); prop.type = xml_to_type(node);
prop.common = ATTR_TO_BOOL(node, "common"); prop.common = ATTR_TO_BOOL(node, "common");
while(child != NULL) {
if(child->type == XL_NODE_NODE) prop.arg_type = xml_to_type(child);
child = child->next;
}
props[xl_get_attribute(node, "name")] = prop; props[xl_get_attribute(node, "name")] = prop;
} }
@ -126,38 +125,43 @@ static void scan_properties(xl_node_t* node) {
} }
} }
static void scan_handler(xl_node_t* node) {
handler handl;
char* s;
xl_node_t* child = node->first_child;
if(node->type != XL_NODE_NODE) return;
handl.common = ATTR_TO_BOOL(node, "common");
handl.has_arg = 0;
while(child != NULL) {
if(child->type == XL_NODE_NODE) {
handl.has_arg = 1;
handl.arg_type = xml_to_type(child);
}
child = child->next;
}
handlers[xl_get_attribute(node, "name")] = handl;
}
static void scan_handlers(xl_node_t* node) {
xl_node_t* child = node->first_child;
while(child != NULL) {
scan_handler(child);
child = child->next;
}
}
static std::string widget_property_header(std::string name, std::string indent = "") { static std::string widget_property_header(std::string name, std::string indent = "") {
std::stringstream strm; std::stringstream strm;
strm << indent + get_ctype(props[name].type, 0) + " Get" + first_upper(name) + "();" << std::endl; strm << indent + get_ctype(props[name].type, 0) + " Get" + upperfirst(name) + "();" << std::endl;
strm << indent + "void Set" + first_upper(name) + "(" + get_ctype(props[name].type, 0) + " value);" << std::endl; strm << indent + "void Set" + upperfirst(name) + "(" + get_ctype(props[name].type, 0) + " value);" << std::endl;
return strm.str();
}
static std::string widget_property_source(std::string widget, std::string name) {
std::stringstream strm;
strm << get_ctype(props[name].type, 0) + " MwCXX::" + widget + "::Get" + first_upper(name) + "() {" << std::endl;
strm << " return (" + get_ctype(props[name].type, 0) + ")MwGet" + get_type(props[name].type) + "(this->widget, MwN" + name + ");" << std::endl;
strm << "}" << std::endl;
strm << std::endl;
strm << "void MwCXX::" + widget + "::Set" + first_upper(name) + "(" + get_ctype(props[name].type, 0) + " value) {" << std::endl;
if(props[name].type.type == "string") {
strm << "#ifndef MWCXX_USE_C_STRING" << std::endl;
strm << " MwSetText(this->widget, MwN" + name + ", value.c_str());" << std::endl;
strm << "#else" << std::endl;
}
strm << " MwSet" + get_type(props[name].type) + "(this->widget, MwN" + name + ", (" + get_ctype(props[name].type, 0) + ")value);" << std::endl;
if(props[name].type.type == "string") {
strm << "#endif" << std::endl;
}
strm << "}" << std::endl;
strm << std::endl;
return strm.str(); return strm.str();
} }
@ -183,20 +187,119 @@ static std::string scan_widget_properties_header(xl_node_t* node, std::string in
return r; return r;
} }
static std::string scan_widget_property_source(xl_node_t* node, std::string name) { static std::string widget_property_source(std::string widget, std::string name) {
std::stringstream strm;
strm << get_ctype(props[name].type, 0) + " MwCXX::" + widget + "::Get" + upperfirst(name) + "() {" << std::endl;
strm << " return (" + get_ctype(props[name].type, 0) + ")MwGet" + get_type(props[name].type) + "(this->widget, MwN" + name + ");" << std::endl;
strm << "}" << std::endl;
strm << std::endl;
strm << "void MwCXX::" + widget + "::Set" + upperfirst(name) + "(" + get_ctype(props[name].type, 0) + " value) {" << std::endl;
if(props[name].type.type == "string") {
strm << "#ifndef MWCXX_USE_C_STRING" << std::endl;
strm << " MwSetText(this->widget, MwN" + name + ", value.c_str());" << std::endl;
strm << "#else" << std::endl;
}
strm << " MwSet" + get_type(props[name].type) + "(this->widget, MwN" + name + ", (" + get_ctype(props[name].type, 0) + ")value);" << std::endl;
if(props[name].type.type == "string") {
strm << "#endif" << std::endl;
}
strm << "}" << std::endl;
strm << std::endl;
return strm.str();
}
static std::string scan_widget_property_source(xl_node_t* node, std::string widget) {
xl_node_t* child = node->first_child; xl_node_t* child = node->first_child;
if(node->type != XL_NODE_NODE) return ""; if(node->type != XL_NODE_NODE) return "";
return widget_property_source(name, xl_get_attribute(node, "name")); return widget_property_source(widget, xl_get_attribute(node, "name"));
} }
static std::string scan_widget_properties_source(xl_node_t* node, std::string name) { static std::string scan_widget_properties_source(xl_node_t* node, std::string widget) {
std::string r = ""; std::string r = "";
xl_node_t* child = node->first_child; xl_node_t* child = node->first_child;
while(child != NULL) { while(child != NULL) {
r += scan_widget_property_source(child, name); r += scan_widget_property_source(child, widget);
child = child->next;
}
return r;
}
static std::string widget_handler_header(std::string name, std::string indent = "") {
std::stringstream strm;
strm << indent + "virtual void On" + upperfirst(name) + "(" + (handlers[name].has_arg ? (get_ctype(handlers[name].arg_type, 0, 0) + " value") : "") + ") {};" << std::endl;
return strm.str();
}
static std::string scan_widget_handler_header(xl_node_t* node, std::string indent) {
xl_node_t* child = node->first_child;
if(node->type != XL_NODE_NODE) return "";
return widget_handler_header(xl_get_attribute(node, "name"), indent);
}
static std::string scan_widget_handlers_header(xl_node_t* node, std::string indent) {
std::string r = "";
xl_node_t* child = node->first_child;
while(child != NULL) {
r += scan_widget_handler_header(child, indent);
child = child->next;
}
return r;
}
static std::string widget_handler_source(std::string widget, std::string name) {
std::stringstream strm;
std::string cast = "";
if(handlers[name].has_arg) {
cast = "(" + get_ctype(handlers[name].arg_type, 0) + ")";
if(handlers[name].arg_type.pointer) cast = "*" + cast;
if(handlers[name].arg_type.type == "string") cast += "(char*)";
cast += "call";
}
strm << "static void __On" + upperfirst(name) + "(MwWidget handle, void* user, void* call) {" << std::endl;
strm << " ((MwCXX::" + widget + "*)user)->On" + upperfirst(name) + "(" + cast + ");" << std::endl;
strm << "}" << std::endl;
strm << std::endl;
return strm.str();
}
static std::string scan_widget_handler_source(xl_node_t* node, std::string widget) {
xl_node_t* child = node->first_child;
if(node->type != XL_NODE_NODE) return "";
return widget_handler_source(widget, xl_get_attribute(node, "name"));
}
static std::string scan_widget_handlers_source(xl_node_t* node, std::string widget) {
std::string r = "";
xl_node_t* child = node->first_child;
while(child != NULL) {
r += scan_widget_handler_source(child, widget);
child = child->next; child = child->next;
} }
@ -206,12 +309,15 @@ static std::string scan_widget_properties_source(xl_node_t* node, std::string na
static void scan_widget(xl_node_t* node) { static void scan_widget(xl_node_t* node) {
std::string name; std::string name;
xl_node_t** nodes; xl_node_t** p_nodes;
xl_node_t** h_nodes;
xl_node_t* child;
int i; int i;
if(node->type != XL_NODE_NODE) return; if(node->type != XL_NODE_NODE) return;
nodes = xl_get_path(node, "properties"); p_nodes = xl_get_path(node, "properties");
h_nodes = xl_get_path(node, "handlers");
name = xl_get_attribute(node, "name"); name = xl_get_attribute(node, "name");
@ -230,15 +336,29 @@ static void scan_widget(xl_node_t* node) {
OFS << "namespace MwCXX {" << std::endl; OFS << "namespace MwCXX {" << std::endl;
OFS << " class " + name + " : public MwCXX::Base {" << std::endl; OFS << " class " + name + " : public MwCXX::Base {" << std::endl;
OFS << " protected:" << std::endl;
OFS << " virtual void RegisterHandlers();" << std::endl;
OFS << std::endl;
OFS << " public:" << std::endl; OFS << " public:" << std::endl;
OFS << " " + name + "(MwWidget widget);" << std::endl; OFS << " " + name + "(MwWidget widget);" << std::endl;
OFS << " " + name + "(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);" << std::endl; OFS << " " + name + "(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);" << std::endl;
if(nodes != NULL) { if(p_nodes != NULL) {
std::string r = ""; std::string r = "";
for(i = 0; nodes[i] != NULL; i++) { for(i = 0; p_nodes[i] != NULL; i++) {
r += scan_widget_properties_header(nodes[i], "\t\t"); r += scan_widget_properties_header(p_nodes[i], "\t\t");
}
if(r != "") OFS << std::endl
<< r;
}
if(h_nodes != NULL) {
std::string r = "";
for(i = 0; h_nodes[i] != NULL; i++) {
r += scan_widget_handlers_header(h_nodes[i], "\t\t");
} }
if(r != "") OFS << std::endl if(r != "") OFS << std::endl
@ -263,22 +383,47 @@ static void scan_widget(xl_node_t* node) {
OFS << std::endl; OFS << std::endl;
OFS << "MwCXX::" + name + "::" + name + "(MwWidget widget) : MwCXX::Base(widget) {" << std::endl; OFS << "MwCXX::" + name + "::" + name + "(MwWidget widget) : MwCXX::Base(widget) {" << std::endl;
OFS << " this->RegisterHandlers();" << std::endl;
OFS << "}" << std::endl; OFS << "}" << std::endl;
OFS << std::endl; OFS << std::endl;
OFS << "MwCXX::" + name + "::" + name + "(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) : MwCXX::Base(Mw" + name + "Class, name, parent, x, y, width, height) {" << std::endl; OFS << "MwCXX::" + name + "::" + name + "(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) : MwCXX::Base(Mw" + name + "Class, name, parent, x, y, width, height) {" << std::endl;
OFS << " this->RegisterHandlers();" << std::endl;
OFS << "}" << std::endl; OFS << "}" << std::endl;
OFS << std::endl; OFS << std::endl;
if(nodes != NULL) { if(p_nodes != NULL) {
for(i = 0; nodes[i] != NULL; i++) { for(i = 0; p_nodes[i] != NULL; i++) {
OFS << scan_widget_properties_source(nodes[i], name); OFS << scan_widget_properties_source(p_nodes[i], name);
} }
} }
if(h_nodes != NULL) {
for(i = 0; h_nodes[i] != NULL; i++) {
OFS << scan_widget_handlers_source(h_nodes[i], name);
}
}
OFS << "void MwCXX::" + name + "::RegisterHandlers() {" << std::endl;
if(h_nodes != NULL) {
for(i = 0; h_nodes[i] != NULL; i++) {
for(child = h_nodes[i]->first_child; child != NULL; child = child->next) {
std::string hname;
if(child->type != XL_NODE_NODE) continue;
hname = xl_get_attribute(child, "name");
OFS << " MwAddUserHandler(this->widget, MwN" + hname + "Handler, __On" + upperfirst(hname) + ", (void*)this);" << std::endl;
}
}
}
OFS << "}" << std::endl;
#undef OFS #undef OFS
if(nodes != NULL) free(nodes); if(p_nodes != NULL) free(p_nodes);
if(h_nodes != NULL) free(h_nodes);
files["objs"] << " src/widget/" + lowercase(name) + ".o"; files["objs"] << " src/widget/" + lowercase(name) + ".o";
} }
@ -294,16 +439,26 @@ static void scan_widgets(xl_node_t* node) {
} }
static void base_widget() { static void base_widget() {
std::string r = ""; int f;
#define OFS files["WBaseAuto.h"] #define OFS files["WBaseAuto.h"]
OFS = std::ofstream("include/MwCXX/Widget/BaseAuto.h"); OFS = std::ofstream("include/MwCXX/Widget/BaseAuto.h");
f = 0;
for(auto p = props.begin(); p != props.end(); p++) { for(auto p = props.begin(); p != props.end(); p++) {
if(!p->second.common) continue; if(!p->second.common) continue;
OFS << widget_property_header(p->first); OFS << widget_property_header(p->first);
f = 1;
}
if(f) OFS << std::endl;
for(auto p = handlers.begin(); p != handlers.end(); p++) {
if(!p->second.common) continue;
OFS << widget_handler_header(p->first);
} }
#undef OFS #undef OFS
@ -317,11 +472,22 @@ static void base_widget() {
for(auto p = props.begin(); p != props.end(); p++) { for(auto p = props.begin(); p != props.end(); p++) {
if(!p->second.common) continue; if(!p->second.common) continue;
r += widget_property_source("Base", p->first); OFS << widget_property_source("Base", p->first);
} }
if(r != "") OFS << std::endl for(auto h = handlers.begin(); h != handlers.end(); h++) {
<< r; if(!h->second.common) continue;
OFS << widget_handler_source("Base", h->first);
}
OFS << "void MwCXX::Base::RegisterHandlers() {" << std::endl;
for(auto h = handlers.begin(); h != handlers.end(); h++) {
if(!h->second.common) continue;
OFS << " MwAddUserHandler(this->widget, MwN" + h->first + "Handler, __On" + upperfirst(h->first) + ", (void*)this);" << std::endl;
}
OFS << "}" << std::endl;
#undef OFS #undef OFS
@ -359,6 +525,14 @@ int main(int argc, char** argv) {
free(nodes); free(nodes);
} }
if((nodes = xl_get_path(h->root, "handlers")) != NULL) {
for(int i = 0; nodes[i] != NULL; i++) {
scan_handlers(nodes[i]);
}
free(nodes);
}
base_widget(); base_widget();
if((nodes = xl_get_path(h->root, "widgets")) != NULL) { if((nodes = xl_get_path(h->root, "widgets")) != NULL) {

View file

@ -4,7 +4,7 @@
#include <MwCXX/MachDep.h> #include <MwCXX/MachDep.h>
#include <MwCXX/Widget/Base.h> #include <MwCXX/Widget/Base.h>
#define MWCXX_CONSTRUCTOR(name, parent_class) name(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) : parent_class(name, parent, x, y, width, height) #define MWCXX_CONSTRUCTOR(this_class, parent_class) this_class(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) : parent_class(name, parent, x, y, width, height)
namespace MwCXX { namespace MwCXX {
void Init(); void Init();

View file

@ -6,6 +6,8 @@
namespace MwCXX { namespace MwCXX {
class Base { class Base {
protected: protected:
virtual void RegisterHandlers();
MwWidget widget; MwWidget widget;
public: public:

View file

@ -36,3 +36,15 @@ int GetX();
void SetX(int value); void SetX(int value);
int GetY(); int GetY();
void SetY(int value); void SetY(int value);
virtual void OnClipboard(MwCXX::String value) {};
virtual void OnDarkTheme(int value) {};
virtual void OnFocusIn() {};
virtual void OnFocusOut() {};
virtual void OnKey(int value) {};
virtual void OnKeyRelease(int value) {};
virtual void OnMouseDown(MwMouse value) {};
virtual void OnMouseMove(MwPoint value) {};
virtual void OnMouseUp(MwMouse value) {};
virtual void OnResize() {};
virtual void OnTick() {};

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Box : public MwCXX::Base { class Box : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Box(MwWidget widget); Box(MwWidget widget);
Box(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Box(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Button : public MwCXX::Base { class Button : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Button(MwWidget widget); Button(MwWidget widget);
Button(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Button(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
@ -22,6 +25,9 @@ namespace MwCXX {
void SetPadding(int value); void SetPadding(int value);
int GetFillArea(); int GetFillArea();
void SetFillArea(int value); void SetFillArea(int value);
virtual void OnActivate() {};
virtual void OnChanged() {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,12 +8,17 @@
namespace MwCXX { namespace MwCXX {
class CheckBox : public MwCXX::Base { class CheckBox : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
CheckBox(MwWidget widget); CheckBox(MwWidget widget);
CheckBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); CheckBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
int GetChecked(); int GetChecked();
void SetChecked(int value); void SetChecked(int value);
virtual void OnChanged() {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class ComboBox : public MwCXX::Base { class ComboBox : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
ComboBox(MwWidget widget); ComboBox(MwWidget widget);
ComboBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); ComboBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
@ -16,6 +19,8 @@ namespace MwCXX {
void SetAreaShown(int value); void SetAreaShown(int value);
int GetValue(); int GetValue();
void SetValue(int value); void SetValue(int value);
virtual void OnComboBoxChanged(int value) {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Entry : public MwCXX::Base { class Entry : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Entry(MwWidget widget); Entry(MwWidget widget);
Entry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Entry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
@ -16,6 +19,9 @@ namespace MwCXX {
void SetText(MwCXX::String value); void SetText(MwCXX::String value);
int GetHideInput(); int GetHideInput();
void SetHideInput(int value); void SetHideInput(int value);
virtual void OnActivate() {};
virtual void OnChanged() {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Frame : public MwCXX::Base { class Frame : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Frame(MwWidget widget); Frame(MwWidget widget);
Frame(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Frame(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Image : public MwCXX::Base { class Image : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Image(MwWidget widget); Image(MwWidget widget);
Image(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Image(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Label : public MwCXX::Base { class Label : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Label(MwWidget widget); Label(MwWidget widget);
Label(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Label(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class ListBox : public MwCXX::Base { class ListBox : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
ListBox(MwWidget widget); ListBox(MwWidget widget);
ListBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); ListBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
@ -18,6 +21,8 @@ namespace MwCXX {
void SetHasHeading(int value); void SetHasHeading(int value);
int GetSingleClickSelectable(); int GetSingleClickSelectable();
void SetSingleClickSelectable(int value); void SetSingleClickSelectable(int value);
virtual void OnListBoxActivate(int value) {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,9 +8,14 @@
namespace MwCXX { namespace MwCXX {
class Menu : public MwCXX::Base { class Menu : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Menu(MwWidget widget); Menu(MwWidget widget);
Menu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Menu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
virtual void OnMenu(void* value) {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,12 +8,18 @@
namespace MwCXX { namespace MwCXX {
class NumberEntry : public MwCXX::Base { class NumberEntry : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
NumberEntry(MwWidget widget); NumberEntry(MwWidget widget);
NumberEntry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); NumberEntry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
MwCXX::String GetText(); MwCXX::String GetText();
void SetText(MwCXX::String value); void SetText(MwCXX::String value);
virtual void OnActivate() {};
virtual void OnChanged() {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class OpenGL : public MwCXX::Base { class OpenGL : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
OpenGL(MwWidget widget); OpenGL(MwWidget widget);
OpenGL(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); OpenGL(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class ProgressBar : public MwCXX::Base { class ProgressBar : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
ProgressBar(MwWidget widget); ProgressBar(MwWidget widget);
ProgressBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); ProgressBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,12 +8,17 @@
namespace MwCXX { namespace MwCXX {
class RadioBox : public MwCXX::Base { class RadioBox : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
RadioBox(MwWidget widget); RadioBox(MwWidget widget);
RadioBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); RadioBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
int GetChecked(); int GetChecked();
void SetChecked(int value); void SetChecked(int value);
virtual void OnChanged() {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class ScrollBar : public MwCXX::Base { class ScrollBar : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
ScrollBar(MwWidget widget); ScrollBar(MwWidget widget);
ScrollBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); ScrollBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
@ -24,6 +27,8 @@ namespace MwCXX {
void SetMaxValue(int value); void SetMaxValue(int value);
int GetOrientation(); int GetOrientation();
void SetOrientation(int value); void SetOrientation(int value);
virtual void OnChanged() {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class SubMenu : public MwCXX::Base { class SubMenu : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
SubMenu(MwWidget widget); SubMenu(MwWidget widget);
SubMenu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); SubMenu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class TreeView : public MwCXX::Base { class TreeView : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
TreeView(MwWidget widget); TreeView(MwWidget widget);
TreeView(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); TreeView(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
@ -16,6 +19,8 @@ namespace MwCXX {
void SetLeftPadding(int value); void SetLeftPadding(int value);
int GetSingleClickSelectable(); int GetSingleClickSelectable();
void SetSingleClickSelectable(int value); void SetSingleClickSelectable(int value);
virtual void OnTreeViewActivate(void* value) {};
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Viewport : public MwCXX::Base { class Viewport : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Viewport(MwWidget widget); Viewport(MwWidget widget);
Viewport(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Viewport(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Vulkan : public MwCXX::Base { class Vulkan : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Vulkan(MwWidget widget); Vulkan(MwWidget widget);
Vulkan(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Vulkan(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -8,6 +8,9 @@
namespace MwCXX { namespace MwCXX {
class Window : public MwCXX::Base { class Window : public MwCXX::Base {
protected:
virtual void RegisterHandlers();
public: public:
Window(MwWidget widget); Window(MwWidget widget);
Window(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); Window(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);

View file

@ -2,6 +2,8 @@
MwCXX::Base::Base(MwWidget widget) { MwCXX::Base::Base(MwWidget widget) {
this->widget = widget; this->widget = widget;
this->RegisterHandlers();
} }
MwCXX::Base::Base(MwClass widget_class, MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) { MwCXX::Base::Base(MwClass widget_class, MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) {

View file

@ -1,5 +1,4 @@
#include <MwCXX/Widget/Base.h> #include <MwCXX/Widget/Base.h>
MwCXX::String MwCXX::Base::GetBackground() { MwCXX::String MwCXX::Base::GetBackground() {
return (MwCXX::String)MwGetText(this->widget, MwNbackground); return (MwCXX::String)MwGetText(this->widget, MwNbackground);
} }
@ -167,3 +166,61 @@ int MwCXX::Base::GetY() {
void MwCXX::Base::SetY(int value) { void MwCXX::Base::SetY(int value) {
MwSetInteger(this->widget, MwNy, (int)value); MwSetInteger(this->widget, MwNy, (int)value);
} }
static void __OnClipboard(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnClipboard((MwCXX::String)(char*)call);
}
static void __OnDarkTheme(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnDarkTheme(*(int*)call);
}
static void __OnFocusIn(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnFocusIn();
}
static void __OnFocusOut(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnFocusOut();
}
static void __OnKey(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnKey(*(int*)call);
}
static void __OnKeyRelease(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnKeyRelease(*(int*)call);
}
static void __OnMouseDown(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnMouseDown(*(MwMouse*)call);
}
static void __OnMouseMove(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnMouseMove(*(MwPoint*)call);
}
static void __OnMouseUp(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnMouseUp(*(MwMouse*)call);
}
static void __OnResize(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnResize();
}
static void __OnTick(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnTick();
}
void MwCXX::Base::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNclipboardHandler, __OnClipboard, (void*)this);
MwAddUserHandler(this->widget, MwNdarkThemeHandler, __OnDarkTheme, (void*)this);
MwAddUserHandler(this->widget, MwNfocusInHandler, __OnFocusIn, (void*)this);
MwAddUserHandler(this->widget, MwNfocusOutHandler, __OnFocusOut, (void*)this);
MwAddUserHandler(this->widget, MwNkeyHandler, __OnKey, (void*)this);
MwAddUserHandler(this->widget, MwNkeyReleaseHandler, __OnKeyRelease, (void*)this);
MwAddUserHandler(this->widget, MwNmouseDownHandler, __OnMouseDown, (void*)this);
MwAddUserHandler(this->widget, MwNmouseMoveHandler, __OnMouseMove, (void*)this);
MwAddUserHandler(this->widget, MwNmouseUpHandler, __OnMouseUp, (void*)this);
MwAddUserHandler(this->widget, MwNresizeHandler, __OnResize, (void*)this);
MwAddUserHandler(this->widget, MwNtickHandler, __OnTick, (void*)this);
}

View file

@ -2,10 +2,12 @@
MwCXX::Box::Box(MwWidget widget) MwCXX::Box::Box(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Box::Box(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Box::Box(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwBoxClass, name, parent, x, y, width, height) { : MwCXX::Base(MwBoxClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::Box::GetOrientation() { int MwCXX::Box::GetOrientation() {
@ -47,3 +49,6 @@ int MwCXX::Box::GetInverted() {
void MwCXX::Box::SetInverted(int value) { void MwCXX::Box::SetInverted(int value) {
MwSetInteger(this->widget, MwNinverted, (int)value); MwSetInteger(this->widget, MwNinverted, (int)value);
} }
void MwCXX::Box::RegisterHandlers() {
}

View file

@ -2,10 +2,12 @@
MwCXX::Button::Button(MwWidget widget) MwCXX::Button::Button(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Button::Button(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Button::Button(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwButtonClass, name, parent, x, y, width, height) { : MwCXX::Base(MwButtonClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
MwLLPixmap MwCXX::Button::GetPixmap() { MwLLPixmap MwCXX::Button::GetPixmap() {
@ -51,3 +53,16 @@ int MwCXX::Button::GetFillArea() {
void MwCXX::Button::SetFillArea(int value) { void MwCXX::Button::SetFillArea(int value) {
MwSetInteger(this->widget, MwNfillArea, (int)value); MwSetInteger(this->widget, MwNfillArea, (int)value);
} }
static void __OnActivate(MwWidget handle, void* user, void* call) {
((MwCXX::Button*)user)->OnActivate();
}
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::Button*)user)->OnChanged();
}
void MwCXX::Button::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNactivateHandler, __OnActivate, (void*)this);
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
}

View file

@ -2,10 +2,12 @@
MwCXX::CheckBox::CheckBox(MwWidget widget) MwCXX::CheckBox::CheckBox(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::CheckBox::CheckBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::CheckBox::CheckBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwCheckBoxClass, name, parent, x, y, width, height) { : MwCXX::Base(MwCheckBoxClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::CheckBox::GetChecked() { int MwCXX::CheckBox::GetChecked() {
@ -15,3 +17,11 @@ int MwCXX::CheckBox::GetChecked() {
void MwCXX::CheckBox::SetChecked(int value) { void MwCXX::CheckBox::SetChecked(int value) {
MwSetInteger(this->widget, MwNchecked, (int)value); MwSetInteger(this->widget, MwNchecked, (int)value);
} }
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::CheckBox*)user)->OnChanged();
}
void MwCXX::CheckBox::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
}

View file

@ -2,10 +2,12 @@
MwCXX::ComboBox::ComboBox(MwWidget widget) MwCXX::ComboBox::ComboBox(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::ComboBox::ComboBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::ComboBox::ComboBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwComboBoxClass, name, parent, x, y, width, height) { : MwCXX::Base(MwComboBoxClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::ComboBox::GetAreaShown() { int MwCXX::ComboBox::GetAreaShown() {
@ -23,3 +25,11 @@ int MwCXX::ComboBox::GetValue() {
void MwCXX::ComboBox::SetValue(int value) { void MwCXX::ComboBox::SetValue(int value) {
MwSetInteger(this->widget, MwNvalue, (int)value); MwSetInteger(this->widget, MwNvalue, (int)value);
} }
static void __OnComboBoxChanged(MwWidget handle, void* user, void* call) {
((MwCXX::ComboBox*)user)->OnComboBoxChanged(*(int*)call);
}
void MwCXX::ComboBox::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNcomboBoxChangedHandler, __OnComboBoxChanged, (void*)this);
}

View file

@ -2,10 +2,12 @@
MwCXX::Entry::Entry(MwWidget widget) MwCXX::Entry::Entry(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Entry::Entry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Entry::Entry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwEntryClass, name, parent, x, y, width, height) { : MwCXX::Base(MwEntryClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
MwCXX::String MwCXX::Entry::GetText() { MwCXX::String MwCXX::Entry::GetText() {
@ -27,3 +29,16 @@ int MwCXX::Entry::GetHideInput() {
void MwCXX::Entry::SetHideInput(int value) { void MwCXX::Entry::SetHideInput(int value) {
MwSetInteger(this->widget, MwNhideInput, (int)value); MwSetInteger(this->widget, MwNhideInput, (int)value);
} }
static void __OnActivate(MwWidget handle, void* user, void* call) {
((MwCXX::Entry*)user)->OnActivate();
}
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::Entry*)user)->OnChanged();
}
void MwCXX::Entry::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNactivateHandler, __OnActivate, (void*)this);
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
}

View file

@ -2,10 +2,12 @@
MwCXX::Frame::Frame(MwWidget widget) MwCXX::Frame::Frame(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Frame::Frame(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Frame::Frame(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwFrameClass, name, parent, x, y, width, height) { : MwCXX::Base(MwFrameClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::Frame::GetHasBorder() { int MwCXX::Frame::GetHasBorder() {
@ -23,3 +25,6 @@ int MwCXX::Frame::GetInverted() {
void MwCXX::Frame::SetInverted(int value) { void MwCXX::Frame::SetInverted(int value) {
MwSetInteger(this->widget, MwNinverted, (int)value); MwSetInteger(this->widget, MwNinverted, (int)value);
} }
void MwCXX::Frame::RegisterHandlers() {
}

View file

@ -2,10 +2,12 @@
MwCXX::Image::Image(MwWidget widget) MwCXX::Image::Image(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Image::Image(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Image::Image(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwImageClass, name, parent, x, y, width, height) { : MwCXX::Base(MwImageClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
MwLLPixmap MwCXX::Image::GetPixmap() { MwLLPixmap MwCXX::Image::GetPixmap() {
@ -39,3 +41,6 @@ int MwCXX::Image::GetFillArea() {
void MwCXX::Image::SetFillArea(int value) { void MwCXX::Image::SetFillArea(int value) {
MwSetInteger(this->widget, MwNfillArea, (int)value); MwSetInteger(this->widget, MwNfillArea, (int)value);
} }
void MwCXX::Image::RegisterHandlers() {
}

View file

@ -2,10 +2,12 @@
MwCXX::Label::Label(MwWidget widget) MwCXX::Label::Label(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Label::Label(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Label::Label(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwLabelClass, name, parent, x, y, width, height) { : MwCXX::Base(MwLabelClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
MwCXX::String MwCXX::Label::GetText() { MwCXX::String MwCXX::Label::GetText() {
@ -59,3 +61,6 @@ int MwCXX::Label::GetLeftPadding() {
void MwCXX::Label::SetLeftPadding(int value) { void MwCXX::Label::SetLeftPadding(int value) {
MwSetInteger(this->widget, MwNleftPadding, (int)value); MwSetInteger(this->widget, MwNleftPadding, (int)value);
} }
void MwCXX::Label::RegisterHandlers() {
}

View file

@ -2,10 +2,12 @@
MwCXX::ListBox::ListBox(MwWidget widget) MwCXX::ListBox::ListBox(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::ListBox::ListBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::ListBox::ListBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwListBoxClass, name, parent, x, y, width, height) { : MwCXX::Base(MwListBoxClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::ListBox::GetLeftPadding() { int MwCXX::ListBox::GetLeftPadding() {
@ -31,3 +33,11 @@ int MwCXX::ListBox::GetSingleClickSelectable() {
void MwCXX::ListBox::SetSingleClickSelectable(int value) { void MwCXX::ListBox::SetSingleClickSelectable(int value) {
MwSetInteger(this->widget, MwNsingleClickSelectable, (int)value); MwSetInteger(this->widget, MwNsingleClickSelectable, (int)value);
} }
static void __OnListBoxActivate(MwWidget handle, void* user, void* call) {
((MwCXX::ListBox*)user)->OnListBoxActivate(*(int*)call);
}
void MwCXX::ListBox::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNlistBoxActivateHandler, __OnListBoxActivate, (void*)this);
}

View file

@ -2,8 +2,18 @@
MwCXX::Menu::Menu(MwWidget widget) MwCXX::Menu::Menu(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Menu::Menu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Menu::Menu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwMenuClass, name, parent, x, y, width, height) { : MwCXX::Base(MwMenuClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
}
static void __OnMenu(MwWidget handle, void* user, void* call) {
((MwCXX::Menu*)user)->OnMenu((void*)call);
}
void MwCXX::Menu::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNmenuHandler, __OnMenu, (void*)this);
} }

View file

@ -2,10 +2,12 @@
MwCXX::NumberEntry::NumberEntry(MwWidget widget) MwCXX::NumberEntry::NumberEntry(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::NumberEntry::NumberEntry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::NumberEntry::NumberEntry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwNumberEntryClass, name, parent, x, y, width, height) { : MwCXX::Base(MwNumberEntryClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
MwCXX::String MwCXX::NumberEntry::GetText() { MwCXX::String MwCXX::NumberEntry::GetText() {
@ -19,3 +21,16 @@ void MwCXX::NumberEntry::SetText(MwCXX::String value) {
MwSetText(this->widget, MwNtext, (MwCXX::String)value); MwSetText(this->widget, MwNtext, (MwCXX::String)value);
#endif #endif
} }
static void __OnActivate(MwWidget handle, void* user, void* call) {
((MwCXX::NumberEntry*)user)->OnActivate();
}
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::NumberEntry*)user)->OnChanged();
}
void MwCXX::NumberEntry::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNactivateHandler, __OnActivate, (void*)this);
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
}

View file

@ -3,8 +3,13 @@
MwCXX::OpenGL::OpenGL(MwWidget widget) MwCXX::OpenGL::OpenGL(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::OpenGL::OpenGL(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::OpenGL::OpenGL(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwOpenGLClass, name, parent, x, y, width, height) { : MwCXX::Base(MwOpenGLClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
}
void MwCXX::OpenGL::RegisterHandlers() {
} }

View file

@ -2,10 +2,12 @@
MwCXX::ProgressBar::ProgressBar(MwWidget widget) MwCXX::ProgressBar::ProgressBar(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::ProgressBar::ProgressBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::ProgressBar::ProgressBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwProgressBarClass, name, parent, x, y, width, height) { : MwCXX::Base(MwProgressBarClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::ProgressBar::GetMinValue() { int MwCXX::ProgressBar::GetMinValue() {
@ -31,3 +33,6 @@ int MwCXX::ProgressBar::GetValue() {
void MwCXX::ProgressBar::SetValue(int value) { void MwCXX::ProgressBar::SetValue(int value) {
MwSetInteger(this->widget, MwNvalue, (int)value); MwSetInteger(this->widget, MwNvalue, (int)value);
} }
void MwCXX::ProgressBar::RegisterHandlers() {
}

View file

@ -2,10 +2,12 @@
MwCXX::RadioBox::RadioBox(MwWidget widget) MwCXX::RadioBox::RadioBox(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::RadioBox::RadioBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::RadioBox::RadioBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwRadioBoxClass, name, parent, x, y, width, height) { : MwCXX::Base(MwRadioBoxClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::RadioBox::GetChecked() { int MwCXX::RadioBox::GetChecked() {
@ -15,3 +17,11 @@ int MwCXX::RadioBox::GetChecked() {
void MwCXX::RadioBox::SetChecked(int value) { void MwCXX::RadioBox::SetChecked(int value) {
MwSetInteger(this->widget, MwNchecked, (int)value); MwSetInteger(this->widget, MwNchecked, (int)value);
} }
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::RadioBox*)user)->OnChanged();
}
void MwCXX::RadioBox::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
}

View file

@ -2,10 +2,12 @@
MwCXX::ScrollBar::ScrollBar(MwWidget widget) MwCXX::ScrollBar::ScrollBar(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::ScrollBar::ScrollBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::ScrollBar::ScrollBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwScrollBarClass, name, parent, x, y, width, height) { : MwCXX::Base(MwScrollBarClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::ScrollBar::GetShowArrows() { int MwCXX::ScrollBar::GetShowArrows() {
@ -55,3 +57,11 @@ int MwCXX::ScrollBar::GetOrientation() {
void MwCXX::ScrollBar::SetOrientation(int value) { void MwCXX::ScrollBar::SetOrientation(int value) {
MwSetInteger(this->widget, MwNorientation, (int)value); MwSetInteger(this->widget, MwNorientation, (int)value);
} }
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::ScrollBar*)user)->OnChanged();
}
void MwCXX::ScrollBar::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
}

View file

@ -2,10 +2,12 @@
MwCXX::SubMenu::SubMenu(MwWidget widget) MwCXX::SubMenu::SubMenu(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::SubMenu::SubMenu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::SubMenu::SubMenu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwSubMenuClass, name, parent, x, y, width, height) { : MwCXX::Base(MwSubMenuClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::SubMenu::GetLeftPadding() { int MwCXX::SubMenu::GetLeftPadding() {
@ -15,3 +17,6 @@ int MwCXX::SubMenu::GetLeftPadding() {
void MwCXX::SubMenu::SetLeftPadding(int value) { void MwCXX::SubMenu::SetLeftPadding(int value) {
MwSetInteger(this->widget, MwNleftPadding, (int)value); MwSetInteger(this->widget, MwNleftPadding, (int)value);
} }
void MwCXX::SubMenu::RegisterHandlers() {
}

View file

@ -2,10 +2,12 @@
MwCXX::TreeView::TreeView(MwWidget widget) MwCXX::TreeView::TreeView(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::TreeView::TreeView(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::TreeView::TreeView(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwTreeViewClass, name, parent, x, y, width, height) { : MwCXX::Base(MwTreeViewClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
int MwCXX::TreeView::GetLeftPadding() { int MwCXX::TreeView::GetLeftPadding() {
@ -23,3 +25,11 @@ int MwCXX::TreeView::GetSingleClickSelectable() {
void MwCXX::TreeView::SetSingleClickSelectable(int value) { void MwCXX::TreeView::SetSingleClickSelectable(int value) {
MwSetInteger(this->widget, MwNsingleClickSelectable, (int)value); MwSetInteger(this->widget, MwNsingleClickSelectable, (int)value);
} }
static void __OnTreeViewActivate(MwWidget handle, void* user, void* call) {
((MwCXX::TreeView*)user)->OnTreeViewActivate((void*)call);
}
void MwCXX::TreeView::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNtreeViewActivateHandler, __OnTreeViewActivate, (void*)this);
}

View file

@ -2,8 +2,13 @@
MwCXX::Viewport::Viewport(MwWidget widget) MwCXX::Viewport::Viewport(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Viewport::Viewport(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Viewport::Viewport(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwViewportClass, name, parent, x, y, width, height) { : MwCXX::Base(MwViewportClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
}
void MwCXX::Viewport::RegisterHandlers() {
} }

View file

@ -3,8 +3,13 @@
MwCXX::Vulkan::Vulkan(MwWidget widget) MwCXX::Vulkan::Vulkan(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Vulkan::Vulkan(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Vulkan::Vulkan(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwVulkanClass, name, parent, x, y, width, height) { : MwCXX::Base(MwVulkanClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
}
void MwCXX::Vulkan::RegisterHandlers() {
} }

View file

@ -2,10 +2,12 @@
MwCXX::Window::Window(MwWidget widget) MwCXX::Window::Window(MwWidget widget)
: MwCXX::Base(widget) { : MwCXX::Base(widget) {
this->RegisterHandlers();
} }
MwCXX::Window::Window(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height) MwCXX::Window::Window(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height)
: MwCXX::Base(MwWindowClass, name, parent, x, y, width, height) { : MwCXX::Base(MwWindowClass, name, parent, x, y, width, height) {
this->RegisterHandlers();
} }
MwCXX::String MwCXX::Window::GetTitle() { MwCXX::String MwCXX::Window::GetTitle() {
@ -59,3 +61,6 @@ int MwCXX::Window::GetInverted() {
void MwCXX::Window::SetInverted(int value) { void MwCXX::Window::SetInverted(int value) {
MwSetInteger(this->widget, MwNinverted, (int)value); MwSetInteger(this->widget, MwNinverted, (int)value);
} }
void MwCXX::Window::RegisterHandlers() {
}