From: Javier Sancho Date: Thu, 23 Apr 2020 06:23:42 +0000 (+0200) Subject: add-scrollbar! X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=272a4db4154e3970be1f0c619fa592d7b6b89f74;p=guile-irrlicht.git add-scrollbar! --- diff --git a/Makefile.am b/Makefile.am index 3a1e9f4..6908dc8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,6 +43,7 @@ libguile_irrlicht_la_SOURCES = \ src/gui-environment.cpp \ src/gui-font.cpp \ src/gui-image.cpp \ + src/gui-scrollbar.cpp \ src/gui-skin.cpp \ src/gui-static-text.cpp \ src/gui-toolbar.cpp \ diff --git a/src/gui-environment.cpp b/src/gui-environment.cpp index 1ea8625..3f85f8b 100644 --- a/src/gui-environment.cpp +++ b/src/gui-environment.cpp @@ -29,6 +29,7 @@ #include "gui-environment.h" #include "gui-font.h" #include "gui-image.h" +#include "gui-scrollbar.h" #include "gui-skin.h" #include "gui-static-text.h" #include "position2d.h" @@ -44,6 +45,7 @@ extern "C" { { init_gui_environment_type (); DEFINE_GSUBR ("add-image!", 3, 0, 1, irr_gui_addImage); + DEFINE_GSUBR ("add-scrollbar!", 3, 0, 1, irr_gui_addScrollBar); DEFINE_GSUBR ("add-static-text!", 3, 0, 1, irr_gui_addStaticText); DEFINE_GSUBR ("get-built-in-font", 1, 0, 0, irr_gui_getBuiltInFont); DEFINE_GSUBR ("get-gui-environment", 1, 0, 0, irr_getGUIEnvironment); @@ -99,6 +101,29 @@ extern "C" { return wrap_gui_image (guiImage); } + SCM + irr_gui_addScrollBar (SCM wrapped_gui_environment, + SCM horizontal, + SCM rectangle, + SCM rest) + { + SCM parent = SCM_BOOL_F; + SCM id = scm_from_int32 (-1); + + scm_c_bind_keyword_arguments ("add-scrollbar!", rest, (scm_t_keyword_arguments_flags)0, + 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::IGUIScrollBar* scrollbar = + guienv->addScrollBar (scm_to_bool (horizontal), + scm_to_rect_s32 (rectangle), + scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + scm_to_int32 (id)); + return wrap_gui_scrollbar (scrollbar); + } + SCM irr_gui_addStaticText (SCM wrapped_gui_environment, SCM text, diff --git a/src/gui-environment.h b/src/gui-environment.h index 79853fa..6267e5d 100644 --- a/src/gui-environment.h +++ b/src/gui-environment.h @@ -43,6 +43,12 @@ extern "C" { SCM position, SCM rest); + SCM + irr_gui_addScrollBar (SCM wrapped_gui_environment, + SCM horizontal, + SCM rectangle, + SCM rest); + SCM irr_gui_addStaticText (SCM wrapped_gui_environment, SCM text, diff --git a/src/gui-scrollbar.cpp b/src/gui-scrollbar.cpp new file mode 100644 index 0000000..fe7c3b0 --- /dev/null +++ b/src/gui-scrollbar.cpp @@ -0,0 +1,40 @@ +/* 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-scrollbar.h" +#include "wrapped.h" + +extern "C" { + + void + init_gui_scrollbar (void) + { + init_gui_scrollbar_type (); + } + + DEFINE_WRAPPED_TYPE (irr::gui::IGUIScrollBar*, "gui-scrollbar", + init_gui_scrollbar_type, gui_scrollbar_p, + wrap_gui_scrollbar, unwrap_gui_scrollbar); + +} diff --git a/src/gui-scrollbar.h b/src/gui-scrollbar.h new file mode 100644 index 0000000..84be8b1 --- /dev/null +++ b/src/gui-scrollbar.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_SCROLLBAR_H_INCLUDED__ +#define __GUILE_IRRLICHT_GUI_SCROLLBAR_H_INCLUDED__ + +#include +#include +#include "wrapped.h" + +extern "C" { + + void + init_gui_scrollbar (void); + + DECLARE_WRAPPED_TYPE (irr::gui::IGUIScrollBar*, init_gui_scrollbar_type, + gui_scrollbar_p, wrap_gui_scrollbar, unwrap_gui_scrollbar); +} + +#endif diff --git a/src/gui.cpp b/src/gui.cpp index bcc1cef..c7dd404 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -31,6 +31,7 @@ #include "gui-environment.h" #include "gui-font.h" #include "gui-image.h" +#include "gui-scrollbar.h" #include "gui-skin.h" #include "gui-static-text.h" #include "gui-toolbar.h" @@ -47,6 +48,7 @@ extern "C" { init_gui_environment (); init_gui_font (); init_gui_image (); + init_gui_scrollbar (); init_gui_skin (); init_gui_static_text (); init_gui_toolbar ();