]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/gui-toolbar.cpp
Some doc
[guile-irrlicht.git] / src / gui-toolbar.cpp
index 1f38bdbcdcba46fc6e8622cb8456645b4e08962e..134081691d57de16018e74b3a994383a82ca624e 100644 (file)
 #include <libguile.h>
 #include "gsubr.h"
 #include "gui-toolbar.h"
-#include "wchar.h"
-
+#include "wrapped.h"
 
 using namespace irr;
 
-
 SCM
-irr_gui_IGUIToolBar_addButton (SCM gui_toolbar,
-                               SCM id,
-                               SCM text,
-                               SCM tooltiptext,
-                               SCM img,
-                               SCM pressedimg,
-                               SCM is_push_button,
-                               SCM use_alpha_channel)
+IGUIToolBar_addButton (SCM gui_toolbar,
+                       SCM id,
+                       SCM text,
+                       SCM tooltiptext,
+                       SCM img,
+                       SCM pressedimg,
+                       SCM is_push_button,
+                       SCM use_alpha_channel)
 {
-  gui::IGUIToolBar* toolbar = (gui::IGUIToolBar*) scm_to_pointer (gui_toolbar);
+  gui::IGUIToolBar* toolbar = (gui::IGUIToolBar*) scm_to_irr_pointer (gui_toolbar);
+  wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
+  wchar_t* wtooltiptext = (wchar_t*) scm_to_utf32_string (tooltiptext);
+
   gui::IGUIButton* button =
     toolbar->addButton (scm_to_int32 (id),
-                        scm_to_wide_char_string (text),
-                        scm_to_wide_char_string (tooltiptext),
-                        (video::ITexture*) scm_to_pointer (img),
-                        (video::ITexture*) scm_to_pointer (pressedimg),
+                        wtext,
+                        wtooltiptext,
+                        (video::ITexture*) scm_to_irr_pointer (img),
+                        (video::ITexture*) scm_to_irr_pointer (pressedimg),
                         scm_to_bool (is_push_button),
                         scm_to_bool (use_alpha_channel));
-  return scm_from_pointer ((void*) button, NULL);
-}
 
+  free (wtext);
+  free (wtooltiptext);
+  return scm_from_irr_pointer ("<gui-button>", (void*) button);
+}
 
-extern "C" {
-
-  void
-  init_gui_toolbar (void)
-  {
-    DEFINE_GSUBR ("irr_gui_IGUIToolBar_addButton", 8, 0, 0, irr_gui_IGUIToolBar_addButton);
-  }
-
+void
+init_gui_toolbar (void)
+{
+  DEFINE_GSUBR ("IGUIToolBar_addButton", 8, 0, 0, IGUIToolBar_addButton);
 }