X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgui.cpp;h=532a78645f05c821d463c6d1b671468ce10400f3;hb=c29f09b112d14ca0a37ee6733dc9748eb4e599c2;hp=bb4f9e92efa2047bea3a05ed7951b09603e3af0b;hpb=26bfba9849221399127c93fe557c7877b523ec94;p=guile-irrlicht.git diff --git a/src/gui.cpp b/src/gui.cpp index bb4f9e9..532a786 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -25,17 +25,103 @@ #include "color.h" #include "gsubr.h" #include "gui.h" +#include "gui-button.h" #include "gui-edit-box.h" +#include "gui-element.h" +#include "gui-environment.h" +#include "gui-font.h" +#include "gui-image.h" +#include "gui-scrollbar.h" +#include "gui-skin.h" #include "gui-static-text.h" +#include "gui-toolbar.h" extern "C" { void init_gui (void) { + // Init objects + init_gui_button (); + init_gui_edit_box (); + init_gui_element (); + init_gui_environment (); + init_gui_font (); + init_gui_image (); + init_gui_scrollbar (); + init_gui_skin (); + init_gui_static_text (); + init_gui_toolbar (); + + // 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); } + SCM + irr_gui_addButton (SCM wrapped_obj, + SCM rectangle, + SCM rest) + { + if (gui_toolbar_p (wrapped_obj)) + { + return irr_gui_IGUIToolBar_addButton (wrapped_obj, rest); + } + else if (gui_environment_p (wrapped_obj)) + { + return irr_gui_IGUIEnvironment_addButton (wrapped_obj, rectangle, rest); + } + else + { + scm_error (scm_arg_type_key, NULL, "Cannot add button to object: ~S", + scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj)); + } + } + + SCM + irr_gui_getFont (SCM wrapped_obj, + SCM filename, + SCM rest) + { + if (gui_environment_p (wrapped_obj)) + { + return irr_gui_IGUIEnvironment_getFont (wrapped_obj, filename); + } + else if (gui_skin_p (wrapped_obj)) + { + return irr_gui_IGUISkin_getFont (wrapped_obj, rest); + } + else + { + scm_error (scm_arg_type_key, NULL, "Cannot get font from object: ~S", + scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj)); + } + } + + 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)