X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgui-listbox.cpp;h=b7232501843a2080c08f7ee2d834eba03cfb53ea;hb=df1088b80d2c90a390b0229ce5c6ffcc7665fda4;hp=1c81998d4070b948c0cabf47088a8e9ca7fc04f8;hpb=7006c85b72b5eff7cfc935624711cf0bfdaa1508;p=guile-irrlicht.git diff --git a/src/gui-listbox.cpp b/src/gui-listbox.cpp index 1c81998..b723250 100644 --- a/src/gui-listbox.cpp +++ b/src/gui-listbox.cpp @@ -21,20 +21,34 @@ #include #include - #include "gui-listbox.h" +#include "gsubr.h" +#include "wchar.h" #include "wrapped.h" -extern "C" { - - void - init_gui_listbox (void) - { - init_gui_listbox_type (); - } - - DEFINE_WRAPPED_TYPE (irr::gui::IGUIListBox*, "gui-listbox", - init_gui_listbox_type, gui_listbox_p, - wrap_gui_listbox, unwrap_gui_listbox); +using namespace irr; + +SCM +IGUIListBox_addItem (SCM gui_listbox, + SCM text, + SCM icon) +{ + gui::IGUIListBox* listbox = (gui::IGUIListBox*)scm_to_irr_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); +} +void +init_gui_listbox (void) +{ + DEFINE_GSUBR ("IGUIListBox_addItem", 2, 1, 0, IGUIListBox_addItem); }