This commit is contained in:
Nishi 2026-04-20 00:47:40 +09:00
commit 76d31322ae
Signed by: nishi
GPG key ID: 27EF69B208EB9343
6 changed files with 14 additions and 12 deletions

View file

@ -526,7 +526,7 @@ static std::string function_source(xl_node_t* node) {
}
if(type2.type == "widget") {
strm << type2.name + "->GetWidget()";
strm << "(" + type2.name + " == NULL ? NULL : " + type2.name + "->GetWidget())";
} else {
if(type2.type == "string") {
strm << std::endl;

View file

@ -1,7 +1,7 @@
#include <MwCXX/Dialog/ColorPicker.h>
MwCXX::Window* MwCXX::ColorPicker(MwCXX::Base* handle, MwCXX::String title) {
return new MwCXX::Window(MwColorPicker(handle->GetWidget(),
return new MwCXX::Window(MwColorPicker((handle == NULL ? NULL : handle->GetWidget()),
#ifdef MWCXX_USE_C_STRING
title
#else

View file

@ -1,7 +1,7 @@
#include <MwCXX/Dialog/DirectoryChooser.h>
MwCXX::Window* MwCXX::DirectoryChooser(MwCXX::Base* handle, MwCXX::String title) {
return new MwCXX::Window(MwDirectoryChooser(handle->GetWidget(),
return new MwCXX::Window(MwDirectoryChooser((handle == NULL ? NULL : handle->GetWidget()),
#ifdef MWCXX_USE_C_STRING
title
#else

View file

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

View file

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

View file

@ -107,11 +107,13 @@ void MwCXX::Base::ForceRender() {
void MwCXX::Base::Reparent(MwCXX::Base* new_parent) {
int i;
for(i = 0; i < this->parent->children.size(); i++) {
if(this->parent->children[i] == this) {
this->parent->children.erase(this->parent->children.begin() + i);
if(this->parent != NULL) {
for(i = 0; i < this->parent->children.size(); i++) {
if(this->parent->children[i] == this) {
this->parent->children.erase(this->parent->children.begin() + i);
break;
break;
}
}
}