]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/gui-listbox.cpp
Some doc
[guile-irrlicht.git] / src / gui-listbox.cpp
index ee82efface87ed52538933acc89f931c71fbfea9..a839690c1034711cd93910f74c733514bdbaff3f 100644 (file)
 #include <libguile.h>
 #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)
+IGUIListBox_addItem (SCM gui_listbox,
+                     SCM text,
+                     SCM icon)
 {
-  gui::IGUIListBox* listbox = (gui::IGUIListBox*)scm_to_pointer (gui_listbox);
+  gui::IGUIListBox* listbox = (gui::IGUIListBox*)scm_to_irr_pointer (gui_listbox);
+  wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
   u32 item_id;
   if (icon == SCM_UNDEFINED)
     {
-      item_id = listbox->addItem (scm_to_wide_char_string (text));
+      item_id = listbox->addItem (wtext);
     }
   else
     {
-      item_id = listbox->addItem (scm_to_wide_char_string (text),
+      item_id = listbox->addItem (wtext,
                                   scm_to_int32 (icon));
     }
+  free (wtext);
   return scm_from_uint32 (item_id);
 }
 
-
-extern "C" {
-
-  void
-  init_gui_listbox (void)
-  {
-    DEFINE_GSUBR ("gui_IGUIListBox_addItem", 2, 1, 0, gui_IGUIListBox_addItem);
-  }
-
+void
+init_gui_listbox (void)
+{
+  DEFINE_GSUBR ("IGUIListBox_addItem", 2, 1, 0, IGUIListBox_addItem);
 }