From: Javier Sancho Date: Mon, 27 Apr 2020 06:44:22 +0000 (+0200) Subject: Scrollbars are GUI elements too X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=3bfc63a85508e3d6b6b5879a980c1798225a6d89;p=guile-irrlicht.git Scrollbars are GUI elements too --- diff --git a/src/gui-scrollbar.cpp b/src/gui-scrollbar.cpp index 9a71d78..c5dbc8a 100644 --- a/src/gui-scrollbar.cpp +++ b/src/gui-scrollbar.cpp @@ -22,6 +22,7 @@ #include #include +#include "gui-element.h" #include "gui-scrollbar.h" #include "gsubr.h" #include "wrapped.h" @@ -43,7 +44,14 @@ extern "C" { SCM irr_gui_getPos (SCM wrapped_scrollbar) { - irr::gui::IGUIScrollBar* scrollbar = unwrap_gui_scrollbar (wrapped_scrollbar); + irr::gui::IGUIScrollBar* scrollbar; + if (gui_element_p (wrapped_scrollbar)) + { + scrollbar = (irr::gui::IGUIScrollBar*)unwrap_gui_element (wrapped_scrollbar); + } + else { + scrollbar = unwrap_gui_scrollbar (wrapped_scrollbar); + } return scm_from_int32 (scrollbar->getPos ()); } @@ -51,7 +59,14 @@ extern "C" { irr_gui_setPos (SCM wrapped_scrollbar, SCM pos) { - irr::gui::IGUIScrollBar* scrollbar = unwrap_gui_scrollbar (wrapped_scrollbar); + irr::gui::IGUIScrollBar* scrollbar; + if (gui_element_p (wrapped_scrollbar)) + { + scrollbar = (irr::gui::IGUIScrollBar*)unwrap_gui_element (wrapped_scrollbar); + } + else { + scrollbar = unwrap_gui_scrollbar (wrapped_scrollbar); + } scrollbar->setPos (scm_to_int32 (pos)); return SCM_UNSPECIFIED; }