From: Javier Sancho Date: Sun, 26 Apr 2020 16:48:53 +0000 (+0200) Subject: add-editbox! X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=0701c9fb6dc986131d6c62212559338aab8b0531;p=guile-irrlicht.git add-editbox! --- diff --git a/Makefile.am b/Makefile.am index f74cf9a..ca35926 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,7 @@ libguile_irrlicht_la_SOURCES = \ src/file-system.cpp \ src/gui.cpp \ src/gui-button.cpp \ - src/gui-edit-box.cpp \ + src/gui-editbox.cpp \ src/gui-element.cpp \ src/gui-environment.cpp \ src/gui-font.cpp \ diff --git a/src/gui-edit-box.cpp b/src/gui-edit-box.cpp deleted file mode 100644 index f924440..0000000 --- a/src/gui-edit-box.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine - - Copyright (C) 2020 Javier Sancho - - This file is part of guile-irrlicht. - - guile-irrlicht is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 3 of the - License, or (at your option) any later version. - - guile-irrlicht is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with guile-irrlicht. If not, see - . -*/ - -#include -#include -#include "gui-edit-box.h" -#include "wrapped.h" - -extern "C" { - - void - init_gui_edit_box (void) - { - init_gui_edit_box_type (); - } - - DEFINE_WRAPPED_TYPE (irr::gui::IGUIEditBox*, "gui-edit-box", - init_gui_edit_box_type, gui_edit_box_p, - wrap_gui_edit_box, unwrap_gui_edit_box); - -} diff --git a/src/gui-edit-box.h b/src/gui-edit-box.h deleted file mode 100644 index 47497cd..0000000 --- a/src/gui-edit-box.h +++ /dev/null @@ -1,38 +0,0 @@ -/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine - - Copyright (C) 2020 Javier Sancho - - This file is part of guile-irrlicht. - - guile-irrlicht is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 3 of the - License, or (at your option) any later version. - - guile-irrlicht is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with guile-irrlicht. If not, see - . -*/ - -#ifndef __GUILE_IRRLICHT_GUI_EDIT_BOX_H_INCLUDED__ -#define __GUILE_IRRLICHT_GUI_EDIT_BOX_H_INCLUDED__ - -#include -#include -#include "wrapped.h" - -extern "C" { - - void - init_gui_edit_box (void); - - DECLARE_WRAPPED_TYPE (irr::gui::IGUIEditBox*, init_gui_edit_box_type, - gui_edit_box_p, wrap_gui_edit_box, unwrap_gui_edit_box); -} - -#endif diff --git a/src/gui-editbox.cpp b/src/gui-editbox.cpp new file mode 100644 index 0000000..5de75ba --- /dev/null +++ b/src/gui-editbox.cpp @@ -0,0 +1,39 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + This file is part of guile-irrlicht. + + guile-irrlicht is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + guile-irrlicht is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with guile-irrlicht. If not, see + . +*/ + +#include +#include +#include "gui-editbox.h" +#include "wrapped.h" + +extern "C" { + + void + init_gui_editbox (void) + { + init_gui_editbox_type (); + } + + DEFINE_WRAPPED_TYPE (irr::gui::IGUIEditBox*, "gui-editbox", + init_gui_editbox_type, gui_editbox_p, + wrap_gui_editbox, unwrap_gui_editbox); + +} diff --git a/src/gui-editbox.h b/src/gui-editbox.h new file mode 100644 index 0000000..91b184e --- /dev/null +++ b/src/gui-editbox.h @@ -0,0 +1,38 @@ +/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine + + Copyright (C) 2020 Javier Sancho + + This file is part of guile-irrlicht. + + guile-irrlicht is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + guile-irrlicht is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with guile-irrlicht. If not, see + . +*/ + +#ifndef __GUILE_IRRLICHT_GUI_EDITBOX_H_INCLUDED__ +#define __GUILE_IRRLICHT_GUI_EDITBOX_H_INCLUDED__ + +#include +#include +#include "wrapped.h" + +extern "C" { + + void + init_gui_editbox (void); + + DECLARE_WRAPPED_TYPE (irr::gui::IGUIEditBox*, init_gui_editbox_type, + gui_editbox_p, wrap_gui_editbox, unwrap_gui_editbox); +} + +#endif diff --git a/src/gui-environment.cpp b/src/gui-environment.cpp index cc5e0c5..0706539 100644 --- a/src/gui-environment.cpp +++ b/src/gui-environment.cpp @@ -25,6 +25,7 @@ #include "device.h" #include "gsubr.h" #include "gui-button.h" +#include "gui-editbox.h" #include "gui-element.h" #include "gui-environment.h" #include "gui-font.h" @@ -46,6 +47,7 @@ extern "C" { { init_gui_environment_type (); DEFINE_GSUBR ("add-image!", 3, 0, 1, irr_gui_addImage); + DEFINE_GSUBR ("add-editbox!", 3, 0, 1, irr_gui_addEditBox); DEFINE_GSUBR ("add-listbox!", 2, 0, 1, irr_gui_addListBox); DEFINE_GSUBR ("add-scrollbar!", 3, 0, 1, irr_gui_addScrollBar); DEFINE_GSUBR ("add-static-text!", 3, 0, 1, irr_gui_addStaticText); @@ -103,6 +105,32 @@ extern "C" { return wrap_gui_image (guiImage); } + SCM + irr_gui_addEditBox (SCM wrapped_gui_environment, + SCM text, + SCM rectangle, + SCM rest) + { + SCM border = SCM_BOOL_T; + SCM parent = SCM_BOOL_F; + SCM id = scm_from_int32 (-1); + + scm_c_bind_keyword_arguments ("add-editbox!", rest, (scm_t_keyword_arguments_flags)0, + scm_from_utf8_keyword ("border"), &border, + scm_from_utf8_keyword ("parent"), &parent, + scm_from_utf8_keyword ("id"), &id, + SCM_UNDEFINED); + + irr::gui::IGUIEnvironment* guienv = unwrap_gui_environment (wrapped_gui_environment); + irr::gui::IGUIEditBox* editbox = + guienv->addEditBox (scm_to_wide_char_string (text), + scm_to_rect_s32 (rectangle), + scm_to_bool (border), + scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + scm_to_int32 (id)); + return wrap_gui_editbox (editbox); + } + SCM irr_gui_addListBox (SCM wrapped_gui_environment, SCM rectangle, diff --git a/src/gui-environment.h b/src/gui-environment.h index a52233a..9cfec52 100644 --- a/src/gui-environment.h +++ b/src/gui-environment.h @@ -43,6 +43,12 @@ extern "C" { SCM position, SCM rest); + SCM + irr_gui_addEditBox (SCM wrapped_gui_environment, + SCM text, + SCM rectangle, + SCM rest); + SCM irr_gui_addListBox (SCM wrapped_gui_environment, SCM rectangle, diff --git a/src/gui.cpp b/src/gui.cpp index 5291537..997d28b 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -26,7 +26,7 @@ #include "gsubr.h" #include "gui.h" #include "gui-button.h" -#include "gui-edit-box.h" +#include "gui-editbox.h" #include "gui-element.h" #include "gui-environment.h" #include "gui-font.h" @@ -45,7 +45,7 @@ extern "C" { { // Init objects init_gui_button (); - init_gui_edit_box (); + init_gui_editbox (); init_gui_element (); init_gui_environment (); init_gui_font (); @@ -165,9 +165,9 @@ extern "C" { { #define SET_MAX(OBJ) OBJ->setMax (scm_to_int32 (max)); - if (gui_edit_box_p (wrapped_obj)) + if (gui_editbox_p (wrapped_obj)) { - SET_MAX (unwrap_gui_edit_box (wrapped_obj)); + SET_MAX (unwrap_gui_editbox (wrapped_obj)); } else if (gui_scrollbar_p (wrapped_obj)) { @@ -187,9 +187,9 @@ extern "C" { { #define SET_OVERRIDE_COLOR(OBJ) OBJ->setOverrideColor (scm_to_color (color)); - if (gui_edit_box_p (wrapped_obj)) + if (gui_editbox_p (wrapped_obj)) { - SET_OVERRIDE_COLOR (unwrap_gui_edit_box (wrapped_obj)); + SET_OVERRIDE_COLOR (unwrap_gui_editbox (wrapped_obj)); } else if (gui_static_text_p (wrapped_obj)) {