This commit is contained in:
Nishi 2026-04-18 01:05:20 +09:00
commit 933f276e1a
Signed by: nishi
GPG key ID: 27EF69B208EB9343
73 changed files with 1350 additions and 306 deletions

View file

@ -9,17 +9,17 @@ SO = .so
EXEC = EXEC =
.PHONY: all format clean .PHONY: all format clean
.SUFFIXES: .cxx .o .SUFFIXES: .cc .o
all: libMwCXX$(SO) all: libMwCXX$(SO)
format: 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 OBJS = src/core.o src/widget/base.o
include objs.mk 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 bindgen$(EXEC): bindgen.o
$(CXX) -L$(XEMIL)/lib -L$(XEMIL)/src -o $@ bindgen.o -lxemil $(CXX) -L$(XEMIL)/lib -L$(XEMIL)/src -o $@ bindgen.o -lxemil
@ -27,7 +27,7 @@ bindgen$(EXEC): bindgen.o
libMwCXX$(SO): $(OBJS) libMwCXX$(SO): $(OBJS)
$(CXX) -shared -L$(MILSKO)/lib -L$(MILSKO)/src -o $@ $(OBJS) -lMw $(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 $@ $< $(CXX) -fPIC -c -Iinclude -I$(MILSKO)/include -I$(XEMIL)/include -o $@ $<
clean: clean:

View file

@ -11,6 +11,7 @@ struct typeinfo {
std::string type; std::string type;
std::string name; std::string name;
std::string struct_name; std::string struct_name;
std::string widget_type;
int pointer; int pointer;
}; };
@ -45,6 +46,12 @@ static std::string get_ctype(typeinfo type, int name = 1, int do_ptr = 1) {
ret += "void*"; ret += "void*";
} else if(type.type == "struct") { } else if(type.type == "struct") {
ret += type.struct_name; 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 += "*"; if(do_ptr && type.pointer) ret += "*";
@ -95,6 +102,7 @@ static typeinfo xml_to_type(xl_node_t* node) {
ret.type = node->name; ret.type = node->name;
ret.name = ((s = xl_get_attribute(node, "name")) != NULL) ? s : ""; ret.name = ((s = xl_get_attribute(node, "name")) != NULL) ? s : "";
ret.struct_name = ((s = xl_get_attribute(node, "defname")) != NULL) ? s : ""; ret.struct_name = ((s = xl_get_attribute(node, "defname")) != NULL) ? s : "";
ret.widget_type = ((s = xl_get_attribute(node, "type")) != NULL) ? s : "";
ret.pointer = ATTR_TO_BOOL(node, "pointer"); ret.pointer = ATTR_TO_BOOL(node, "pointer");
return ret; return ret;
@ -116,16 +124,6 @@ static void scan_property(xl_node_t* node) {
props[xl_get_attribute(node, "name")] = prop; 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) { static void scan_handler(xl_node_t* node) {
handler handl; handler handl;
char* s; char* s;
@ -148,16 +146,6 @@ static void scan_handler(xl_node_t* node) {
handlers[xl_get_attribute(node, "name")] = handl; 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;
@ -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); 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) { static std::string widget_property_source(std::string widget, std::string name) {
std::stringstream strm; 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")); 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 = "") { static std::string widget_handler_header(std::string name, std::string indent = "") {
std::stringstream strm; 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); 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) { static std::string widget_handler_source(std::string widget, std::string name) {
std::stringstream strm; std::stringstream strm;
std::string cast = ""; 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")); 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) { static void scan_widget(xl_node_t* node) {
std::string name; std::string name;
xl_node_t** p_nodes; xl_node_t** p_nodes;
xl_node_t** h_nodes; xl_node_t** h_nodes;
xl_node_t* child;
int i;
if(node->type != XL_NODE_NODE) return; 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 << " virtual void RegisterHandlers();" << std::endl;
OFS << std::endl; OFS << std::endl;
OFS << " public:" << 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; OFS << " " + name + "(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);" << std::endl;
if(p_nodes != NULL) { if(p_nodes != NULL) {
std::string r = ""; std::string r = "";
for(i = 0; p_nodes[i] != NULL; i++) { for(int i = 0; p_nodes[i] != NULL; i++) {
r += scan_widget_properties_header(p_nodes[i], "\t\t"); 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 if(r != "") OFS << std::endl
@ -358,8 +296,12 @@ static void scan_widget(xl_node_t* node) {
if(h_nodes != NULL) { if(h_nodes != NULL) {
std::string r = ""; std::string r = "";
for(i = 0; h_nodes[i] != NULL; i++) { for(int i = 0; h_nodes[i] != NULL; i++) {
r += scan_widget_handlers_header(h_nodes[i], "\t\t"); 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 if(r != "") OFS << std::endl
@ -374,16 +316,16 @@ static void scan_widget(xl_node_t* node) {
#undef OFS #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; if(name == "OpenGL" || name == "Vulkan") OFS << "#define MW_" + uppercase(name) + "_NO_INCLUDE" << std::endl;
OFS << "#include <MwCXX/Widget/" + name + ".h>" << std::endl; OFS << "#include <MwCXX/Widget/" + name + ".h>" << std::endl;
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* parent) : MwCXX::Base(widget, parent) {" << std::endl;
OFS << " this->RegisterHandlers();" << std::endl; OFS << " this->RegisterHandlers();" << std::endl;
OFS << "}" << std::endl; OFS << "}" << std::endl;
OFS << std::endl; OFS << std::endl;
@ -394,21 +336,29 @@ static void scan_widget(xl_node_t* node) {
OFS << std::endl; OFS << std::endl;
if(p_nodes != NULL) { if(p_nodes != NULL) {
for(i = 0; p_nodes[i] != NULL; i++) { for(int i = 0; p_nodes[i] != NULL; i++) {
OFS << scan_widget_properties_source(p_nodes[i], name); 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) { if(h_nodes != NULL) {
for(i = 0; h_nodes[i] != NULL; i++) { for(int i = 0; h_nodes[i] != NULL; i++) {
OFS << scan_widget_handlers_source(h_nodes[i], name); 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; OFS << "void MwCXX::" + name + "::RegisterHandlers() {" << std::endl;
if(h_nodes != NULL) { if(h_nodes != NULL) {
for(i = 0; h_nodes[i] != NULL; i++) { for(int i = 0; h_nodes[i] != NULL; i++) {
for(child = h_nodes[i]->first_child; child != NULL; child = child->next) { for(xl_node_t* child = h_nodes[i]->first_child; child != NULL; child = child->next) {
std::string hname; std::string hname;
if(child->type != XL_NODE_NODE) continue; 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"; files["objs"] << " src/widget/" + lowercase(name) + ".o";
} }
static void scan_widgets(xl_node_t* node) { static std::string function_decl(xl_node_t* node, std::string prefix = ""){
xl_node_t* child = node->first_child; xl_node_t* ret = NULL;
xl_node_t** nodes;
std::string r = "";
while(child != NULL) { if((nodes = xl_get_path(node, "return")) != NULL){
scan_widget(child); 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 #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 <MwCXX/Widget/Base.h>" << std::endl; OFS << "#include <MwCXX/Widget/Base.h>" << std::endl;
@ -520,7 +548,11 @@ int main(int argc, char** argv) {
if((nodes = xl_get_path(h->root, "properties")) != NULL) { if((nodes = xl_get_path(h->root, "properties")) != NULL) {
for(int i = 0; nodes[i] != NULL; i++) { 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); free(nodes);
@ -528,7 +560,23 @@ int main(int argc, char** argv) {
if((nodes = xl_get_path(h->root, "handlers")) != NULL) { if((nodes = xl_get_path(h->root, "handlers")) != NULL) {
for(int i = 0; nodes[i] != NULL; i++) { 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); free(nodes);
@ -538,7 +586,9 @@ int main(int argc, char** argv) {
if((nodes = xl_get_path(h->root, "widgets")) != NULL) { if((nodes = xl_get_path(h->root, "widgets")) != NULL) {
for(int i = 0; nodes[i] != NULL; i++) { 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); free(nodes);

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -4,6 +4,7 @@
#include <Mw/Milsko.h> #include <Mw/Milsko.h>
#include <string> #include <string>
#include <vector>
// #define MWCXX_USE_C_STRING // #define MWCXX_USE_C_STRING

View file

@ -10,9 +10,13 @@ namespace MwCXX {
MwWidget widget; MwWidget widget;
MwCXX::Base* parent;
std::vector<MwCXX::Base*> children;
public: 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(MwClass widget_class, MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
~Base();
MwRect GetArea(); MwRect GetArea();
void SetArea(MwRect r); void SetArea(MwRect r);
@ -20,8 +24,12 @@ namespace MwCXX {
void Move(int x, int y); void Move(int x, int y);
void Resize(unsigned int width, unsigned int height); void Resize(unsigned int width, unsigned int height);
int Step();
int Pending();
void Loop(); void Loop();
MwCXX::Base* GetParent();
#include <MwCXX/Widget/BaseAuto.h> #include <MwCXX/Widget/BaseAuto.h>
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -1,41 +1,41 @@
MwCXX::String GetBackground(); MwCXX::String GetBackground();
void SetBackground(MwCXX::String value); void SetBackground(MwCXX::String value);
MwLLPixmap GetBackgroundPixmap(); MwLLPixmap GetBackgroundPixmap();
void SetBackgroundPixmap(MwLLPixmap value); void SetBackgroundPixmap(MwLLPixmap value);
int GetBitmapFont(); int GetBitmapFont();
void SetBitmapFont(int value); void SetBitmapFont(int value);
int GetBorderWidth(); int GetBorderWidth();
void SetBorderWidth(int value); void SetBorderWidth(int value);
int GetDarkTheme(); int GetDarkTheme();
void SetDarkTheme(int value); void SetDarkTheme(int value);
int GetFixedSize(); int GetFixedSize();
void SetFixedSize(int value); void SetFixedSize(int value);
int GetForceInverted(); int GetForceInverted();
void SetForceInverted(int value); void SetForceInverted(int value);
MwCXX::String GetForeground(); MwCXX::String GetForeground();
void SetForeground(MwCXX::String value); void SetForeground(MwCXX::String value);
int GetHeight(); int GetHeight();
void SetHeight(int value); void SetHeight(int value);
int GetIsRounded(); int GetIsRounded();
void SetIsRounded(int value); void SetIsRounded(int value);
int GetModernLook(); int GetModernLook();
void SetModernLook(int value); void SetModernLook(int value);
int GetRatio(); int GetRatio();
void SetRatio(int value); void SetRatio(int value);
MwCXX::String GetSubBackground(); MwCXX::String GetSubBackground();
void SetSubBackground(MwCXX::String value); void SetSubBackground(MwCXX::String value);
MwCXX::String GetSubForeground(); MwCXX::String GetSubForeground();
void SetSubForeground(MwCXX::String value); void SetSubForeground(MwCXX::String value);
int GetUseMonospace(); int GetUseMonospace();
void SetUseMonospace(int value); void SetUseMonospace(int value);
int GetWaitMS(); int GetWaitMS();
void SetWaitMS(int value); void SetWaitMS(int value);
int GetWidth(); int GetWidth();
void SetWidth(int value); void SetWidth(int value);
int GetX(); 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 OnClipboard(MwCXX::String value) {};
virtual void OnDarkTheme(int value) {}; virtual void OnDarkTheme(int value) {};

View file

@ -12,18 +12,18 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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); void SetOrientation(int value);
int GetMargin(); int GetMargin();
void SetMargin(int value); void SetMargin(int value);
int GetPadding(); int GetPadding();
void SetPadding(int value); void SetPadding(int value);
int GetHasBorder(); int GetHasBorder();
void SetHasBorder(int value); void SetHasBorder(int value);
int GetInverted(); int GetInverted();
void SetInverted(int value); void SetInverted(int value);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,19 +12,19 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); Button(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
MwLLPixmap GetPixmap(); MwLLPixmap GetPixmap();
void SetPixmap(MwLLPixmap value); void SetPixmap(MwLLPixmap value);
MwCXX::String GetText(); MwCXX::String GetText();
void SetText(MwCXX::String value); void SetText(MwCXX::String value);
int GetFlat(); int GetFlat();
void SetFlat(int value); void SetFlat(int value);
int GetPadding(); int GetPadding();
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 OnActivate() {};
virtual void OnChanged() {}; virtual void OnChanged() {};

View file

@ -12,10 +12,10 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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() {}; virtual void OnChanged() {};

View file

@ -12,12 +12,12 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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); void SetAreaShown(int value);
int GetValue(); int GetValue();
void SetValue(int value); void SetValue(int value);
virtual void OnComboBoxChanged(int value) {}; virtual void OnComboBoxChanged(int value) {};

View file

@ -12,13 +12,13 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); Entry(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);
int GetHideInput(); int GetHideInput();
void SetHideInput(int value); void SetHideInput(int value);
virtual void OnActivate() {}; virtual void OnActivate() {};
virtual void OnChanged() {}; virtual void OnChanged() {};

View file

@ -12,12 +12,12 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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); void SetHasBorder(int value);
int GetInverted(); int GetInverted();
void SetInverted(int value); void SetInverted(int value);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,17 +12,17 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); Image(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
MwLLPixmap GetPixmap(); MwLLPixmap GetPixmap();
void SetPixmap(MwLLPixmap value); void SetPixmap(MwLLPixmap value);
int GetHasBorder(); int GetHasBorder();
void SetHasBorder(int value); void SetHasBorder(int value);
int GetInverted(); int GetInverted();
void SetInverted(int value); void SetInverted(int value);
int GetFillArea(); int GetFillArea();
void SetFillArea(int value); void SetFillArea(int value);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,21 +12,21 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); Label(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);
int GetAlignment(); int GetAlignment();
void SetAlignment(int value); void SetAlignment(int value);
int GetBold(); int GetBold();
void SetBold(int value); void SetBold(int value);
int GetSevenSegment(); int GetSevenSegment();
void SetSevenSegment(int value); void SetSevenSegment(int value);
int GetLength(); int GetLength();
void SetLength(int value); void SetLength(int value);
int GetLeftPadding(); int GetLeftPadding();
void SetLeftPadding(int value); void SetLeftPadding(int value);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,14 +12,14 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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); void SetLeftPadding(int value);
int GetHasHeading(); int GetHasHeading();
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) {}; virtual void OnListBoxActivate(int value) {};

View file

@ -12,7 +12,7 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); Menu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
virtual void OnMenu(void* value) {}; virtual void OnMenu(void* value) {};

View file

@ -12,11 +12,11 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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 OnActivate() {};
virtual void OnChanged() {}; virtual void OnChanged() {};

View file

@ -12,7 +12,7 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); OpenGL(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,14 +12,14 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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); void SetMinValue(int value);
int GetMaxValue(); int GetMaxValue();
void SetMaxValue(int value); void SetMaxValue(int value);
int GetValue(); int GetValue();
void SetValue(int value); void SetValue(int value);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,10 +12,10 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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() {}; virtual void OnChanged() {};

View file

@ -12,20 +12,20 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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); void SetShowArrows(int value);
int GetAreaShown(); int GetAreaShown();
void SetAreaShown(int value); void SetAreaShown(int value);
int GetValue(); int GetValue();
void SetValue(int value); void SetValue(int value);
int GetMinValue(); int GetMinValue();
void SetMinValue(int value); void SetMinValue(int value);
int GetMaxValue(); int GetMaxValue();
void SetMaxValue(int value); void SetMaxValue(int value);
int GetOrientation(); int GetOrientation();
void SetOrientation(int value); void SetOrientation(int value);
virtual void OnChanged() {}; virtual void OnChanged() {};

View file

@ -12,10 +12,10 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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); void SetLeftPadding(int value);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,12 +12,12 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); 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); void SetLeftPadding(int value);
int GetSingleClickSelectable(); int GetSingleClickSelectable();
void SetSingleClickSelectable(int value); void SetSingleClickSelectable(int value);
virtual void OnTreeViewActivate(void* value) {}; virtual void OnTreeViewActivate(void* value) {};

View file

@ -12,7 +12,7 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); Viewport(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,7 +12,7 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); Vulkan(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -12,21 +12,21 @@ namespace MwCXX {
virtual void RegisterHandlers(); virtual void RegisterHandlers();
public: 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); Window(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
MwCXX::String GetTitle(); MwCXX::String GetTitle();
void SetTitle(MwCXX::String value); void SetTitle(MwCXX::String value);
int GetMain(); int GetMain();
void SetMain(int value); void SetMain(int value);
MwLLPixmap GetIconPixmap(); MwLLPixmap GetIconPixmap();
void SetIconPixmap(MwLLPixmap value); void SetIconPixmap(MwLLPixmap value);
MwSizeHints* GetSizeHints(); MwSizeHints* GetSizeHints();
void SetSizeHints(MwSizeHints* value); void SetSizeHints(MwSizeHints* value);
int GetHasBorder(); int GetHasBorder();
void SetHasBorder(int value); void SetHasBorder(int value);
int GetInverted(); int GetInverted();
void SetInverted(int value); void SetInverted(int value);
}; };
}; // namespace MwCXX }; // namespace MwCXX

View file

@ -1,7 +1,8 @@
#include <MwCXX/Widget/Base.h> #include <MwCXX/Widget/Base.h>
MwCXX::Base::Base(MwWidget widget) { MwCXX::Base::Base(MwWidget widget, MwCXX::Base* parent) {
this->widget = widget; this->widget = widget;
this->parent = parent;
this->RegisterHandlers(); 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); this->widget = MwCreateWidget(widget_class, name.c_str(), parent == NULL ? NULL : parent->widget, x, y, width, height);
#endif #endif
this->parent = parent;
if(parent != NULL) parent->children.push_back(this);
this->RegisterHandlers(); 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 MwCXX::Base::GetArea() {
MwRect rc; MwRect rc;
@ -50,6 +72,18 @@ void MwCXX::Base::Resize(unsigned int width, unsigned int height) {
NULL); NULL);
} }
int MwCXX::Base::Step() {
return MwStep(this->widget);
}
int MwCXX::Base::Pending() {
return MwPending(this->widget);
}
void MwCXX::Base::Loop() { void MwCXX::Base::Loop() {
MwLoop(this->widget); MwLoop(this->widget);
} }
MwCXX::Base* MwCXX::Base::GetParent(){
return this->parent;
}

226
src/widget/baseauto.cc Normal file
View file

@ -0,0 +1,226 @@
#include <MwCXX/Widget/Base.h>
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);
}

52
src/widget/box.cc Normal file
View file

@ -0,0 +1,52 @@
#include <MwCXX/Widget/Box.h>
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() {
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Box.h> #include <MwCXX/Widget/Box.h>
MwCXX::Box::Box(MwWidget widget) MwCXX::Box::Box(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

66
src/widget/button.cc Normal file
View file

@ -0,0 +1,66 @@
#include <MwCXX/Widget/Button.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Button.h> #include <MwCXX/Widget/Button.h>
MwCXX::Button::Button(MwWidget widget) MwCXX::Button::Button(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

25
src/widget/checkbox.cc Normal file
View file

@ -0,0 +1,25 @@
#include <MwCXX/Widget/CheckBox.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/CheckBox.h> #include <MwCXX/Widget/CheckBox.h>
MwCXX::CheckBox::CheckBox(MwWidget widget) MwCXX::CheckBox::CheckBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

33
src/widget/combobox.cc Normal file
View file

@ -0,0 +1,33 @@
#include <MwCXX/Widget/ComboBox.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/ComboBox.h> #include <MwCXX/Widget/ComboBox.h>
MwCXX::ComboBox::ComboBox(MwWidget widget) MwCXX::ComboBox::ComboBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

42
src/widget/entry.cc Normal file
View file

@ -0,0 +1,42 @@
#include <MwCXX/Widget/Entry.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Entry.h> #include <MwCXX/Widget/Entry.h>
MwCXX::Entry::Entry(MwWidget widget) MwCXX::Entry::Entry(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

28
src/widget/frame.cc Normal file
View file

@ -0,0 +1,28 @@
#include <MwCXX/Widget/Frame.h>
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() {
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Frame.h> #include <MwCXX/Widget/Frame.h>
MwCXX::Frame::Frame(MwWidget widget) MwCXX::Frame::Frame(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

44
src/widget/image.cc Normal file
View file

@ -0,0 +1,44 @@
#include <MwCXX/Widget/Image.h>
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() {
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Image.h> #include <MwCXX/Widget/Image.h>
MwCXX::Image::Image(MwWidget widget) MwCXX::Image::Image(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

64
src/widget/label.cc Normal file
View file

@ -0,0 +1,64 @@
#include <MwCXX/Widget/Label.h>
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() {
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Label.h> #include <MwCXX/Widget/Label.h>
MwCXX::Label::Label(MwWidget widget) MwCXX::Label::Label(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

41
src/widget/listbox.cc Normal file
View file

@ -0,0 +1,41 @@
#include <MwCXX/Widget/ListBox.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/ListBox.h> #include <MwCXX/Widget/ListBox.h>
MwCXX::ListBox::ListBox(MwWidget widget) MwCXX::ListBox::ListBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

17
src/widget/menu.cc Normal file
View file

@ -0,0 +1,17 @@
#include <MwCXX/Widget/Menu.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Menu.h> #include <MwCXX/Widget/Menu.h>
MwCXX::Menu::Menu(MwWidget widget) MwCXX::Menu::Menu(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

34
src/widget/numberentry.cc Normal file
View file

@ -0,0 +1,34 @@
#include <MwCXX/Widget/NumberEntry.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/NumberEntry.h> #include <MwCXX/Widget/NumberEntry.h>
MwCXX::NumberEntry::NumberEntry(MwWidget widget) MwCXX::NumberEntry::NumberEntry(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

13
src/widget/opengl.cc Normal file
View file

@ -0,0 +1,13 @@
#define MW_OPENGL_NO_INCLUDE
#include <MwCXX/Widget/OpenGL.h>
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() {
}

View file

@ -1,13 +1,11 @@
#define MW_OPENGL_NO_INCLUDE #define MW_OPENGL_NO_INCLUDE
#include <MwCXX/Widget/OpenGL.h> #include <MwCXX/Widget/OpenGL.h>
MwCXX::OpenGL::OpenGL(MwWidget widget) MwCXX::OpenGL::OpenGL(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

36
src/widget/progressbar.cc Normal file
View file

@ -0,0 +1,36 @@
#include <MwCXX/Widget/ProgressBar.h>
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() {
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/ProgressBar.h> #include <MwCXX/Widget/ProgressBar.h>
MwCXX::ProgressBar::ProgressBar(MwWidget widget) MwCXX::ProgressBar::ProgressBar(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

25
src/widget/radiobox.cc Normal file
View file

@ -0,0 +1,25 @@
#include <MwCXX/Widget/RadioBox.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/RadioBox.h> #include <MwCXX/Widget/RadioBox.h>
MwCXX::RadioBox::RadioBox(MwWidget widget) MwCXX::RadioBox::RadioBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

65
src/widget/scrollbar.cc Normal file
View file

@ -0,0 +1,65 @@
#include <MwCXX/Widget/ScrollBar.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/ScrollBar.h> #include <MwCXX/Widget/ScrollBar.h>
MwCXX::ScrollBar::ScrollBar(MwWidget widget) MwCXX::ScrollBar::ScrollBar(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

20
src/widget/submenu.cc Normal file
View file

@ -0,0 +1,20 @@
#include <MwCXX/Widget/SubMenu.h>
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() {
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/SubMenu.h> #include <MwCXX/Widget/SubMenu.h>
MwCXX::SubMenu::SubMenu(MwWidget widget) MwCXX::SubMenu::SubMenu(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

33
src/widget/treeview.cc Normal file
View file

@ -0,0 +1,33 @@
#include <MwCXX/Widget/TreeView.h>
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);
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/TreeView.h> #include <MwCXX/Widget/TreeView.h>
MwCXX::TreeView::TreeView(MwWidget widget) MwCXX::TreeView::TreeView(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

12
src/widget/viewport.cc Normal file
View file

@ -0,0 +1,12 @@
#include <MwCXX/Widget/Viewport.h>
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() {
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Viewport.h> #include <MwCXX/Widget/Viewport.h>
MwCXX::Viewport::Viewport(MwWidget widget) MwCXX::Viewport::Viewport(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

13
src/widget/vulkan.cc Normal file
View file

@ -0,0 +1,13 @@
#define MW_VULKAN_NO_INCLUDE
#include <MwCXX/Widget/Vulkan.h>
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() {
}

View file

@ -1,13 +1,11 @@
#define MW_VULKAN_NO_INCLUDE #define MW_VULKAN_NO_INCLUDE
#include <MwCXX/Widget/Vulkan.h> #include <MwCXX/Widget/Vulkan.h>
MwCXX::Vulkan::Vulkan(MwWidget widget) MwCXX::Vulkan::Vulkan(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

64
src/widget/window.cc Normal file
View file

@ -0,0 +1,64 @@
#include <MwCXX/Widget/Window.h>
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() {
}

View file

@ -1,12 +1,10 @@
#include <MwCXX/Widget/Window.h> #include <MwCXX/Widget/Window.h>
MwCXX::Window::Window(MwWidget widget) MwCXX::Window::Window(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
: MwCXX::Base(widget) {
this->RegisterHandlers(); 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(); this->RegisterHandlers();
} }

View file

@ -1,6 +1,7 @@
#include <MwCXX/Core.h> #include <MwCXX/Core.h>
#include <MwCXX/Widget/Window.h> #include <MwCXX/Widget/Window.h>
#include <MwCXX/Widget/Button.h> #include <MwCXX/Widget/Button.h>
#include <MwCXX/Dialog/MessageBox.h>
#include <iostream> #include <iostream>
@ -8,6 +9,8 @@ class MyButton : public MwCXX::Button {
protected: protected:
void OnActivate() { void OnActivate() {
std::cout << "Hello" << std::endl; std::cout << "Hello" << std::endl;
MwCXX::MessageBoxGetChild(MwCXX::MessageBox(this->GetParent(), "Hello", "Hello world", MwMB_BUTTONOK | MwMB_ICONNEWS));
} }
public: public: