From fbe90f42f1eddac5a30089b905ad405d007104bc Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sat, 9 May 2020 14:02:13 +0200 Subject: [PATCH] gui-listbox --- src/gui-listbox.cpp | 52 ++++++++++++++++++++++----------------------- src/gui-listbox.h | 16 +++++--------- 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/gui-listbox.cpp b/src/gui-listbox.cpp index 599eca7..ee82eff 100644 --- a/src/gui-listbox.cpp +++ b/src/gui-listbox.cpp @@ -21,42 +21,40 @@ #include #include - #include "gui-listbox.h" #include "gsubr.h" #include "wchar.h" -#include "wrapped.h" + + +using namespace irr; + + +SCM +gui_IGUIListBox_addItem (SCM gui_listbox, + SCM text, + SCM icon) +{ + gui::IGUIListBox* listbox = (gui::IGUIListBox*)scm_to_pointer (gui_listbox); + u32 item_id; + if (icon == SCM_UNDEFINED) + { + item_id = listbox->addItem (scm_to_wide_char_string (text)); + } + else + { + item_id = listbox->addItem (scm_to_wide_char_string (text), + scm_to_int32 (icon)); + } + return scm_from_uint32 (item_id); +} + extern "C" { void init_gui_listbox (void) { - init_gui_listbox_type (); - DEFINE_GSUBR ("add-listbox-item!", 2, 1, 0, irr_gui_IGUIListBox_addItem); - } - - DEFINE_WRAPPED_TYPE (irr::gui::IGUIListBox*, "gui-listbox", - init_gui_listbox_type, gui_listbox_p, - wrap_gui_listbox, unwrap_gui_listbox); - - SCM - irr_gui_IGUIListBox_addItem (SCM wrapped_gui_listbox, - SCM text, - SCM icon) - { - irr::gui::IGUIListBox* listbox = unwrap_gui_listbox (wrapped_gui_listbox); - irr::u32 item_id; - if (icon == SCM_UNDEFINED) - { - item_id = listbox->addItem (scm_to_wide_char_string (text)); - } - else - { - item_id = listbox->addItem (scm_to_wide_char_string (text), - scm_to_int32 (icon)); - } - return scm_from_uint32 (item_id); + DEFINE_GSUBR ("gui_IGUIListBox_addItem", 2, 1, 0, gui_IGUIListBox_addItem); } } diff --git a/src/gui-listbox.h b/src/gui-listbox.h index 23da332..f4e1ff7 100644 --- a/src/gui-listbox.h +++ b/src/gui-listbox.h @@ -24,21 +24,15 @@ #include #include -#include "wrapped.h" -extern "C" { +SCM +gui_IGUIListBox_addItem (SCM gui_listbox, + SCM text, + SCM icon); +extern "C" { void init_gui_listbox (void); - - DECLARE_WRAPPED_TYPE (irr::gui::IGUIListBox*, init_gui_listbox_type, - gui_listbox_p, wrap_gui_listbox, unwrap_gui_listbox); - - SCM - irr_gui_IGUIListBox_addItem (SCM wrapped_gui_listbox, - SCM text, - SCM icon); - } #endif -- 2.39.2