From: Javier Sancho Date: Thu, 23 Apr 2020 06:39:24 +0000 (+0200) Subject: get-pos set-pos! set-max! X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=c29f09b112d14ca0a37ee6733dc9748eb4e599c2;p=guile-irrlicht.git get-pos set-pos! set-max! --- diff --git a/src/gui-scrollbar.cpp b/src/gui-scrollbar.cpp index fe7c3b0..9a71d78 100644 --- a/src/gui-scrollbar.cpp +++ b/src/gui-scrollbar.cpp @@ -23,6 +23,7 @@ #include #include "gui-scrollbar.h" +#include "gsubr.h" #include "wrapped.h" extern "C" { @@ -31,10 +32,28 @@ extern "C" { init_gui_scrollbar (void) { init_gui_scrollbar_type (); + DEFINE_GSUBR ("get-pos", 1, 0, 0, irr_gui_getPos); + DEFINE_GSUBR ("set-pos!", 2, 0, 0, irr_gui_setPos); } DEFINE_WRAPPED_TYPE (irr::gui::IGUIScrollBar*, "gui-scrollbar", init_gui_scrollbar_type, gui_scrollbar_p, wrap_gui_scrollbar, unwrap_gui_scrollbar); + SCM + irr_gui_getPos (SCM wrapped_scrollbar) + { + irr::gui::IGUIScrollBar* scrollbar = unwrap_gui_scrollbar (wrapped_scrollbar); + return scm_from_int32 (scrollbar->getPos ()); + } + + SCM + irr_gui_setPos (SCM wrapped_scrollbar, + SCM pos) + { + irr::gui::IGUIScrollBar* scrollbar = unwrap_gui_scrollbar (wrapped_scrollbar); + scrollbar->setPos (scm_to_int32 (pos)); + return SCM_UNSPECIFIED; + } + } diff --git a/src/gui-scrollbar.h b/src/gui-scrollbar.h index 84be8b1..8dcf7d7 100644 --- a/src/gui-scrollbar.h +++ b/src/gui-scrollbar.h @@ -33,6 +33,14 @@ extern "C" { DECLARE_WRAPPED_TYPE (irr::gui::IGUIScrollBar*, init_gui_scrollbar_type, gui_scrollbar_p, wrap_gui_scrollbar, unwrap_gui_scrollbar); + + SCM + irr_gui_getPos (SCM wrapped_scrollbar); + + SCM + irr_gui_setPos (SCM wrapped_scrollbar, + SCM pos); + } #endif diff --git a/src/gui.cpp b/src/gui.cpp index c7dd404..532a786 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -56,6 +56,7 @@ extern "C" { // Shared procedures (used by two or more objects) DEFINE_GSUBR ("add-button!", 1, 1, 1, irr_gui_addButton); DEFINE_GSUBR ("get-font", 1, 1, 1, irr_gui_getFont); + DEFINE_GSUBR ("set-max!", 2, 0, 0, irr_gui_setMax); DEFINE_GSUBR ("set-override-color!", 2, 0, 0, irr_gui_setOverrideColor); } @@ -99,6 +100,28 @@ extern "C" { } } + SCM + irr_gui_setMax (SCM wrapped_obj, + SCM max) + { +#define SET_MAX(OBJ) OBJ->setMax (scm_to_int32 (max)); + + if (gui_edit_box_p (wrapped_obj)) + { + SET_MAX (unwrap_gui_edit_box (wrapped_obj)); + } + else if (gui_scrollbar_p (wrapped_obj)) + { + SET_MAX (unwrap_gui_scrollbar (wrapped_obj)); + } + else + { + scm_error (scm_arg_type_key, NULL, "Cannot set max to object: ~S", + scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj)); + } + return SCM_UNSPECIFIED; + } + SCM irr_gui_setOverrideColor (SCM wrapped_obj, SCM color) diff --git a/src/gui.h b/src/gui.h index f86abb3..29c3ee6 100644 --- a/src/gui.h +++ b/src/gui.h @@ -40,6 +40,10 @@ extern "C" { SCM filename, SCM rest); + SCM + irr_gui_setMax (SCM wrapped_obj, + SCM max); + SCM irr_gui_setOverrideColor (SCM wrapped_obj, SCM color);