diff --git a/Makefile b/Makefile index b0bc06b..e1d92f1 100644 --- a/Makefile +++ b/Makefile @@ -9,17 +9,17 @@ SO = .so EXEC = .PHONY: all format clean -.SUFFIXES: .cxx .o +.SUFFIXES: .cc .o all: libMwCXX$(SO) format: - clang-format --verbose -i `find . -name "*.cxx" -or -name "*.h"` + clang-format --verbose -i `find . -name "*.cc" -or -name "*.h"` OBJS = src/core.o src/widget/base.o include objs.mk -src/widget/base.o: src/widget/base.cxx src/widget/baseauto.cxx +src/widget/base.o: src/widget/base.cc src/widget/baseauto.cc bindgen$(EXEC): bindgen.o $(CXX) -L$(XEMIL)/lib -L$(XEMIL)/src -o $@ bindgen.o -lxemil @@ -27,7 +27,7 @@ bindgen$(EXEC): bindgen.o libMwCXX$(SO): $(OBJS) $(CXX) -shared -L$(MILSKO)/lib -L$(MILSKO)/src -o $@ $(OBJS) -lMw -.cxx.o: +.cc.o: $(CXX) -fPIC -c -Iinclude -I$(MILSKO)/include -I$(XEMIL)/include -o $@ $< clean: diff --git a/bindgen.cxx b/bindgen.cc similarity index 70% rename from bindgen.cxx rename to bindgen.cc index 1e3158d..cc0c2df 100644 --- a/bindgen.cxx +++ b/bindgen.cc @@ -11,6 +11,7 @@ struct typeinfo { std::string type; std::string name; std::string struct_name; + std::string widget_type; int pointer; }; @@ -45,6 +46,12 @@ static std::string get_ctype(typeinfo type, int name = 1, int do_ptr = 1) { ret += "void*"; } else if(type.type == "struct") { ret += type.struct_name; + } else if(type.type == "widget") { + if(type.widget_type == ""){ + ret += "MwCXX::Base*"; + }else{ + ret += "MwCXX::" + type.widget_type + "*"; + } } if(do_ptr && type.pointer) ret += "*"; @@ -95,6 +102,7 @@ static typeinfo xml_to_type(xl_node_t* node) { 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"); return ret; @@ -116,16 +124,6 @@ static void scan_property(xl_node_t* node) { props[xl_get_attribute(node, "name")] = prop; } -static void scan_properties(xl_node_t* node) { - xl_node_t* child = node->first_child; - - while(child != NULL) { - scan_property(child); - - child = child->next; - } -} - static void scan_handler(xl_node_t* node) { handler handl; char* s; @@ -148,16 +146,6 @@ static void scan_handler(xl_node_t* node) { 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 = "") { std::stringstream strm; @@ -175,19 +163,6 @@ static std::string scan_widget_property_header(xl_node_t* node, std::string inde return widget_property_header(xl_get_attribute(node, "name"), indent); } -static std::string scan_widget_properties_header(xl_node_t* node, std::string indent) { - std::string r = ""; - xl_node_t* child = node->first_child; - - while(child != NULL) { - r += scan_widget_property_header(child, indent); - - child = child->next; - } - - return r; -} - static std::string widget_property_source(std::string widget, std::string name) { std::stringstream strm; @@ -223,19 +198,6 @@ static std::string scan_widget_property_source(xl_node_t* node, std::string widg return widget_property_source(widget, xl_get_attribute(node, "name")); } -static std::string scan_widget_properties_source(xl_node_t* node, std::string widget) { - std::string r = ""; - xl_node_t* child = node->first_child; - - while(child != NULL) { - 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; @@ -252,19 +214,6 @@ static std::string scan_widget_handler_header(xl_node_t* node, std::string inden 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 = ""; @@ -295,25 +244,10 @@ static std::string scan_widget_handler_source(xl_node_t* node, std::string widge 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; - } - - return r; -} - static void scan_widget(xl_node_t* node) { std::string name; xl_node_t** p_nodes; xl_node_t** h_nodes; - xl_node_t* child; - int i; if(node->type != XL_NODE_NODE) return; @@ -341,14 +275,18 @@ static void scan_widget(xl_node_t* node) { OFS << " virtual void RegisterHandlers();" << std::endl; OFS << std::endl; OFS << " public:" << std::endl; - OFS << " " + name + "(MwWidget widget);" << std::endl; + OFS << " " + name + "(MwWidget widget, MwCXX::Base* parent = NULL);" << std::endl; OFS << " " + name + "(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);" << std::endl; if(p_nodes != NULL) { std::string r = ""; - for(i = 0; p_nodes[i] != NULL; i++) { - r += scan_widget_properties_header(p_nodes[i], "\t\t"); + for(int i = 0; p_nodes[i] != NULL; i++) { + for(xl_node_t* child = p_nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + r += scan_widget_property_header(child, "\t\t"); + } } if(r != "") OFS << std::endl @@ -358,8 +296,12 @@ static void scan_widget(xl_node_t* node) { 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"); + for(int i = 0; h_nodes[i] != NULL; i++) { + for(xl_node_t* child = h_nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + r += scan_widget_handler_header(child, "\t\t"); + } } if(r != "") OFS << std::endl @@ -374,16 +316,16 @@ static void scan_widget(xl_node_t* node) { #undef OFS -#define OFS files["W" + name + ".cxx"] +#define OFS files["W" + name + ".cc"] - OFS = std::ofstream("src/widget/" + lowercase(name) + ".cxx"); + OFS = std::ofstream("src/widget/" + lowercase(name) + ".cc"); if(name == "OpenGL" || name == "Vulkan") OFS << "#define MW_" + uppercase(name) + "_NO_INCLUDE" << std::endl; OFS << "#include " << std::endl; OFS << std::endl; - OFS << "MwCXX::" + name + "::" + name + "(MwWidget widget) : MwCXX::Base(widget) {" << std::endl; + OFS << "MwCXX::" + name + "::" + name + "(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {" << std::endl; OFS << " this->RegisterHandlers();" << std::endl; OFS << "}" << std::endl; OFS << std::endl; @@ -394,21 +336,29 @@ static void scan_widget(xl_node_t* node) { OFS << std::endl; if(p_nodes != NULL) { - for(i = 0; p_nodes[i] != NULL; i++) { - OFS << scan_widget_properties_source(p_nodes[i], name); + for(int i = 0; p_nodes[i] != NULL; i++) { + for(xl_node_t* child = p_nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + OFS << scan_widget_property_source(child, name); + } } } if(h_nodes != NULL) { - for(i = 0; h_nodes[i] != NULL; i++) { - OFS << scan_widget_handlers_source(h_nodes[i], name); + for(int i = 0; h_nodes[i] != NULL; i++) { + for(xl_node_t* child = h_nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + OFS << scan_widget_handler_source(child, 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) { + for(int i = 0; h_nodes[i] != NULL; i++) { + for(xl_node_t* child = h_nodes[i]->first_child; child != NULL; child = child->next) { std::string hname; if(child->type != XL_NODE_NODE) continue; @@ -429,13 +379,91 @@ static void scan_widget(xl_node_t* node) { files["objs"] << " src/widget/" + lowercase(name) + ".o"; } -static void scan_widgets(xl_node_t* node) { - xl_node_t* child = node->first_child; +static std::string function_decl(xl_node_t* node, std::string prefix = ""){ + xl_node_t* ret = NULL; + xl_node_t** nodes; + std::string r = ""; - while(child != NULL) { - scan_widget(child); + if((nodes = xl_get_path(node, "return")) != NULL){ + for(int i = 0; nodes[i] != NULL; i++){ + for(xl_node_t* child = nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type == XL_NODE_NODE) ret = child; + } + } + } - child = child->next; + if(ret == NULL){ + r += "void "; + }else{ + r += get_ctype(xml_to_type(ret), 0, 0) + " "; + } + + r += prefix + std::string(xl_get_attribute(node, "name")).substr(2); + + r += "("; + if((nodes = xl_get_path(node, "arguments")) != NULL){ + for(int i = 0; nodes[i] != NULL; i++){ + for(xl_node_t* child = nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + if(r.substr(r.size() - 1, 1) != "(") r += ", "; + + r += get_ctype(xml_to_type(child), 1, 1); + } + } + } + r += ")"; + + return r; +} + +static std::string function_source(xl_node_t* node){ + return ""; +} + +static std::string function_header(xl_node_t* node){ + return function_decl(node) + ";"; +} + +static void scan_header(xl_node_t* node) { + std::string name; + + if(node->type != XL_NODE_NODE) return; + + name = xl_get_attribute(node, "name"); + + if(name.size() >= 7 && name.substr(0, 7) == "Dialog/"){ + xl_node_t** nodes; + +#define OFS files["D" + name.substr(7) + ".h"] + + OFS = std::ofstream("include/MwCXX/" + name + ".h"); + + OFS << "#ifndef __MWCXX_DIALOG_" + uppercase(name.substr(7)) + "_H__" << std::endl; + OFS << "#define __MWCXX_DIALOG_" + uppercase(name.substr(7)) + "_H__" << std::endl; + OFS << std::endl; + + OFS << "namespace MwCXX {" << std::endl; + if((nodes = xl_get_path(node, "functions")) != NULL){ + for(int i = 0; nodes[i] != NULL; i++){ + for(xl_node_t* child = nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + OFS << " " + function_header(child) << std::endl; + } + } + + free(nodes); + } + OFS << "}; // namespace MwCXX" << std::endl; + + OFS << std::endl; + OFS << "#endif" << std::endl; + +#undef OFS + +#define OFS files["D" + name.substr(7) + ".cc"] +#undef OFS } } @@ -464,9 +492,9 @@ static void base_widget() { #undef OFS -#define OFS files["WBaseAuto.cxx"] +#define OFS files["WBaseAuto.cc"] - OFS = std::ofstream("src/widget/baseauto.cxx"); + OFS = std::ofstream("src/widget/baseauto.cc"); OFS << "#include " << std::endl; @@ -520,7 +548,11 @@ int main(int argc, char** argv) { if((nodes = xl_get_path(h->root, "properties")) != NULL) { for(int i = 0; nodes[i] != NULL; i++) { - scan_properties(nodes[i]); + for(xl_node_t* child = nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + scan_property(child); + } } free(nodes); @@ -528,7 +560,23 @@ int main(int argc, char** argv) { if((nodes = xl_get_path(h->root, "handlers")) != NULL) { for(int i = 0; nodes[i] != NULL; i++) { - scan_handlers(nodes[i]); + for(xl_node_t* child = nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + scan_handler(child); + } + } + + free(nodes); + } + + if((nodes = xl_get_path(h->root, "headers")) != NULL) { + for(int i = 0; nodes[i] != NULL; i++) { + for(xl_node_t* child = nodes[i]->first_child; child != NULL; child = child->next){ + if(child->type != XL_NODE_NODE) continue; + + scan_header(child); + } } free(nodes); @@ -538,7 +586,9 @@ int main(int argc, char** argv) { if((nodes = xl_get_path(h->root, "widgets")) != NULL) { for(int i = 0; nodes[i] != NULL; i++) { - scan_widgets(nodes[i]); + for(xl_node_t* child = nodes[i]->first_child; child != NULL; child = child->next){ + scan_widget(child); + } } free(nodes); diff --git a/include/MwCXX/Dialog/ColorChooser.h b/include/MwCXX/Dialog/ColorChooser.h new file mode 100644 index 0000000..66b886f --- /dev/null +++ b/include/MwCXX/Dialog/ColorChooser.h @@ -0,0 +1,8 @@ +#ifndef __MWCXX_DIALOG_COLORCHOOSER_H__ +#define __MWCXX_DIALOG_COLORCHOOSER_H__ + +namespace MwCXX { + MwCXX::Window* ColorChooser(MwCXX::Base* handle, MwCXX::String title); +}; // namespace MwCXX + +#endif diff --git a/include/MwCXX/Dialog/DirectoryChooser.h b/include/MwCXX/Dialog/DirectoryChooser.h new file mode 100644 index 0000000..7f2c015 --- /dev/null +++ b/include/MwCXX/Dialog/DirectoryChooser.h @@ -0,0 +1,8 @@ +#ifndef __MWCXX_DIALOG_DIRECTORYCHOOSER_H__ +#define __MWCXX_DIALOG_DIRECTORYCHOOSER_H__ + +namespace MwCXX { + MwCXX::Window* DirectoryChooser(MwCXX::Base* handle, MwCXX::String title); +}; // namespace MwCXX + +#endif diff --git a/include/MwCXX/Dialog/FileChooser.h b/include/MwCXX/Dialog/FileChooser.h new file mode 100644 index 0000000..12c0818 --- /dev/null +++ b/include/MwCXX/Dialog/FileChooser.h @@ -0,0 +1,9 @@ +#ifndef __MWCXX_DIALOG_FILECHOOSER_H__ +#define __MWCXX_DIALOG_FILECHOOSER_H__ + +namespace MwCXX { + MwCXX::Window* FileChooser(MwCXX::Base* handle, MwCXX::String title); + MwCXX::Window* FileChooserEx(MwCXX::Base* handle, MwCXX::String title, int dir); +}; // namespace MwCXX + +#endif diff --git a/include/MwCXX/Dialog/MessageBox.h b/include/MwCXX/Dialog/MessageBox.h new file mode 100644 index 0000000..53f02a4 --- /dev/null +++ b/include/MwCXX/Dialog/MessageBox.h @@ -0,0 +1,10 @@ +#ifndef __MWCXX_DIALOG_MESSAGEBOX_H__ +#define __MWCXX_DIALOG_MESSAGEBOX_H__ + +namespace MwCXX { + MwCXX::Window* MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, int flag); + MwCXX::Button* MessageBoxGetChild(MwCXX::Window* handle, int child); + void MessageBoxDestroy(MwCXX::Window* handle); +}; // namespace MwCXX + +#endif diff --git a/include/MwCXX/MachDep.h b/include/MwCXX/MachDep.h index 0fd78f9..0d16c52 100644 --- a/include/MwCXX/MachDep.h +++ b/include/MwCXX/MachDep.h @@ -4,6 +4,7 @@ #include #include +#include // #define MWCXX_USE_C_STRING diff --git a/include/MwCXX/Widget/Base.h b/include/MwCXX/Widget/Base.h index a1d5e5f..ce0a544 100644 --- a/include/MwCXX/Widget/Base.h +++ b/include/MwCXX/Widget/Base.h @@ -10,9 +10,13 @@ namespace MwCXX { MwWidget widget; + MwCXX::Base* parent; + std::vector children; + public: - Base(MwWidget widget); + Base(MwWidget widget, MwCXX::Base* parent = NULL); Base(MwClass widget_class, MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); + ~Base(); MwRect GetArea(); void SetArea(MwRect r); @@ -20,8 +24,12 @@ namespace MwCXX { void Move(int x, int y); void Resize(unsigned int width, unsigned int height); + int Step(); + int Pending(); void Loop(); + MwCXX::Base* GetParent(); + #include }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/BaseAuto.h b/include/MwCXX/Widget/BaseAuto.h index e3b5fa9..1afd16f 100644 --- a/include/MwCXX/Widget/BaseAuto.h +++ b/include/MwCXX/Widget/BaseAuto.h @@ -1,41 +1,41 @@ MwCXX::String GetBackground(); -void SetBackground(MwCXX::String value); -MwLLPixmap GetBackgroundPixmap(); -void SetBackgroundPixmap(MwLLPixmap value); -int GetBitmapFont(); -void SetBitmapFont(int value); -int GetBorderWidth(); -void SetBorderWidth(int value); -int GetDarkTheme(); -void SetDarkTheme(int value); -int GetFixedSize(); -void SetFixedSize(int value); -int GetForceInverted(); -void SetForceInverted(int value); +void SetBackground(MwCXX::String value); +MwLLPixmap GetBackgroundPixmap(); +void SetBackgroundPixmap(MwLLPixmap value); +int GetBitmapFont(); +void SetBitmapFont(int value); +int GetBorderWidth(); +void SetBorderWidth(int value); +int GetDarkTheme(); +void SetDarkTheme(int value); +int GetFixedSize(); +void SetFixedSize(int value); +int GetForceInverted(); +void SetForceInverted(int value); MwCXX::String GetForeground(); -void SetForeground(MwCXX::String value); -int GetHeight(); -void SetHeight(int value); -int GetIsRounded(); -void SetIsRounded(int value); -int GetModernLook(); -void SetModernLook(int value); -int GetRatio(); -void SetRatio(int value); +void SetForeground(MwCXX::String value); +int GetHeight(); +void SetHeight(int value); +int GetIsRounded(); +void SetIsRounded(int value); +int GetModernLook(); +void SetModernLook(int value); +int GetRatio(); +void SetRatio(int value); MwCXX::String GetSubBackground(); -void SetSubBackground(MwCXX::String value); +void SetSubBackground(MwCXX::String value); MwCXX::String GetSubForeground(); -void SetSubForeground(MwCXX::String value); -int GetUseMonospace(); -void SetUseMonospace(int value); -int GetWaitMS(); -void SetWaitMS(int value); -int GetWidth(); -void SetWidth(int value); -int GetX(); -void SetX(int value); -int GetY(); -void SetY(int value); +void SetSubForeground(MwCXX::String value); +int GetUseMonospace(); +void SetUseMonospace(int value); +int GetWaitMS(); +void SetWaitMS(int value); +int GetWidth(); +void SetWidth(int value); +int GetX(); +void SetX(int value); +int GetY(); +void SetY(int value); virtual void OnClipboard(MwCXX::String value) {}; virtual void OnDarkTheme(int value) {}; diff --git a/include/MwCXX/Widget/Box.h b/include/MwCXX/Widget/Box.h index 7fbca55..332ef72 100644 --- a/include/MwCXX/Widget/Box.h +++ b/include/MwCXX/Widget/Box.h @@ -12,18 +12,18 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Box(MwWidget widget); + Box(MwWidget widget, MwCXX::Base* parent = NULL); Box(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - int GetOrientation(); + int GetOrientation(); void SetOrientation(int value); - int GetMargin(); + int GetMargin(); void SetMargin(int value); - int GetPadding(); + int GetPadding(); void SetPadding(int value); - int GetHasBorder(); + int GetHasBorder(); void SetHasBorder(int value); - int GetInverted(); + int GetInverted(); void SetInverted(int value); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/Button.h b/include/MwCXX/Widget/Button.h index fcfe5ed..5f1a7fa 100644 --- a/include/MwCXX/Widget/Button.h +++ b/include/MwCXX/Widget/Button.h @@ -12,19 +12,19 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Button(MwWidget widget); + Button(MwWidget widget, MwCXX::Base* parent = NULL); Button(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - MwLLPixmap GetPixmap(); - void SetPixmap(MwLLPixmap value); + MwLLPixmap GetPixmap(); + void SetPixmap(MwLLPixmap value); MwCXX::String GetText(); - void SetText(MwCXX::String value); - int GetFlat(); - void SetFlat(int value); - int GetPadding(); - void SetPadding(int value); - int GetFillArea(); - void SetFillArea(int value); + void SetText(MwCXX::String value); + int GetFlat(); + void SetFlat(int value); + int GetPadding(); + void SetPadding(int value); + int GetFillArea(); + void SetFillArea(int value); virtual void OnActivate() {}; virtual void OnChanged() {}; diff --git a/include/MwCXX/Widget/CheckBox.h b/include/MwCXX/Widget/CheckBox.h index 023ef8f..36a8d79 100644 --- a/include/MwCXX/Widget/CheckBox.h +++ b/include/MwCXX/Widget/CheckBox.h @@ -12,10 +12,10 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - CheckBox(MwWidget widget); + CheckBox(MwWidget widget, MwCXX::Base* parent = NULL); 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); virtual void OnChanged() {}; diff --git a/include/MwCXX/Widget/ComboBox.h b/include/MwCXX/Widget/ComboBox.h index a4ddbf8..01ec876 100644 --- a/include/MwCXX/Widget/ComboBox.h +++ b/include/MwCXX/Widget/ComboBox.h @@ -12,12 +12,12 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - ComboBox(MwWidget widget); + ComboBox(MwWidget widget, MwCXX::Base* parent = NULL); ComboBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - int GetAreaShown(); + int GetAreaShown(); void SetAreaShown(int value); - int GetValue(); + int GetValue(); void SetValue(int value); virtual void OnComboBoxChanged(int value) {}; diff --git a/include/MwCXX/Widget/Entry.h b/include/MwCXX/Widget/Entry.h index 9bfeede..82d251d 100644 --- a/include/MwCXX/Widget/Entry.h +++ b/include/MwCXX/Widget/Entry.h @@ -12,13 +12,13 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Entry(MwWidget widget); + Entry(MwWidget widget, MwCXX::Base* parent = NULL); Entry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); MwCXX::String GetText(); - void SetText(MwCXX::String value); - int GetHideInput(); - void SetHideInput(int value); + void SetText(MwCXX::String value); + int GetHideInput(); + void SetHideInput(int value); virtual void OnActivate() {}; virtual void OnChanged() {}; diff --git a/include/MwCXX/Widget/Frame.h b/include/MwCXX/Widget/Frame.h index f97cb54..a430c0c 100644 --- a/include/MwCXX/Widget/Frame.h +++ b/include/MwCXX/Widget/Frame.h @@ -12,12 +12,12 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Frame(MwWidget widget); + Frame(MwWidget widget, MwCXX::Base* parent = NULL); Frame(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - int GetHasBorder(); + int GetHasBorder(); void SetHasBorder(int value); - int GetInverted(); + int GetInverted(); void SetInverted(int value); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/Image.h b/include/MwCXX/Widget/Image.h index 58cde81..063301f 100644 --- a/include/MwCXX/Widget/Image.h +++ b/include/MwCXX/Widget/Image.h @@ -12,17 +12,17 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Image(MwWidget widget); + Image(MwWidget widget, MwCXX::Base* parent = NULL); Image(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); MwLLPixmap GetPixmap(); - void SetPixmap(MwLLPixmap value); - int GetHasBorder(); - void SetHasBorder(int value); - int GetInverted(); - void SetInverted(int value); - int GetFillArea(); - void SetFillArea(int value); + void SetPixmap(MwLLPixmap value); + int GetHasBorder(); + void SetHasBorder(int value); + int GetInverted(); + void SetInverted(int value); + int GetFillArea(); + void SetFillArea(int value); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/Label.h b/include/MwCXX/Widget/Label.h index 1d2f6da..f81524e 100644 --- a/include/MwCXX/Widget/Label.h +++ b/include/MwCXX/Widget/Label.h @@ -12,21 +12,21 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Label(MwWidget widget); + Label(MwWidget widget, MwCXX::Base* parent = NULL); Label(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); MwCXX::String GetText(); - void SetText(MwCXX::String value); - int GetAlignment(); - void SetAlignment(int value); - int GetBold(); - void SetBold(int value); - int GetSevenSegment(); - void SetSevenSegment(int value); - int GetLength(); - void SetLength(int value); - int GetLeftPadding(); - void SetLeftPadding(int value); + void SetText(MwCXX::String value); + int GetAlignment(); + void SetAlignment(int value); + int GetBold(); + void SetBold(int value); + int GetSevenSegment(); + void SetSevenSegment(int value); + int GetLength(); + void SetLength(int value); + int GetLeftPadding(); + void SetLeftPadding(int value); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/ListBox.h b/include/MwCXX/Widget/ListBox.h index 6083583..f7aacda 100644 --- a/include/MwCXX/Widget/ListBox.h +++ b/include/MwCXX/Widget/ListBox.h @@ -12,14 +12,14 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - ListBox(MwWidget widget); + ListBox(MwWidget widget, MwCXX::Base* parent = NULL); ListBox(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - int GetLeftPadding(); + int GetLeftPadding(); void SetLeftPadding(int value); - int GetHasHeading(); + int GetHasHeading(); void SetHasHeading(int value); - int GetSingleClickSelectable(); + int GetSingleClickSelectable(); void SetSingleClickSelectable(int value); virtual void OnListBoxActivate(int value) {}; diff --git a/include/MwCXX/Widget/Menu.h b/include/MwCXX/Widget/Menu.h index 132bbb3..602fcff 100644 --- a/include/MwCXX/Widget/Menu.h +++ b/include/MwCXX/Widget/Menu.h @@ -12,7 +12,7 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Menu(MwWidget widget); + Menu(MwWidget widget, MwCXX::Base* parent = NULL); Menu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); virtual void OnMenu(void* value) {}; diff --git a/include/MwCXX/Widget/NumberEntry.h b/include/MwCXX/Widget/NumberEntry.h index 1dabc77..29ca4e5 100644 --- a/include/MwCXX/Widget/NumberEntry.h +++ b/include/MwCXX/Widget/NumberEntry.h @@ -12,11 +12,11 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - NumberEntry(MwWidget widget); + NumberEntry(MwWidget widget, MwCXX::Base* parent = NULL); NumberEntry(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); MwCXX::String GetText(); - void SetText(MwCXX::String value); + void SetText(MwCXX::String value); virtual void OnActivate() {}; virtual void OnChanged() {}; diff --git a/include/MwCXX/Widget/OpenGL.h b/include/MwCXX/Widget/OpenGL.h index ebd2cf8..75e2251 100644 --- a/include/MwCXX/Widget/OpenGL.h +++ b/include/MwCXX/Widget/OpenGL.h @@ -12,7 +12,7 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - OpenGL(MwWidget widget); + OpenGL(MwWidget widget, MwCXX::Base* parent = NULL); OpenGL(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/ProgressBar.h b/include/MwCXX/Widget/ProgressBar.h index ed21f9c..d776a64 100644 --- a/include/MwCXX/Widget/ProgressBar.h +++ b/include/MwCXX/Widget/ProgressBar.h @@ -12,14 +12,14 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - ProgressBar(MwWidget widget); + ProgressBar(MwWidget widget, MwCXX::Base* parent = NULL); ProgressBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - int GetMinValue(); + int GetMinValue(); void SetMinValue(int value); - int GetMaxValue(); + int GetMaxValue(); void SetMaxValue(int value); - int GetValue(); + int GetValue(); void SetValue(int value); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/RadioBox.h b/include/MwCXX/Widget/RadioBox.h index 2d26731..e51fb1d 100644 --- a/include/MwCXX/Widget/RadioBox.h +++ b/include/MwCXX/Widget/RadioBox.h @@ -12,10 +12,10 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - RadioBox(MwWidget widget); + RadioBox(MwWidget widget, MwCXX::Base* parent = NULL); 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); virtual void OnChanged() {}; diff --git a/include/MwCXX/Widget/ScrollBar.h b/include/MwCXX/Widget/ScrollBar.h index f315150..d1c7f10 100644 --- a/include/MwCXX/Widget/ScrollBar.h +++ b/include/MwCXX/Widget/ScrollBar.h @@ -12,20 +12,20 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - ScrollBar(MwWidget widget); + ScrollBar(MwWidget widget, MwCXX::Base* parent = NULL); ScrollBar(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - int GetShowArrows(); + int GetShowArrows(); void SetShowArrows(int value); - int GetAreaShown(); + int GetAreaShown(); void SetAreaShown(int value); - int GetValue(); + int GetValue(); void SetValue(int value); - int GetMinValue(); + int GetMinValue(); void SetMinValue(int value); - int GetMaxValue(); + int GetMaxValue(); void SetMaxValue(int value); - int GetOrientation(); + int GetOrientation(); void SetOrientation(int value); virtual void OnChanged() {}; diff --git a/include/MwCXX/Widget/SubMenu.h b/include/MwCXX/Widget/SubMenu.h index 37104ad..9886f2b 100644 --- a/include/MwCXX/Widget/SubMenu.h +++ b/include/MwCXX/Widget/SubMenu.h @@ -12,10 +12,10 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - SubMenu(MwWidget widget); + SubMenu(MwWidget widget, MwCXX::Base* parent = NULL); SubMenu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - int GetLeftPadding(); + int GetLeftPadding(); void SetLeftPadding(int value); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/TreeView.h b/include/MwCXX/Widget/TreeView.h index 0b6e401..f89e427 100644 --- a/include/MwCXX/Widget/TreeView.h +++ b/include/MwCXX/Widget/TreeView.h @@ -12,12 +12,12 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - TreeView(MwWidget widget); + TreeView(MwWidget widget, MwCXX::Base* parent = NULL); TreeView(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); - int GetLeftPadding(); + int GetLeftPadding(); void SetLeftPadding(int value); - int GetSingleClickSelectable(); + int GetSingleClickSelectable(); void SetSingleClickSelectable(int value); virtual void OnTreeViewActivate(void* value) {}; diff --git a/include/MwCXX/Widget/Viewport.h b/include/MwCXX/Widget/Viewport.h index de5e7e3..24fef87 100644 --- a/include/MwCXX/Widget/Viewport.h +++ b/include/MwCXX/Widget/Viewport.h @@ -12,7 +12,7 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Viewport(MwWidget widget); + Viewport(MwWidget widget, MwCXX::Base* parent = NULL); Viewport(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/Vulkan.h b/include/MwCXX/Widget/Vulkan.h index 3280def..cf0bd2e 100644 --- a/include/MwCXX/Widget/Vulkan.h +++ b/include/MwCXX/Widget/Vulkan.h @@ -12,7 +12,7 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Vulkan(MwWidget widget); + Vulkan(MwWidget widget, MwCXX::Base* parent = NULL); Vulkan(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); }; }; // namespace MwCXX diff --git a/include/MwCXX/Widget/Window.h b/include/MwCXX/Widget/Window.h index cff5e45..7476b1e 100644 --- a/include/MwCXX/Widget/Window.h +++ b/include/MwCXX/Widget/Window.h @@ -12,21 +12,21 @@ namespace MwCXX { virtual void RegisterHandlers(); public: - Window(MwWidget widget); + Window(MwWidget widget, MwCXX::Base* parent = NULL); Window(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height); MwCXX::String GetTitle(); - void SetTitle(MwCXX::String value); - int GetMain(); - void SetMain(int value); - MwLLPixmap GetIconPixmap(); - void SetIconPixmap(MwLLPixmap value); - MwSizeHints* GetSizeHints(); - void SetSizeHints(MwSizeHints* value); - int GetHasBorder(); - void SetHasBorder(int value); - int GetInverted(); - void SetInverted(int value); + void SetTitle(MwCXX::String value); + int GetMain(); + void SetMain(int value); + MwLLPixmap GetIconPixmap(); + void SetIconPixmap(MwLLPixmap value); + MwSizeHints* GetSizeHints(); + void SetSizeHints(MwSizeHints* value); + int GetHasBorder(); + void SetHasBorder(int value); + int GetInverted(); + void SetInverted(int value); }; }; // namespace MwCXX diff --git a/src/core.cxx b/src/core.cc similarity index 100% rename from src/core.cxx rename to src/core.cc diff --git a/src/widget/base.cxx b/src/widget/base.cc similarity index 63% rename from src/widget/base.cxx rename to src/widget/base.cc index 2258ab9..517c9ee 100644 --- a/src/widget/base.cxx +++ b/src/widget/base.cc @@ -1,7 +1,8 @@ #include -MwCXX::Base::Base(MwWidget widget) { +MwCXX::Base::Base(MwWidget widget, MwCXX::Base* parent) { this->widget = widget; + this->parent = parent; this->RegisterHandlers(); } @@ -13,9 +14,30 @@ MwCXX::Base::Base(MwClass widget_class, MwCXX::String name, MwCXX::Base* parent, this->widget = MwCreateWidget(widget_class, name.c_str(), parent == NULL ? NULL : parent->widget, x, y, width, height); #endif + this->parent = parent; + + if(parent != NULL) parent->children.push_back(this); + this->RegisterHandlers(); } +MwCXX::Base::~Base(){ + for(int i = 0; i < this->children.size(); i++){ + delete this->children[i]; + } + + if(this->parent != NULL){ + for(int i = 0; i < this->parent->children.size(); i++){ + if(this->parent->children[i] == this){ + this->parent->children.erase(this->parent->children.begin() + i); + break; + } + } + } + + MwDestroyWidget(this->widget); +} + MwRect MwCXX::Base::GetArea() { MwRect rc; @@ -50,6 +72,18 @@ void MwCXX::Base::Resize(unsigned int width, unsigned int height) { NULL); } +int MwCXX::Base::Step() { + return MwStep(this->widget); +} + +int MwCXX::Base::Pending() { + return MwPending(this->widget); +} + void MwCXX::Base::Loop() { MwLoop(this->widget); } + +MwCXX::Base* MwCXX::Base::GetParent(){ + return this->parent; +} diff --git a/src/widget/baseauto.cc b/src/widget/baseauto.cc new file mode 100644 index 0000000..80ea781 --- /dev/null +++ b/src/widget/baseauto.cc @@ -0,0 +1,226 @@ +#include +MwCXX::String MwCXX::Base::GetBackground() { + return (MwCXX::String)MwGetText(this->widget, MwNbackground); +} + +void MwCXX::Base::SetBackground(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNbackground, value.c_str()); +#else + MwSetText(this->widget, MwNbackground, (MwCXX::String)value); +#endif +} + +MwLLPixmap MwCXX::Base::GetBackgroundPixmap() { + return (MwLLPixmap)MwGetVoid(this->widget, MwNbackgroundPixmap); +} + +void MwCXX::Base::SetBackgroundPixmap(MwLLPixmap value) { + MwSetVoid(this->widget, MwNbackgroundPixmap, (MwLLPixmap)value); +} + +int MwCXX::Base::GetBitmapFont() { + return (int)MwGetInteger(this->widget, MwNbitmapFont); +} + +void MwCXX::Base::SetBitmapFont(int value) { + MwSetInteger(this->widget, MwNbitmapFont, (int)value); +} + +int MwCXX::Base::GetBorderWidth() { + return (int)MwGetInteger(this->widget, MwNborderWidth); +} + +void MwCXX::Base::SetBorderWidth(int value) { + MwSetInteger(this->widget, MwNborderWidth, (int)value); +} + +int MwCXX::Base::GetDarkTheme() { + return (int)MwGetInteger(this->widget, MwNdarkTheme); +} + +void MwCXX::Base::SetDarkTheme(int value) { + MwSetInteger(this->widget, MwNdarkTheme, (int)value); +} + +int MwCXX::Base::GetFixedSize() { + return (int)MwGetInteger(this->widget, MwNfixedSize); +} + +void MwCXX::Base::SetFixedSize(int value) { + MwSetInteger(this->widget, MwNfixedSize, (int)value); +} + +int MwCXX::Base::GetForceInverted() { + return (int)MwGetInteger(this->widget, MwNforceInverted); +} + +void MwCXX::Base::SetForceInverted(int value) { + MwSetInteger(this->widget, MwNforceInverted, (int)value); +} + +MwCXX::String MwCXX::Base::GetForeground() { + return (MwCXX::String)MwGetText(this->widget, MwNforeground); +} + +void MwCXX::Base::SetForeground(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNforeground, value.c_str()); +#else + MwSetText(this->widget, MwNforeground, (MwCXX::String)value); +#endif +} + +int MwCXX::Base::GetHeight() { + return (int)MwGetInteger(this->widget, MwNheight); +} + +void MwCXX::Base::SetHeight(int value) { + MwSetInteger(this->widget, MwNheight, (int)value); +} + +int MwCXX::Base::GetIsRounded() { + return (int)MwGetInteger(this->widget, MwNisRounded); +} + +void MwCXX::Base::SetIsRounded(int value) { + MwSetInteger(this->widget, MwNisRounded, (int)value); +} + +int MwCXX::Base::GetModernLook() { + return (int)MwGetInteger(this->widget, MwNmodernLook); +} + +void MwCXX::Base::SetModernLook(int value) { + MwSetInteger(this->widget, MwNmodernLook, (int)value); +} + +int MwCXX::Base::GetRatio() { + return (int)MwGetInteger(this->widget, MwNratio); +} + +void MwCXX::Base::SetRatio(int value) { + MwSetInteger(this->widget, MwNratio, (int)value); +} + +MwCXX::String MwCXX::Base::GetSubBackground() { + return (MwCXX::String)MwGetText(this->widget, MwNsubBackground); +} + +void MwCXX::Base::SetSubBackground(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNsubBackground, value.c_str()); +#else + MwSetText(this->widget, MwNsubBackground, (MwCXX::String)value); +#endif +} + +MwCXX::String MwCXX::Base::GetSubForeground() { + return (MwCXX::String)MwGetText(this->widget, MwNsubForeground); +} + +void MwCXX::Base::SetSubForeground(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNsubForeground, value.c_str()); +#else + MwSetText(this->widget, MwNsubForeground, (MwCXX::String)value); +#endif +} + +int MwCXX::Base::GetUseMonospace() { + return (int)MwGetInteger(this->widget, MwNuseMonospace); +} + +void MwCXX::Base::SetUseMonospace(int value) { + MwSetInteger(this->widget, MwNuseMonospace, (int)value); +} + +int MwCXX::Base::GetWaitMS() { + return (int)MwGetInteger(this->widget, MwNwaitMS); +} + +void MwCXX::Base::SetWaitMS(int value) { + MwSetInteger(this->widget, MwNwaitMS, (int)value); +} + +int MwCXX::Base::GetWidth() { + return (int)MwGetInteger(this->widget, MwNwidth); +} + +void MwCXX::Base::SetWidth(int value) { + MwSetInteger(this->widget, MwNwidth, (int)value); +} + +int MwCXX::Base::GetX() { + return (int)MwGetInteger(this->widget, MwNx); +} + +void MwCXX::Base::SetX(int value) { + MwSetInteger(this->widget, MwNx, (int)value); +} + +int MwCXX::Base::GetY() { + return (int)MwGetInteger(this->widget, MwNy); +} + +void MwCXX::Base::SetY(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); +} diff --git a/src/widget/box.cc b/src/widget/box.cc new file mode 100644 index 0000000..984558e --- /dev/null +++ b/src/widget/box.cc @@ -0,0 +1,52 @@ +#include + +MwCXX::Box::Box(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::Box::GetOrientation() { + return (int)MwGetInteger(this->widget, MwNorientation); +} + +void MwCXX::Box::SetOrientation(int value) { + MwSetInteger(this->widget, MwNorientation, (int)value); +} + +int MwCXX::Box::GetMargin() { + return (int)MwGetInteger(this->widget, MwNmargin); +} + +void MwCXX::Box::SetMargin(int value) { + MwSetInteger(this->widget, MwNmargin, (int)value); +} + +int MwCXX::Box::GetPadding() { + return (int)MwGetInteger(this->widget, MwNpadding); +} + +void MwCXX::Box::SetPadding(int value) { + MwSetInteger(this->widget, MwNpadding, (int)value); +} + +int MwCXX::Box::GetHasBorder() { + return (int)MwGetInteger(this->widget, MwNhasBorder); +} + +void MwCXX::Box::SetHasBorder(int value) { + MwSetInteger(this->widget, MwNhasBorder, (int)value); +} + +int MwCXX::Box::GetInverted() { + return (int)MwGetInteger(this->widget, MwNinverted); +} + +void MwCXX::Box::SetInverted(int value) { + MwSetInteger(this->widget, MwNinverted, (int)value); +} + +void MwCXX::Box::RegisterHandlers() { +} diff --git a/src/widget/box.cxx b/src/widget/box.cxx index 583f90f..984558e 100644 --- a/src/widget/box.cxx +++ b/src/widget/box.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Box::Box(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Box::Box(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/button.cc b/src/widget/button.cc new file mode 100644 index 0000000..4aac97f --- /dev/null +++ b/src/widget/button.cc @@ -0,0 +1,66 @@ +#include + +MwCXX::Button::Button(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +MwLLPixmap MwCXX::Button::GetPixmap() { + return (MwLLPixmap)MwGetVoid(this->widget, MwNpixmap); +} + +void MwCXX::Button::SetPixmap(MwLLPixmap value) { + MwSetVoid(this->widget, MwNpixmap, (MwLLPixmap)value); +} + +MwCXX::String MwCXX::Button::GetText() { + return (MwCXX::String)MwGetText(this->widget, MwNtext); +} + +void MwCXX::Button::SetText(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNtext, value.c_str()); +#else + MwSetText(this->widget, MwNtext, (MwCXX::String)value); +#endif +} + +int MwCXX::Button::GetFlat() { + return (int)MwGetInteger(this->widget, MwNflat); +} + +void MwCXX::Button::SetFlat(int value) { + MwSetInteger(this->widget, MwNflat, (int)value); +} + +int MwCXX::Button::GetPadding() { + return (int)MwGetInteger(this->widget, MwNpadding); +} + +void MwCXX::Button::SetPadding(int value) { + MwSetInteger(this->widget, MwNpadding, (int)value); +} + +int MwCXX::Button::GetFillArea() { + return (int)MwGetInteger(this->widget, MwNfillArea); +} + +void MwCXX::Button::SetFillArea(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); +} diff --git a/src/widget/button.cxx b/src/widget/button.cxx index ddf6135..4aac97f 100644 --- a/src/widget/button.cxx +++ b/src/widget/button.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Button::Button(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Button::Button(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/checkbox.cc b/src/widget/checkbox.cc new file mode 100644 index 0000000..f598ec7 --- /dev/null +++ b/src/widget/checkbox.cc @@ -0,0 +1,25 @@ +#include + +MwCXX::CheckBox::CheckBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::CheckBox::GetChecked() { + return (int)MwGetInteger(this->widget, MwNchecked); +} + +void MwCXX::CheckBox::SetChecked(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); +} diff --git a/src/widget/checkbox.cxx b/src/widget/checkbox.cxx index 9adf16b..f598ec7 100644 --- a/src/widget/checkbox.cxx +++ b/src/widget/checkbox.cxx @@ -1,12 +1,10 @@ #include -MwCXX::CheckBox::CheckBox(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::CheckBox::CheckBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/combobox.cc b/src/widget/combobox.cc new file mode 100644 index 0000000..047b713 --- /dev/null +++ b/src/widget/combobox.cc @@ -0,0 +1,33 @@ +#include + +MwCXX::ComboBox::ComboBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::ComboBox::GetAreaShown() { + return (int)MwGetInteger(this->widget, MwNareaShown); +} + +void MwCXX::ComboBox::SetAreaShown(int value) { + MwSetInteger(this->widget, MwNareaShown, (int)value); +} + +int MwCXX::ComboBox::GetValue() { + return (int)MwGetInteger(this->widget, MwNvalue); +} + +void MwCXX::ComboBox::SetValue(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); +} diff --git a/src/widget/combobox.cxx b/src/widget/combobox.cxx index 4de6f04..047b713 100644 --- a/src/widget/combobox.cxx +++ b/src/widget/combobox.cxx @@ -1,12 +1,10 @@ #include -MwCXX::ComboBox::ComboBox(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::ComboBox::ComboBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/entry.cc b/src/widget/entry.cc new file mode 100644 index 0000000..6c53b1e --- /dev/null +++ b/src/widget/entry.cc @@ -0,0 +1,42 @@ +#include + +MwCXX::Entry::Entry(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +MwCXX::String MwCXX::Entry::GetText() { + return (MwCXX::String)MwGetText(this->widget, MwNtext); +} + +void MwCXX::Entry::SetText(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNtext, value.c_str()); +#else + MwSetText(this->widget, MwNtext, (MwCXX::String)value); +#endif +} + +int MwCXX::Entry::GetHideInput() { + return (int)MwGetInteger(this->widget, MwNhideInput); +} + +void MwCXX::Entry::SetHideInput(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); +} diff --git a/src/widget/entry.cxx b/src/widget/entry.cxx index 1ac8000..6c53b1e 100644 --- a/src/widget/entry.cxx +++ b/src/widget/entry.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Entry::Entry(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Entry::Entry(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/frame.cc b/src/widget/frame.cc new file mode 100644 index 0000000..d9df84a --- /dev/null +++ b/src/widget/frame.cc @@ -0,0 +1,28 @@ +#include + +MwCXX::Frame::Frame(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::Frame::GetHasBorder() { + return (int)MwGetInteger(this->widget, MwNhasBorder); +} + +void MwCXX::Frame::SetHasBorder(int value) { + MwSetInteger(this->widget, MwNhasBorder, (int)value); +} + +int MwCXX::Frame::GetInverted() { + return (int)MwGetInteger(this->widget, MwNinverted); +} + +void MwCXX::Frame::SetInverted(int value) { + MwSetInteger(this->widget, MwNinverted, (int)value); +} + +void MwCXX::Frame::RegisterHandlers() { +} diff --git a/src/widget/frame.cxx b/src/widget/frame.cxx index 2fbac27..d9df84a 100644 --- a/src/widget/frame.cxx +++ b/src/widget/frame.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Frame::Frame(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Frame::Frame(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/image.cc b/src/widget/image.cc new file mode 100644 index 0000000..ee1a131 --- /dev/null +++ b/src/widget/image.cc @@ -0,0 +1,44 @@ +#include + +MwCXX::Image::Image(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +MwLLPixmap MwCXX::Image::GetPixmap() { + return (MwLLPixmap)MwGetVoid(this->widget, MwNpixmap); +} + +void MwCXX::Image::SetPixmap(MwLLPixmap value) { + MwSetVoid(this->widget, MwNpixmap, (MwLLPixmap)value); +} + +int MwCXX::Image::GetHasBorder() { + return (int)MwGetInteger(this->widget, MwNhasBorder); +} + +void MwCXX::Image::SetHasBorder(int value) { + MwSetInteger(this->widget, MwNhasBorder, (int)value); +} + +int MwCXX::Image::GetInverted() { + return (int)MwGetInteger(this->widget, MwNinverted); +} + +void MwCXX::Image::SetInverted(int value) { + MwSetInteger(this->widget, MwNinverted, (int)value); +} + +int MwCXX::Image::GetFillArea() { + return (int)MwGetInteger(this->widget, MwNfillArea); +} + +void MwCXX::Image::SetFillArea(int value) { + MwSetInteger(this->widget, MwNfillArea, (int)value); +} + +void MwCXX::Image::RegisterHandlers() { +} diff --git a/src/widget/image.cxx b/src/widget/image.cxx index 930d1c7..ee1a131 100644 --- a/src/widget/image.cxx +++ b/src/widget/image.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Image::Image(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Image::Image(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/label.cc b/src/widget/label.cc new file mode 100644 index 0000000..a11a1a7 --- /dev/null +++ b/src/widget/label.cc @@ -0,0 +1,64 @@ +#include + +MwCXX::Label::Label(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +MwCXX::String MwCXX::Label::GetText() { + return (MwCXX::String)MwGetText(this->widget, MwNtext); +} + +void MwCXX::Label::SetText(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNtext, value.c_str()); +#else + MwSetText(this->widget, MwNtext, (MwCXX::String)value); +#endif +} + +int MwCXX::Label::GetAlignment() { + return (int)MwGetInteger(this->widget, MwNalignment); +} + +void MwCXX::Label::SetAlignment(int value) { + MwSetInteger(this->widget, MwNalignment, (int)value); +} + +int MwCXX::Label::GetBold() { + return (int)MwGetInteger(this->widget, MwNbold); +} + +void MwCXX::Label::SetBold(int value) { + MwSetInteger(this->widget, MwNbold, (int)value); +} + +int MwCXX::Label::GetSevenSegment() { + return (int)MwGetInteger(this->widget, MwNsevenSegment); +} + +void MwCXX::Label::SetSevenSegment(int value) { + MwSetInteger(this->widget, MwNsevenSegment, (int)value); +} + +int MwCXX::Label::GetLength() { + return (int)MwGetInteger(this->widget, MwNlength); +} + +void MwCXX::Label::SetLength(int value) { + MwSetInteger(this->widget, MwNlength, (int)value); +} + +int MwCXX::Label::GetLeftPadding() { + return (int)MwGetInteger(this->widget, MwNleftPadding); +} + +void MwCXX::Label::SetLeftPadding(int value) { + MwSetInteger(this->widget, MwNleftPadding, (int)value); +} + +void MwCXX::Label::RegisterHandlers() { +} diff --git a/src/widget/label.cxx b/src/widget/label.cxx index ab990b9..a11a1a7 100644 --- a/src/widget/label.cxx +++ b/src/widget/label.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Label::Label(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Label::Label(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/listbox.cc b/src/widget/listbox.cc new file mode 100644 index 0000000..66a509a --- /dev/null +++ b/src/widget/listbox.cc @@ -0,0 +1,41 @@ +#include + +MwCXX::ListBox::ListBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::ListBox::GetLeftPadding() { + return (int)MwGetInteger(this->widget, MwNleftPadding); +} + +void MwCXX::ListBox::SetLeftPadding(int value) { + MwSetInteger(this->widget, MwNleftPadding, (int)value); +} + +int MwCXX::ListBox::GetHasHeading() { + return (int)MwGetInteger(this->widget, MwNhasHeading); +} + +void MwCXX::ListBox::SetHasHeading(int value) { + MwSetInteger(this->widget, MwNhasHeading, (int)value); +} + +int MwCXX::ListBox::GetSingleClickSelectable() { + return (int)MwGetInteger(this->widget, MwNsingleClickSelectable); +} + +void MwCXX::ListBox::SetSingleClickSelectable(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); +} diff --git a/src/widget/listbox.cxx b/src/widget/listbox.cxx index 9ffc224..66a509a 100644 --- a/src/widget/listbox.cxx +++ b/src/widget/listbox.cxx @@ -1,12 +1,10 @@ #include -MwCXX::ListBox::ListBox(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::ListBox::ListBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/menu.cc b/src/widget/menu.cc new file mode 100644 index 0000000..9f03305 --- /dev/null +++ b/src/widget/menu.cc @@ -0,0 +1,17 @@ +#include + +MwCXX::Menu::Menu(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + 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); +} diff --git a/src/widget/menu.cxx b/src/widget/menu.cxx index 5aeea5b..9f03305 100644 --- a/src/widget/menu.cxx +++ b/src/widget/menu.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Menu::Menu(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Menu::Menu(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/numberentry.cc b/src/widget/numberentry.cc new file mode 100644 index 0000000..d65f413 --- /dev/null +++ b/src/widget/numberentry.cc @@ -0,0 +1,34 @@ +#include + +MwCXX::NumberEntry::NumberEntry(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +MwCXX::String MwCXX::NumberEntry::GetText() { + return (MwCXX::String)MwGetText(this->widget, MwNtext); +} + +void MwCXX::NumberEntry::SetText(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNtext, value.c_str()); +#else + MwSetText(this->widget, MwNtext, (MwCXX::String)value); +#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); +} diff --git a/src/widget/numberentry.cxx b/src/widget/numberentry.cxx index 7e6220d..d65f413 100644 --- a/src/widget/numberentry.cxx +++ b/src/widget/numberentry.cxx @@ -1,12 +1,10 @@ #include -MwCXX::NumberEntry::NumberEntry(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::NumberEntry::NumberEntry(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/opengl.cc b/src/widget/opengl.cc new file mode 100644 index 0000000..d566ef7 --- /dev/null +++ b/src/widget/opengl.cc @@ -0,0 +1,13 @@ +#define MW_OPENGL_NO_INCLUDE +#include + +MwCXX::OpenGL::OpenGL(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +void MwCXX::OpenGL::RegisterHandlers() { +} diff --git a/src/widget/opengl.cxx b/src/widget/opengl.cxx index d9e86b0..d566ef7 100644 --- a/src/widget/opengl.cxx +++ b/src/widget/opengl.cxx @@ -1,13 +1,11 @@ #define MW_OPENGL_NO_INCLUDE #include -MwCXX::OpenGL::OpenGL(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::OpenGL::OpenGL(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/progressbar.cc b/src/widget/progressbar.cc new file mode 100644 index 0000000..492c0d6 --- /dev/null +++ b/src/widget/progressbar.cc @@ -0,0 +1,36 @@ +#include + +MwCXX::ProgressBar::ProgressBar(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::ProgressBar::GetMinValue() { + return (int)MwGetInteger(this->widget, MwNminValue); +} + +void MwCXX::ProgressBar::SetMinValue(int value) { + MwSetInteger(this->widget, MwNminValue, (int)value); +} + +int MwCXX::ProgressBar::GetMaxValue() { + return (int)MwGetInteger(this->widget, MwNmaxValue); +} + +void MwCXX::ProgressBar::SetMaxValue(int value) { + MwSetInteger(this->widget, MwNmaxValue, (int)value); +} + +int MwCXX::ProgressBar::GetValue() { + return (int)MwGetInteger(this->widget, MwNvalue); +} + +void MwCXX::ProgressBar::SetValue(int value) { + MwSetInteger(this->widget, MwNvalue, (int)value); +} + +void MwCXX::ProgressBar::RegisterHandlers() { +} diff --git a/src/widget/progressbar.cxx b/src/widget/progressbar.cxx index 1727841..492c0d6 100644 --- a/src/widget/progressbar.cxx +++ b/src/widget/progressbar.cxx @@ -1,12 +1,10 @@ #include -MwCXX::ProgressBar::ProgressBar(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::ProgressBar::ProgressBar(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/radiobox.cc b/src/widget/radiobox.cc new file mode 100644 index 0000000..fcb6517 --- /dev/null +++ b/src/widget/radiobox.cc @@ -0,0 +1,25 @@ +#include + +MwCXX::RadioBox::RadioBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::RadioBox::GetChecked() { + return (int)MwGetInteger(this->widget, MwNchecked); +} + +void MwCXX::RadioBox::SetChecked(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); +} diff --git a/src/widget/radiobox.cxx b/src/widget/radiobox.cxx index 123bf61..fcb6517 100644 --- a/src/widget/radiobox.cxx +++ b/src/widget/radiobox.cxx @@ -1,12 +1,10 @@ #include -MwCXX::RadioBox::RadioBox(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::RadioBox::RadioBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/scrollbar.cc b/src/widget/scrollbar.cc new file mode 100644 index 0000000..98d0ae3 --- /dev/null +++ b/src/widget/scrollbar.cc @@ -0,0 +1,65 @@ +#include + +MwCXX::ScrollBar::ScrollBar(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::ScrollBar::GetShowArrows() { + return (int)MwGetInteger(this->widget, MwNshowArrows); +} + +void MwCXX::ScrollBar::SetShowArrows(int value) { + MwSetInteger(this->widget, MwNshowArrows, (int)value); +} + +int MwCXX::ScrollBar::GetAreaShown() { + return (int)MwGetInteger(this->widget, MwNareaShown); +} + +void MwCXX::ScrollBar::SetAreaShown(int value) { + MwSetInteger(this->widget, MwNareaShown, (int)value); +} + +int MwCXX::ScrollBar::GetValue() { + return (int)MwGetInteger(this->widget, MwNvalue); +} + +void MwCXX::ScrollBar::SetValue(int value) { + MwSetInteger(this->widget, MwNvalue, (int)value); +} + +int MwCXX::ScrollBar::GetMinValue() { + return (int)MwGetInteger(this->widget, MwNminValue); +} + +void MwCXX::ScrollBar::SetMinValue(int value) { + MwSetInteger(this->widget, MwNminValue, (int)value); +} + +int MwCXX::ScrollBar::GetMaxValue() { + return (int)MwGetInteger(this->widget, MwNmaxValue); +} + +void MwCXX::ScrollBar::SetMaxValue(int value) { + MwSetInteger(this->widget, MwNmaxValue, (int)value); +} + +int MwCXX::ScrollBar::GetOrientation() { + return (int)MwGetInteger(this->widget, MwNorientation); +} + +void MwCXX::ScrollBar::SetOrientation(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); +} diff --git a/src/widget/scrollbar.cxx b/src/widget/scrollbar.cxx index 644ad65..98d0ae3 100644 --- a/src/widget/scrollbar.cxx +++ b/src/widget/scrollbar.cxx @@ -1,12 +1,10 @@ #include -MwCXX::ScrollBar::ScrollBar(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::ScrollBar::ScrollBar(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/submenu.cc b/src/widget/submenu.cc new file mode 100644 index 0000000..516ced8 --- /dev/null +++ b/src/widget/submenu.cc @@ -0,0 +1,20 @@ +#include + +MwCXX::SubMenu::SubMenu(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::SubMenu::GetLeftPadding() { + return (int)MwGetInteger(this->widget, MwNleftPadding); +} + +void MwCXX::SubMenu::SetLeftPadding(int value) { + MwSetInteger(this->widget, MwNleftPadding, (int)value); +} + +void MwCXX::SubMenu::RegisterHandlers() { +} diff --git a/src/widget/submenu.cxx b/src/widget/submenu.cxx index 0a6e665..516ced8 100644 --- a/src/widget/submenu.cxx +++ b/src/widget/submenu.cxx @@ -1,12 +1,10 @@ #include -MwCXX::SubMenu::SubMenu(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::SubMenu::SubMenu(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/treeview.cc b/src/widget/treeview.cc new file mode 100644 index 0000000..f9dafbc --- /dev/null +++ b/src/widget/treeview.cc @@ -0,0 +1,33 @@ +#include + +MwCXX::TreeView::TreeView(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +int MwCXX::TreeView::GetLeftPadding() { + return (int)MwGetInteger(this->widget, MwNleftPadding); +} + +void MwCXX::TreeView::SetLeftPadding(int value) { + MwSetInteger(this->widget, MwNleftPadding, (int)value); +} + +int MwCXX::TreeView::GetSingleClickSelectable() { + return (int)MwGetInteger(this->widget, MwNsingleClickSelectable); +} + +void MwCXX::TreeView::SetSingleClickSelectable(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); +} diff --git a/src/widget/treeview.cxx b/src/widget/treeview.cxx index d9200f0..f9dafbc 100644 --- a/src/widget/treeview.cxx +++ b/src/widget/treeview.cxx @@ -1,12 +1,10 @@ #include -MwCXX::TreeView::TreeView(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::TreeView::TreeView(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/viewport.cc b/src/widget/viewport.cc new file mode 100644 index 0000000..918ce69 --- /dev/null +++ b/src/widget/viewport.cc @@ -0,0 +1,12 @@ +#include + +MwCXX::Viewport::Viewport(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +void MwCXX::Viewport::RegisterHandlers() { +} diff --git a/src/widget/viewport.cxx b/src/widget/viewport.cxx index 2b36b61..918ce69 100644 --- a/src/widget/viewport.cxx +++ b/src/widget/viewport.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Viewport::Viewport(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Viewport::Viewport(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/vulkan.cc b/src/widget/vulkan.cc new file mode 100644 index 0000000..dcc81cb --- /dev/null +++ b/src/widget/vulkan.cc @@ -0,0 +1,13 @@ +#define MW_VULKAN_NO_INCLUDE +#include + +MwCXX::Vulkan::Vulkan(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +void MwCXX::Vulkan::RegisterHandlers() { +} diff --git a/src/widget/vulkan.cxx b/src/widget/vulkan.cxx index 86c85fe..dcc81cb 100644 --- a/src/widget/vulkan.cxx +++ b/src/widget/vulkan.cxx @@ -1,13 +1,11 @@ #define MW_VULKAN_NO_INCLUDE #include -MwCXX::Vulkan::Vulkan(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Vulkan::Vulkan(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/src/widget/window.cc b/src/widget/window.cc new file mode 100644 index 0000000..ec6063d --- /dev/null +++ b/src/widget/window.cc @@ -0,0 +1,64 @@ +#include + +MwCXX::Window::Window(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { + this->RegisterHandlers(); +} + +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) { + this->RegisterHandlers(); +} + +MwCXX::String MwCXX::Window::GetTitle() { + return (MwCXX::String)MwGetText(this->widget, MwNtitle); +} + +void MwCXX::Window::SetTitle(MwCXX::String value) { +#ifndef MWCXX_USE_C_STRING + MwSetText(this->widget, MwNtitle, value.c_str()); +#else + MwSetText(this->widget, MwNtitle, (MwCXX::String)value); +#endif +} + +int MwCXX::Window::GetMain() { + return (int)MwGetInteger(this->widget, MwNmain); +} + +void MwCXX::Window::SetMain(int value) { + MwSetInteger(this->widget, MwNmain, (int)value); +} + +MwLLPixmap MwCXX::Window::GetIconPixmap() { + return (MwLLPixmap)MwGetVoid(this->widget, MwNiconPixmap); +} + +void MwCXX::Window::SetIconPixmap(MwLLPixmap value) { + MwSetVoid(this->widget, MwNiconPixmap, (MwLLPixmap)value); +} + +MwSizeHints* MwCXX::Window::GetSizeHints() { + return (MwSizeHints*)MwGetVoid(this->widget, MwNsizeHints); +} + +void MwCXX::Window::SetSizeHints(MwSizeHints* value) { + MwSetVoid(this->widget, MwNsizeHints, (MwSizeHints*)value); +} + +int MwCXX::Window::GetHasBorder() { + return (int)MwGetInteger(this->widget, MwNhasBorder); +} + +void MwCXX::Window::SetHasBorder(int value) { + MwSetInteger(this->widget, MwNhasBorder, (int)value); +} + +int MwCXX::Window::GetInverted() { + return (int)MwGetInteger(this->widget, MwNinverted); +} + +void MwCXX::Window::SetInverted(int value) { + MwSetInteger(this->widget, MwNinverted, (int)value); +} + +void MwCXX::Window::RegisterHandlers() { +} diff --git a/src/widget/window.cxx b/src/widget/window.cxx index 96d5e65..ec6063d 100644 --- a/src/widget/window.cxx +++ b/src/widget/window.cxx @@ -1,12 +1,10 @@ #include -MwCXX::Window::Window(MwWidget widget) - : MwCXX::Base(widget) { +MwCXX::Window::Window(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) { this->RegisterHandlers(); } -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::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) { this->RegisterHandlers(); } diff --git a/test.cxx b/test.cxx index c667964..fb26169 100644 --- a/test.cxx +++ b/test.cxx @@ -1,6 +1,7 @@ #include #include #include +#include #include @@ -8,6 +9,8 @@ class MyButton : public MwCXX::Button { protected: void OnActivate() { std::cout << "Hello" << std::endl; + + MwCXX::MessageBoxGetChild(MwCXX::MessageBox(this->GetParent(), "Hello", "Hello world", MwMB_BUTTONOK | MwMB_ICONNEWS)); } public: