From 3bfc63a85508e3d6b6b5879a980c1798225a6d89 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Mon, 27 Apr 2020 08:44:22 +0200 Subject: [PATCH] Scrollbars are GUI elements too --- src/gui-scrollbar.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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; } -- 2.39.5