]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/gui-skin.cpp
Use SWIG for wrapping C++
[guile-irrlicht.git] / src / gui-skin.cpp
diff --git a/src/gui-skin.cpp b/src/gui-skin.cpp
deleted file mode 100644 (file)
index aeebebe..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
-
-   Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
-
-   This file is part of guile-irrlicht.
-
-   guile-irrlicht is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation; either version 3 of the
-   License, or (at your option) any later version.
-
-   guile-irrlicht is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with guile-irrlicht. If not, see
-   <http://www.gnu.org/licenses/>.
-*/
-
-#include <irrlicht/irrlicht.h>
-#include <libguile.h>
-#include "color.h"
-#include "gsubr.h"
-#include "gui-skin.h"
-#include "wrapped.h"
-
-using namespace irr;
-
-SCM
-IGUISkin_getColor (SCM gui_skin,
-                   SCM color)
-{
-  gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_irr_pointer (gui_skin);
-  video::SColor scolor = skin->getColor (scm_to_default_color (color));
-  return scm_from_color (scolor);
-}
-
-SCM
-IGUISkin_getFont (SCM gui_skin,
-                  SCM which)
-{
-  gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_irr_pointer (gui_skin);
-  gui::IGUIFont* font = skin->getFont (scm_to_default_font (which));
-  return scm_from_irr_pointer ("<gui-font>", (void*) font);
-}
-
-SCM
-IGUISkin_setColor (SCM gui_skin,
-                   SCM which,
-                   SCM new_color)
-{
-  gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_irr_pointer (gui_skin);
-  skin->setColor (scm_to_default_color (which),
-                  scm_to_color (new_color));
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-IGUISkin_setFont (SCM gui_skin,
-                  SCM font,
-                  SCM which)
-{
-  gui::IGUISkin* skin = (gui::IGUISkin*) scm_to_irr_pointer (gui_skin);
-  skin->setFont ((gui::IGUIFont*) scm_to_irr_pointer (font),
-                 scm_to_default_font (which));
-  return SCM_UNSPECIFIED;
-}
-
-void
-init_gui_skin (void)
-{
-  DEFINE_GSUBR ("IGUISkin_getColor", 2, 0, 0, IGUISkin_getColor);
-  DEFINE_GSUBR ("IGUISkin_getFont", 2, 0, 0, IGUISkin_getFont);
-  DEFINE_GSUBR ("IGUISkin_setColor", 3, 0, 0, IGUISkin_setColor);
-  DEFINE_GSUBR ("IGUISkin_setFont", 3, 0, 0, IGUISkin_setFont);
-}
-
-gui::EGUI_DEFAULT_COLOR
-scm_to_default_color (SCM default_color)
-{
-  char* color_name = scm_to_utf8_string (scm_symbol_to_string (default_color));
-  gui::EGUI_DEFAULT_COLOR color;
-
-  if (!strcmp (color_name, "3d-dark-shadow"))
-    {
-      color = gui::EGDC_3D_DARK_SHADOW;
-    }
-  else if (!strcmp (color_name, "3d-shadow"))
-    {
-      color = gui::EGDC_3D_SHADOW;
-    }
-  else if (!strcmp (color_name, "3d-face"))
-    {
-      color = gui::EGDC_3D_FACE;
-    }
-  else if (!strcmp (color_name, "3d-high-light"))
-    {
-      color = gui::EGDC_3D_HIGH_LIGHT;
-    }
-  else if (!strcmp (color_name, "3d-light"))
-    {
-      color = gui::EGDC_3D_LIGHT;
-    }
-  else if (!strcmp (color_name, "active-border"))
-    {
-      color = gui::EGDC_ACTIVE_BORDER;
-    }
-  else if (!strcmp (color_name, "active-caption"))
-    {
-      color = gui::EGDC_ACTIVE_CAPTION;
-    }
-  else if (!strcmp (color_name, "app-workspace"))
-    {
-      color = gui::EGDC_APP_WORKSPACE;
-    }
-  else if (!strcmp (color_name, "button-text"))
-    {
-      color = gui::EGDC_BUTTON_TEXT;
-    }
-  else if (!strcmp (color_name, "gray-text"))
-    {
-      color = gui::EGDC_GRAY_TEXT;
-    }
-  else if (!strcmp (color_name, "high-light"))
-    {
-      color = gui::EGDC_HIGH_LIGHT;
-    }
-  else if (!strcmp (color_name, "high-light-text"))
-    {
-      color = gui::EGDC_HIGH_LIGHT_TEXT;
-    }
-  else if (!strcmp (color_name, "inactive-border"))
-    {
-      color = gui::EGDC_INACTIVE_BORDER;
-    }
-  else if (!strcmp (color_name, "inactive-caption"))
-    {
-      color = gui::EGDC_INACTIVE_CAPTION;
-    }
-  else if (!strcmp (color_name, "tooltip"))
-    {
-      color = gui::EGDC_TOOLTIP;
-    }
-  else if (!strcmp (color_name, "tooltip-background"))
-    {
-      color = gui::EGDC_TOOLTIP_BACKGROUND;
-    }
-  else if (!strcmp (color_name, "scrollbar"))
-    {
-      color = gui::EGDC_SCROLLBAR;
-    }
-  else if (!strcmp (color_name, "window"))
-    {
-      color = gui::EGDC_WINDOW;
-    }
-  else if (!strcmp (color_name, "window-symbol"))
-    {
-      color = gui::EGDC_WINDOW_SYMBOL;
-    }
-  else if (!strcmp (color_name, "icon"))
-    {
-      color = gui::EGDC_ICON;
-    }
-  else if (!strcmp (color_name, "icon-high-light"))
-    {
-      color = gui::EGDC_ICON_HIGH_LIGHT;
-    }
-  else if (!strcmp (color_name, "gray-window-symbol"))
-    {
-      color = gui::EGDC_GRAY_WINDOW_SYMBOL;
-    }
-  else if (!strcmp (color_name, "editable"))
-    {
-      color = gui::EGDC_EDITABLE;
-    }
-  else if (!strcmp (color_name, "gray-editable"))
-    {
-      color = gui::EGDC_GRAY_EDITABLE;
-    }
-  else if (!strcmp (color_name, "focused-editable"))
-    {
-      color = gui::EGDC_FOCUSED_EDITABLE;
-    }
-  else
-    {
-      scm_error (scm_arg_type_key, NULL, "Wrong default color: ~S",
-                 scm_list_1 (default_color), scm_list_1 (default_color));
-    }
-
-  free (color_name);
-  return color;
-}
-
-gui::EGUI_DEFAULT_FONT
-scm_to_default_font (SCM default_font)
-{
-  char* font_name = scm_to_utf8_string (scm_symbol_to_string (default_font));
-  gui::EGUI_DEFAULT_FONT font;
-
-  if (!strcmp (font_name, "default"))
-    {
-      font = gui::EGDF_DEFAULT;
-    }
-  else if (!strcmp (font_name, "button"))
-    {
-      font = gui::EGDF_BUTTON;
-    }
-  else if (!strcmp (font_name, "window"))
-    {
-      font = gui::EGDF_WINDOW;
-    }
-  else if (!strcmp (font_name, "menu"))
-    {
-      font = gui::EGDF_MENU;
-    }
-  else if (!strcmp (font_name, "tooltip"))
-    {
-      font = gui::EGDF_TOOLTIP;
-    }
-  else
-    {
-      scm_error (scm_arg_type_key, NULL, "Wrong default font: ~S",
-                 scm_list_1 (default_font), scm_list_1 (default_font));
-    }
-
-  free (font_name);
-  return font;
-}