From: Javier Sancho Date: Sun, 12 Apr 2020 16:15:45 +0000 (+0200) Subject: set-override-color! X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=26bfba9849221399127c93fe557c7877b523ec94;p=guile-irrlicht.git set-override-color! --- diff --git a/Makefile.am b/Makefile.am index 7f90662..c99cd47 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,6 +36,8 @@ libguile_irrlicht_la_SOURCES = \ src/event-receiver.cpp \ src/file-archive.cpp \ src/file-system.cpp \ + src/gui.cpp \ + src/gui-edit-box.cpp \ src/gui-element.cpp \ src/gui-environment.cpp \ src/gui-image.cpp \ diff --git a/src/gui-edit-box.cpp b/src/gui-edit-box.cpp new file mode 100644 index 0000000..f924440 --- /dev/null +++ b/src/gui-edit-box.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-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 new file mode 100644 index 0000000..47497cd --- /dev/null +++ b/src/gui-edit-box.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_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.cpp b/src/gui.cpp new file mode 100644 index 0000000..bb4f9e9 --- /dev/null +++ b/src/gui.cpp @@ -0,0 +1,61 @@ +/* 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 "color.h" +#include "gsubr.h" +#include "gui.h" +#include "gui-edit-box.h" +#include "gui-static-text.h" + +extern "C" { + + void + init_gui (void) + { + DEFINE_GSUBR ("set-override-color!", 2, 0, 0, irr_gui_setOverrideColor); + } + + SCM + irr_gui_setOverrideColor (SCM wrapped_obj, + SCM color) + { +#define SET_OVERRIDE_COLOR(OBJ) OBJ->setOverrideColor (scm_to_color (color)); + + if (gui_edit_box_p (wrapped_obj)) + { + SET_OVERRIDE_COLOR (unwrap_gui_edit_box (wrapped_obj)); + } + else if (gui_static_text_p (wrapped_obj)) + { + SET_OVERRIDE_COLOR (unwrap_gui_static_text (wrapped_obj)); + } + else + { + scm_error (scm_arg_type_key, NULL, "Cannot set override color to object: ~S", + scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj)); + } + return SCM_UNSPECIFIED; + } + +} diff --git a/src/gui.h b/src/gui.h new file mode 100644 index 0000000..aac54a5 --- /dev/null +++ b/src/gui.h @@ -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 + . +*/ + +#ifndef __GUILE_IRRLICHT_GUI_H_INCLUDED__ +#define __GUILE_IRRLICHT_GUI_H_INCLUDED__ + +#include +#include + +extern "C" { + + void + init_gui (void); + + SCM + irr_gui_setOverrideColor (SCM wrapped_obj, + SCM color); + +} + +#endif diff --git a/src/guile-irrlicht.cpp b/src/guile-irrlicht.cpp index d0560c1..99b9928 100644 --- a/src/guile-irrlicht.cpp +++ b/src/guile-irrlicht.cpp @@ -31,6 +31,8 @@ #include "file-archive.h" #include "file-system.h" #include "gsubr.h" +#include "gui.h" +#include "gui-edit-box.h" #include "gui-element.h" #include "gui-environment.h" #include "gui-image.h" @@ -64,6 +66,8 @@ extern "C" { init_event_receiver (); init_file_archive (); init_file_system (); + init_gui (); + init_gui_edit_box (); init_gui_element (); init_gui_environment (); init_gui_image ();