add dialog things

This commit is contained in:
Nishi 2026-04-18 02:31:46 +09:00
commit 90e572aad8
Signed by: nishi
GPG key ID: 27EF69B208EB9343
56 changed files with 658 additions and 193 deletions

View file

@ -198,20 +198,35 @@ 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 widget_handler_header(std::string name, std::string indent = "") {
static std::string widget_handler_header(std::string widget, std::string name, std::string indent = "", int func = 1) {
std::stringstream strm;
std::string pre = "";
strm << indent + "virtual void On" + upperfirst(name) + "(" + (handlers[name].has_arg ? (get_ctype(handlers[name].arg_type, 0, 0) + " value") : "") + ") {};" << std::endl;
strm << indent;
if(func) {
strm << "virtual void On" + upperfirst(name);
} else {
strm << "void (*" + upperfirst(name) + "Handler)";
pre += "MwCXX::" + widget + "* widget";
if(handlers[name].has_arg) pre += ", ";
}
strm << "(" + pre + (handlers[name].has_arg ? (get_ctype(handlers[name].arg_type, 0, 0) + " value") : "") + ")";
if(func) strm << " {}";
strm << ";" << std::endl;
return strm.str();
}
static std::string scan_widget_handler_header(xl_node_t* node, std::string indent) {
static std::string scan_widget_handler_header(xl_node_t* node, std::string widget, std::string indent, int func = 1) {
xl_node_t* child = node->first_child;
if(node->type != XL_NODE_NODE) return "";
return widget_handler_header(xl_get_attribute(node, "name"), indent);
return widget_handler_header(widget, xl_get_attribute(node, "name"), indent, func);
}
static std::string widget_handler_source(std::string widget, std::string name) {
@ -230,6 +245,7 @@ static std::string widget_handler_source(std::string widget, std::string name) {
strm << "static void __On" + upperfirst(name) + "(MwWidget handle, void* user, void* call) {" << std::endl;
strm << " ((MwCXX::" + widget + "*)user)->On" + upperfirst(name) + "(" + cast + ");" << std::endl;
strm << " if(((MwCXX::" + widget + "*)user)->" + upperfirst(name) + "Handler != NULL) ((MwCXX::" + widget + "*)user)->" + upperfirst(name) + "Handler((MwCXX::" + widget + "*)user" + (handlers[name].has_arg ? (", " + cast) : "") + ");" << std::endl;
strm << "}" << std::endl;
strm << std::endl;
@ -279,8 +295,9 @@ static void scan_widget(xl_node_t* node) {
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 = "";
std::string r;
r = "";
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;
@ -288,22 +305,32 @@ static void scan_widget(xl_node_t* node) {
r += scan_widget_property_header(child, "\t\t");
}
}
if(r != "") OFS << std::endl
<< r;
}
if(h_nodes != NULL) {
std::string r = "";
std::string r;
r = "";
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");
r += scan_widget_handler_header(child, name, "\t\t");
}
}
if(r != "") OFS << std::endl
<< r;
r = "";
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, name, "\t\t", 0);
}
}
if(r != "") OFS << std::endl
<< r;
}
@ -357,6 +384,9 @@ static void scan_widget(xl_node_t* node) {
OFS << "void MwCXX::" + name + "::RegisterHandlers() {" << std::endl;
if(h_nodes != NULL) {
int f;
f = 0;
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;
@ -366,6 +396,21 @@ static void scan_widget(xl_node_t* node) {
hname = xl_get_attribute(child, "name");
OFS << " MwAddUserHandler(this->widget, MwN" + hname + "Handler, __On" + upperfirst(hname) + ", (void*)this);" << std::endl;
f = 1;
}
}
if(f) OFS << std::endl;
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;
hname = xl_get_attribute(child, "name");
OFS << " this->" + upperfirst(hname) + "Handler = NULL;" << std::endl;
}
}
}
@ -390,6 +435,8 @@ static std::string function_decl(xl_node_t* node, std::string prefix = ""){
if(child->type == XL_NODE_NODE) ret = child;
}
}
free(nodes);
}
if(ret == NULL) {
@ -408,9 +455,11 @@ static std::string function_decl(xl_node_t* node, std::string prefix = ""){
if(r.substr(r.size() - 1, 1) != "(") r += ", ";
r += get_ctype(xml_to_type(child), 1, 1);
r += get_ctype(xml_to_type(child), 1, 0);
}
}
free(nodes);
}
r += ")";
@ -418,7 +467,93 @@ static std::string function_decl(xl_node_t* node, std::string prefix = ""){
}
static std::string function_source(xl_node_t* node) {
return "";
std::stringstream strm;
xl_node_t** nodes;
xl_node_t* ret = NULL;
xl_node_t* widget = NULL;
typeinfo type;
int first = 1;
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;
}
}
free(nodes);
}
strm << function_decl(node, "MwCXX::") << " {" << std::endl;
strm << " ";
if(ret != NULL) {
type = xml_to_type(ret);
if(type.type == "widget") {
std::string str = get_ctype(type, 0);
strm << "return new " + str.substr(0, str.size() - 1) + "(";
} else if(type.type == "string") {
strm << "const char* _ret = ";
} else {
strm << "return (" + get_ctype(type, 0) + ")";
}
}
strm << std::string(xl_get_attribute(node, "name")) + "(";
first = 1;
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) {
typeinfo type2;
if(child->type != XL_NODE_NODE) continue;
if(std::string(child->name) == "widget" && widget == NULL) widget = child;
type2 = xml_to_type(child);
if(first) {
first = 0;
} else {
strm << ", ";
}
if(type2.type == "widget") {
strm << type2.name + "->GetWidget()";
} else {
if(type2.type == "string") {
strm << std::endl;
strm << "#ifdef MWCXX_USE_C_STRING" << std::endl;
strm << type2.name << std::endl;
strm << "#else" << std::endl;
strm << type2.name + ".c_str()" << std::endl;
strm << "#endif" << std::endl;
strm << " ";
} else {
strm << "(" + get_ctype(type2, 0) + ")" + type2.name;
}
}
}
}
free(nodes);
}
if(ret != NULL && type.type == "widget") {
strm << ")";
if(widget != NULL) strm << ", " + std::string(xl_get_attribute(widget, "name"));
}
strm << ");" << std::endl;
if(ret != NULL && type.type == "string") {
strm << "#ifdef MWCXX_USE_C_STRING" << std::endl;
strm << " return _ret;" << std::endl;
strm << "#else" << std::endl;
strm << " return MwCXX::String(_ret);" << std::endl;
strm << "#endif" << std::endl;
}
strm << "}" << std::endl;
return strm.str();
}
static std::string function_header(xl_node_t* node) {
@ -443,6 +578,9 @@ static void scan_header(xl_node_t* node) {
OFS << "#define __MWCXX_DIALOG_" + uppercase(name.substr(7)) + "_H__" << std::endl;
OFS << std::endl;
OFS << "#include <MwCXX/Widget/All.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++) {
@ -463,6 +601,26 @@ static void scan_header(xl_node_t* node) {
#undef OFS
#define OFS files["D" + name.substr(7) + ".cc"]
OFS = std::ofstream("src/dialog/" + lowercase(name.substr(7)) + ".cc");
OFS << "#include <MwCXX/" + name + ".h>" << std::endl;
OFS << 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_source(child);
}
}
free(nodes);
}
files["objs"] << " src/dialog/" + lowercase(name.substr(7)) + ".o";
#undef OFS
}
}
@ -481,13 +639,21 @@ static void base_widget() {
OFS << widget_property_header(p->first);
f = 1;
}
if(f) OFS << std::endl;
f = 0;
for(auto p = handlers.begin(); p != handlers.end(); p++) {
if(!p->second.common) continue;
OFS << widget_handler_header("Base", p->first);
f = 1;
}
if(f) OFS << std::endl;
for(auto p = handlers.begin(); p != handlers.end(); p++) {
if(!p->second.common) continue;
OFS << widget_handler_header(p->first);
OFS << widget_handler_header("Base", p->first, "", 0);
}
#undef OFS
@ -516,6 +682,12 @@ static void base_widget() {
OFS << " MwAddUserHandler(this->widget, MwN" + h->first + "Handler, __On" + upperfirst(h->first) + ", (void*)this);" << std::endl;
}
OFS << std::endl;
for(auto h = handlers.begin(); h != handlers.end(); h++) {
if(!h->second.common) continue;
OFS << " this->" + upperfirst(h->first) + "Handler = NULL;" << std::endl;
}
OFS << "}" << std::endl;
#undef OFS
@ -584,16 +756,38 @@ int main(int argc, char** argv) {
base_widget();
#define OFS files["AllWidgets.h"]
OFS = std::ofstream("include/MwCXX/Widget/All.h");
OFS << "#ifndef __MWCXX_WIDGET_ALL_H__" << std::endl;
OFS << "#define __MWCXX_WIDGET_ALL_H__" << std::endl;
OFS << std::endl;
if((nodes = xl_get_path(h->root, "widgets")) != NULL) {
for(int i = 0; nodes[i] != NULL; i++) {
for(xl_node_t* child = nodes[i]->first_child; child != NULL; child = child->next) {
std::string name;
if(child->type != XL_NODE_NODE) continue;
scan_widget(child);
name = xl_get_attribute(child, "name");
if(name == "OpenGL" || name == "Vulkan") continue;
OFS << "#include <MwCXX/Widget/" + name + ".h>" << std::endl;
}
}
free(nodes);
}
OFS << std::endl;
OFS << "#endif" << std::endl;
#undef OFS
files["objs"] << std::endl;
for(auto f = files.begin(); f != files.end(); f++) {

View file

@ -1,6 +1,8 @@
#ifndef __MWCXX_DIALOG_COLORCHOOSER_H__
#define __MWCXX_DIALOG_COLORCHOOSER_H__
#include <MwCXX/Widget/All.h>
namespace MwCXX {
MwCXX::Window* ColorChooser(MwCXX::Base* handle, MwCXX::String title);
}; // namespace MwCXX

View file

@ -0,0 +1,10 @@
#ifndef __MWCXX_DIALOG_COLORPICKER_H__
#define __MWCXX_DIALOG_COLORPICKER_H__
#include <MwCXX/Widget/All.h>
namespace MwCXX {
MwCXX::Window* ColorPicker(MwCXX::Base* handle, MwCXX::String title);
}; // namespace MwCXX
#endif

View file

@ -1,6 +1,8 @@
#ifndef __MWCXX_DIALOG_DIRECTORYCHOOSER_H__
#define __MWCXX_DIALOG_DIRECTORYCHOOSER_H__
#include <MwCXX/Widget/All.h>
namespace MwCXX {
MwCXX::Window* DirectoryChooser(MwCXX::Base* handle, MwCXX::String title);
}; // namespace MwCXX

View file

@ -1,6 +1,8 @@
#ifndef __MWCXX_DIALOG_FILECHOOSER_H__
#define __MWCXX_DIALOG_FILECHOOSER_H__
#include <MwCXX/Widget/All.h>
namespace MwCXX {
MwCXX::Window* FileChooser(MwCXX::Base* handle, MwCXX::String title);
MwCXX::Window* FileChooserEx(MwCXX::Base* handle, MwCXX::String title, int dir);

View file

@ -1,6 +1,8 @@
#ifndef __MWCXX_DIALOG_MESSAGEBOX_H__
#define __MWCXX_DIALOG_MESSAGEBOX_H__
#include <MwCXX/Widget/All.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);

View file

@ -6,7 +6,7 @@
#include <string>
#include <vector>
// #define MWCXX_USE_C_STRING
#define MWCXX_USE_C_STRING
namespace MwCXX {
#ifdef MWCXX_USE_C_STRING

View file

@ -0,0 +1,23 @@
#ifndef __MWCXX_WIDGET_ALL_H__
#define __MWCXX_WIDGET_ALL_H__
#include <MwCXX/Widget/Box.h>
#include <MwCXX/Widget/Button.h>
#include <MwCXX/Widget/CheckBox.h>
#include <MwCXX/Widget/Entry.h>
#include <MwCXX/Widget/Frame.h>
#include <MwCXX/Widget/Image.h>
#include <MwCXX/Widget/Label.h>
#include <MwCXX/Widget/ListBox.h>
#include <MwCXX/Widget/Menu.h>
#include <MwCXX/Widget/NumberEntry.h>
#include <MwCXX/Widget/ScrollBar.h>
#include <MwCXX/Widget/SubMenu.h>
#include <MwCXX/Widget/Viewport.h>
#include <MwCXX/Widget/Window.h>
#include <MwCXX/Widget/ProgressBar.h>
#include <MwCXX/Widget/RadioBox.h>
#include <MwCXX/Widget/ComboBox.h>
#include <MwCXX/Widget/TreeView.h>
#endif

View file

@ -30,6 +30,8 @@ namespace MwCXX {
MwCXX::Base* GetParent();
MwWidget GetWidget();
#include <MwCXX/Widget/BaseAuto.h>
};
}; // namespace MwCXX

View file

@ -48,3 +48,15 @@ virtual void OnMouseMove(MwPoint value) {};
virtual void OnMouseUp(MwMouse value) {};
virtual void OnResize() {};
virtual void OnTick() {};
void (*ClipboardHandler)(MwCXX::Base* widget, MwCXX::String value);
void (*DarkThemeHandler)(MwCXX::Base* widget, int value);
void (*FocusInHandler)(MwCXX::Base* widget);
void (*FocusOutHandler)(MwCXX::Base* widget);
void (*KeyHandler)(MwCXX::Base* widget, int value);
void (*KeyReleaseHandler)(MwCXX::Base* widget, int value);
void (*MouseDownHandler)(MwCXX::Base* widget, MwMouse value);
void (*MouseMoveHandler)(MwCXX::Base* widget, MwPoint value);
void (*MouseUpHandler)(MwCXX::Base* widget, MwMouse value);
void (*ResizeHandler)(MwCXX::Base* widget);
void (*TickHandler)(MwCXX::Base* widget);

View file

@ -28,6 +28,9 @@ namespace MwCXX {
virtual void OnActivate() {};
virtual void OnChanged() {};
void (*ActivateHandler)(MwCXX::Button* widget);
void (*ChangedHandler)(MwCXX::Button* widget);
};
}; // namespace MwCXX

View file

@ -19,6 +19,8 @@ namespace MwCXX {
void SetChecked(int value);
virtual void OnChanged() {};
void (*ChangedHandler)(MwCXX::CheckBox* widget);
};
}; // namespace MwCXX

View file

@ -21,6 +21,8 @@ namespace MwCXX {
void SetValue(int value);
virtual void OnComboBoxChanged(int value) {};
void (*ComboBoxChangedHandler)(MwCXX::ComboBox* widget, int value);
};
}; // namespace MwCXX

View file

@ -22,6 +22,9 @@ namespace MwCXX {
virtual void OnActivate() {};
virtual void OnChanged() {};
void (*ActivateHandler)(MwCXX::Entry* widget);
void (*ChangedHandler)(MwCXX::Entry* widget);
};
}; // namespace MwCXX

View file

@ -23,6 +23,8 @@ namespace MwCXX {
void SetSingleClickSelectable(int value);
virtual void OnListBoxActivate(int value) {};
void (*ListBoxActivateHandler)(MwCXX::ListBox* widget, int value);
};
}; // namespace MwCXX

View file

@ -16,6 +16,8 @@ namespace MwCXX {
Menu(MwCXX::String name, MwCXX::Base* parent, int x, int y, unsigned int width, unsigned int height);
virtual void OnMenu(void* value) {};
void (*MenuHandler)(MwCXX::Menu* widget, void* value);
};
}; // namespace MwCXX

View file

@ -20,6 +20,9 @@ namespace MwCXX {
virtual void OnActivate() {};
virtual void OnChanged() {};
void (*ActivateHandler)(MwCXX::NumberEntry* widget);
void (*ChangedHandler)(MwCXX::NumberEntry* widget);
};
}; // namespace MwCXX

View file

@ -19,6 +19,8 @@ namespace MwCXX {
void SetChecked(int value);
virtual void OnChanged() {};
void (*ChangedHandler)(MwCXX::RadioBox* widget);
};
}; // namespace MwCXX

View file

@ -29,6 +29,8 @@ namespace MwCXX {
void SetOrientation(int value);
virtual void OnChanged() {};
void (*ChangedHandler)(MwCXX::ScrollBar* widget);
};
}; // namespace MwCXX

View file

@ -21,6 +21,8 @@ namespace MwCXX {
void SetSingleClickSelectable(int value);
virtual void OnTreeViewActivate(void* value) {};
void (*TreeViewActivateHandler)(MwCXX::TreeView* widget, void* value);
};
}; // namespace MwCXX

View file

@ -1 +1 @@
OBJS += src/widget/baseauto.o src/widget/box.o src/widget/button.o src/widget/checkbox.o src/widget/entry.o src/widget/frame.o src/widget/image.o src/widget/label.o src/widget/listbox.o src/widget/menu.o src/widget/numberentry.o src/widget/scrollbar.o src/widget/submenu.o src/widget/viewport.o src/widget/window.o src/widget/progressbar.o src/widget/radiobox.o src/widget/combobox.o src/widget/treeview.o src/widget/opengl.o src/widget/vulkan.o
OBJS += src/dialog/colorpicker.o src/dialog/filechooser.o src/dialog/directorychooser.o src/dialog/messagebox.o src/widget/baseauto.o src/widget/box.o src/widget/button.o src/widget/checkbox.o src/widget/entry.o src/widget/frame.o src/widget/image.o src/widget/label.o src/widget/listbox.o src/widget/menu.o src/widget/numberentry.o src/widget/scrollbar.o src/widget/submenu.o src/widget/viewport.o src/widget/window.o src/widget/progressbar.o src/widget/radiobox.o src/widget/combobox.o src/widget/treeview.o src/widget/opengl.o src/widget/vulkan.o

View file

@ -0,0 +1,12 @@
#include <MwCXX/Dialog/ColorChooser.h>
MwCXX::Window* MwCXX::ColorChooser(MwCXX::Base* handle, MwCXX::String title) {
return new MwCXX::Window(MwColorChooser((MwWidget)handle,
#ifdef MWCXX_USE_C_STRING
title
#else
title.c_str()
#endif
),
handle);
}

12
src/dialog/colorpicker.cc Normal file
View file

@ -0,0 +1,12 @@
#include <MwCXX/Dialog/ColorPicker.h>
MwCXX::Window* MwCXX::ColorPicker(MwCXX::Base* handle, MwCXX::String title) {
return new MwCXX::Window(MwColorPicker(handle->GetWidget(),
#ifdef MWCXX_USE_C_STRING
title
#else
title.c_str()
#endif
),
handle);
}

View file

@ -0,0 +1,12 @@
#include <MwCXX/Dialog/DirectoryChooser.h>
MwCXX::Window* MwCXX::DirectoryChooser(MwCXX::Base* handle, MwCXX::String title) {
return new MwCXX::Window(MwDirectoryChooser(handle->GetWidget(),
#ifdef MWCXX_USE_C_STRING
title
#else
title.c_str()
#endif
),
handle);
}

23
src/dialog/filechooser.cc Normal file
View file

@ -0,0 +1,23 @@
#include <MwCXX/Dialog/FileChooser.h>
MwCXX::Window* MwCXX::FileChooser(MwCXX::Base* handle, MwCXX::String title) {
return new MwCXX::Window(MwFileChooser(handle->GetWidget(),
#ifdef MWCXX_USE_C_STRING
title
#else
title.c_str()
#endif
),
handle);
}
MwCXX::Window* MwCXX::FileChooserEx(MwCXX::Base* handle, MwCXX::String title, int dir) {
return new MwCXX::Window(MwFileChooserEx(handle->GetWidget(),
#ifdef MWCXX_USE_C_STRING
title
#else
title.c_str()
#endif
,
(int)dir),
handle);
}

25
src/dialog/messagebox.cc Normal file
View file

@ -0,0 +1,25 @@
#include <MwCXX/Dialog/MessageBox.h>
MwCXX::Window* MwCXX::MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, int flag) {
return new MwCXX::Window(MwMessageBox(handle->GetWidget(),
#ifdef MWCXX_USE_C_STRING
text
#else
text.c_str()
#endif
,
#ifdef MWCXX_USE_C_STRING
title
#else
title.c_str()
#endif
,
(int)flag),
handle);
}
MwCXX::Button* MwCXX::MessageBoxGetChild(MwCXX::Window* handle, int child) {
return new MwCXX::Button(MwMessageBoxGetChild(handle->GetWidget(), (int)child), handle);
}
void MwCXX::MessageBoxDestroy(MwCXX::Window* handle) {
MwMessageBoxDestroy(handle->GetWidget());
}

View file

@ -87,3 +87,7 @@ void MwCXX::Base::Loop() {
MwCXX::Base* MwCXX::Base::GetParent() {
return this->parent;
}
MwWidget MwCXX::Base::GetWidget() {
return this->widget;
}

View file

@ -169,46 +169,57 @@ void MwCXX::Base::SetY(int value) {
static void __OnClipboard(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnClipboard((MwCXX::String)(char*)call);
if(((MwCXX::Base*)user)->ClipboardHandler != NULL) ((MwCXX::Base*)user)->ClipboardHandler((MwCXX::Base*)user, (MwCXX::String)(char*)call);
}
static void __OnDarkTheme(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnDarkTheme(*(int*)call);
if(((MwCXX::Base*)user)->DarkThemeHandler != NULL) ((MwCXX::Base*)user)->DarkThemeHandler((MwCXX::Base*)user, *(int*)call);
}
static void __OnFocusIn(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnFocusIn();
if(((MwCXX::Base*)user)->FocusInHandler != NULL) ((MwCXX::Base*)user)->FocusInHandler((MwCXX::Base*)user);
}
static void __OnFocusOut(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnFocusOut();
if(((MwCXX::Base*)user)->FocusOutHandler != NULL) ((MwCXX::Base*)user)->FocusOutHandler((MwCXX::Base*)user);
}
static void __OnKey(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnKey(*(int*)call);
if(((MwCXX::Base*)user)->KeyHandler != NULL) ((MwCXX::Base*)user)->KeyHandler((MwCXX::Base*)user, *(int*)call);
}
static void __OnKeyRelease(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnKeyRelease(*(int*)call);
if(((MwCXX::Base*)user)->KeyReleaseHandler != NULL) ((MwCXX::Base*)user)->KeyReleaseHandler((MwCXX::Base*)user, *(int*)call);
}
static void __OnMouseDown(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnMouseDown(*(MwMouse*)call);
if(((MwCXX::Base*)user)->MouseDownHandler != NULL) ((MwCXX::Base*)user)->MouseDownHandler((MwCXX::Base*)user, *(MwMouse*)call);
}
static void __OnMouseMove(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnMouseMove(*(MwPoint*)call);
if(((MwCXX::Base*)user)->MouseMoveHandler != NULL) ((MwCXX::Base*)user)->MouseMoveHandler((MwCXX::Base*)user, *(MwPoint*)call);
}
static void __OnMouseUp(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnMouseUp(*(MwMouse*)call);
if(((MwCXX::Base*)user)->MouseUpHandler != NULL) ((MwCXX::Base*)user)->MouseUpHandler((MwCXX::Base*)user, *(MwMouse*)call);
}
static void __OnResize(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnResize();
if(((MwCXX::Base*)user)->ResizeHandler != NULL) ((MwCXX::Base*)user)->ResizeHandler((MwCXX::Base*)user);
}
static void __OnTick(MwWidget handle, void* user, void* call) {
((MwCXX::Base*)user)->OnTick();
if(((MwCXX::Base*)user)->TickHandler != NULL) ((MwCXX::Base*)user)->TickHandler((MwCXX::Base*)user);
}
void MwCXX::Base::RegisterHandlers() {
@ -223,4 +234,16 @@ void MwCXX::Base::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNmouseUpHandler, __OnMouseUp, (void*)this);
MwAddUserHandler(this->widget, MwNresizeHandler, __OnResize, (void*)this);
MwAddUserHandler(this->widget, MwNtickHandler, __OnTick, (void*)this);
this->ClipboardHandler = NULL;
this->DarkThemeHandler = NULL;
this->FocusInHandler = NULL;
this->FocusOutHandler = NULL;
this->KeyHandler = NULL;
this->KeyReleaseHandler = NULL;
this->MouseDownHandler = NULL;
this->MouseMoveHandler = NULL;
this->MouseUpHandler = NULL;
this->ResizeHandler = NULL;
this->TickHandler = NULL;
}

View file

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

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/Button.h>
MwCXX::Button::Button(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -54,13 +56,18 @@ void MwCXX::Button::SetFillArea(int value) {
static void __OnActivate(MwWidget handle, void* user, void* call) {
((MwCXX::Button*)user)->OnActivate();
if(((MwCXX::Button*)user)->ActivateHandler != NULL) ((MwCXX::Button*)user)->ActivateHandler((MwCXX::Button*)user);
}
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::Button*)user)->OnChanged();
if(((MwCXX::Button*)user)->ChangedHandler != NULL) ((MwCXX::Button*)user)->ChangedHandler((MwCXX::Button*)user);
}
void MwCXX::Button::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNactivateHandler, __OnActivate, (void*)this);
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
this->ActivateHandler = NULL;
this->ChangedHandler = NULL;
}

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/CheckBox.h>
MwCXX::CheckBox::CheckBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -18,8 +20,11 @@ void MwCXX::CheckBox::SetChecked(int value) {
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::CheckBox*)user)->OnChanged();
if(((MwCXX::CheckBox*)user)->ChangedHandler != NULL) ((MwCXX::CheckBox*)user)->ChangedHandler((MwCXX::CheckBox*)user);
}
void MwCXX::CheckBox::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
this->ChangedHandler = NULL;
}

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/ComboBox.h>
MwCXX::ComboBox::ComboBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -26,8 +28,11 @@ void MwCXX::ComboBox::SetValue(int value) {
static void __OnComboBoxChanged(MwWidget handle, void* user, void* call) {
((MwCXX::ComboBox*)user)->OnComboBoxChanged(*(int*)call);
if(((MwCXX::ComboBox*)user)->ComboBoxChangedHandler != NULL) ((MwCXX::ComboBox*)user)->ComboBoxChangedHandler((MwCXX::ComboBox*)user, *(int*)call);
}
void MwCXX::ComboBox::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNcomboBoxChangedHandler, __OnComboBoxChanged, (void*)this);
this->ComboBoxChangedHandler = NULL;
}

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/Entry.h>
MwCXX::Entry::Entry(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -30,13 +32,18 @@ void MwCXX::Entry::SetHideInput(int value) {
static void __OnActivate(MwWidget handle, void* user, void* call) {
((MwCXX::Entry*)user)->OnActivate();
if(((MwCXX::Entry*)user)->ActivateHandler != NULL) ((MwCXX::Entry*)user)->ActivateHandler((MwCXX::Entry*)user);
}
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::Entry*)user)->OnChanged();
if(((MwCXX::Entry*)user)->ChangedHandler != NULL) ((MwCXX::Entry*)user)->ChangedHandler((MwCXX::Entry*)user);
}
void MwCXX::Entry::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNactivateHandler, __OnActivate, (void*)this);
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
this->ActivateHandler = NULL;
this->ChangedHandler = NULL;
}

View file

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

View file

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

View file

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

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/ListBox.h>
MwCXX::ListBox::ListBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -34,8 +36,11 @@ void MwCXX::ListBox::SetSingleClickSelectable(int value) {
static void __OnListBoxActivate(MwWidget handle, void* user, void* call) {
((MwCXX::ListBox*)user)->OnListBoxActivate(*(int*)call);
if(((MwCXX::ListBox*)user)->ListBoxActivateHandler != NULL) ((MwCXX::ListBox*)user)->ListBoxActivateHandler((MwCXX::ListBox*)user, *(int*)call);
}
void MwCXX::ListBox::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNlistBoxActivateHandler, __OnListBoxActivate, (void*)this);
this->ListBoxActivateHandler = NULL;
}

View file

@ -1,17 +1,22 @@
#include <MwCXX/Widget/Menu.h>
MwCXX::Menu::Menu(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
static void __OnMenu(MwWidget handle, void* user, void* call) {
((MwCXX::Menu*)user)->OnMenu((void*)call);
if(((MwCXX::Menu*)user)->MenuHandler != NULL) ((MwCXX::Menu*)user)->MenuHandler((MwCXX::Menu*)user, (void*)call);
}
void MwCXX::Menu::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNmenuHandler, __OnMenu, (void*)this);
this->MenuHandler = NULL;
}

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/NumberEntry.h>
MwCXX::NumberEntry::NumberEntry(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -22,13 +24,18 @@ void MwCXX::NumberEntry::SetText(MwCXX::String value) {
static void __OnActivate(MwWidget handle, void* user, void* call) {
((MwCXX::NumberEntry*)user)->OnActivate();
if(((MwCXX::NumberEntry*)user)->ActivateHandler != NULL) ((MwCXX::NumberEntry*)user)->ActivateHandler((MwCXX::NumberEntry*)user);
}
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::NumberEntry*)user)->OnChanged();
if(((MwCXX::NumberEntry*)user)->ChangedHandler != NULL) ((MwCXX::NumberEntry*)user)->ChangedHandler((MwCXX::NumberEntry*)user);
}
void MwCXX::NumberEntry::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNactivateHandler, __OnActivate, (void*)this);
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
this->ActivateHandler = NULL;
this->ChangedHandler = NULL;
}

View file

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

View file

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

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/RadioBox.h>
MwCXX::RadioBox::RadioBox(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -18,8 +20,11 @@ void MwCXX::RadioBox::SetChecked(int value) {
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::RadioBox*)user)->OnChanged();
if(((MwCXX::RadioBox*)user)->ChangedHandler != NULL) ((MwCXX::RadioBox*)user)->ChangedHandler((MwCXX::RadioBox*)user);
}
void MwCXX::RadioBox::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
this->ChangedHandler = NULL;
}

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/ScrollBar.h>
MwCXX::ScrollBar::ScrollBar(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -58,8 +60,11 @@ void MwCXX::ScrollBar::SetOrientation(int value) {
static void __OnChanged(MwWidget handle, void* user, void* call) {
((MwCXX::ScrollBar*)user)->OnChanged();
if(((MwCXX::ScrollBar*)user)->ChangedHandler != NULL) ((MwCXX::ScrollBar*)user)->ChangedHandler((MwCXX::ScrollBar*)user);
}
void MwCXX::ScrollBar::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNchangedHandler, __OnChanged, (void*)this);
this->ChangedHandler = NULL;
}

View file

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

View file

@ -1,10 +1,12 @@
#include <MwCXX/Widget/TreeView.h>
MwCXX::TreeView::TreeView(MwWidget widget, MwCXX::Base* parent) : MwCXX::Base(widget, parent) {
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();
}
@ -26,8 +28,11 @@ void MwCXX::TreeView::SetSingleClickSelectable(int value) {
static void __OnTreeViewActivate(MwWidget handle, void* user, void* call) {
((MwCXX::TreeView*)user)->OnTreeViewActivate((void*)call);
if(((MwCXX::TreeView*)user)->TreeViewActivateHandler != NULL) ((MwCXX::TreeView*)user)->TreeViewActivateHandler((MwCXX::TreeView*)user, (void*)call);
}
void MwCXX::TreeView::RegisterHandlers() {
MwAddUserHandler(this->widget, MwNtreeViewActivateHandler, __OnTreeViewActivate, (void*)this);
this->TreeViewActivateHandler = NULL;
}

View file

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

View file

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

View file

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

View file

@ -5,12 +5,18 @@
#include <iostream>
static void close_msg(MwCXX::Button* button){
delete button->GetParent();
}
class MyButton : public MwCXX::Button {
protected:
void OnActivate() {
std::cout << "Hello" << std::endl;
MwCXX::Window* msg;
MwCXX::MessageBox(this->GetParent(), "Hello", "Hello world", MwMB_BUTTONOK | MwMB_ICONNEWS);
msg = MwCXX::MessageBox(this->GetParent(), "Hello", "Hello world", MwMB_BUTTONOK | MwMB_ICONNEWS);
MwCXX::MessageBoxGetChild(msg, MwMB_BUTTONOK)->ActivateHandler = close_msg;
}
public: