X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fgui-skin.cpp;h=019dfdf4696747447ce479051fd2db011a64bdab;hb=65527be1c7ad3f05ba651c25249fd8300f5f4fad;hp=5bbfc6633c99a919228bf64e11f2ba87b6ed706e;hpb=15be0323f62a228707f616c25c4b87cd1d68766f;p=guile-irrlicht.git diff --git a/src/gui-skin.cpp b/src/gui-skin.cpp index 5bbfc66..019dfdf 100644 --- a/src/gui-skin.cpp +++ b/src/gui-skin.cpp @@ -22,6 +22,7 @@ #include #include +#include "color.h" #include "gsubr.h" #include "gui-font.h" #include "gui-skin.h" @@ -33,7 +34,6 @@ extern "C" { init_gui_skin (void) { init_gui_skin_type (); - DEFINE_GSUBR ("get-skin-font", 1, 0, 1, irr_gui_getSkinFont); DEFINE_GSUBR ("set-font!", 2, 0, 1, irr_gui_setFont); } @@ -42,18 +42,12 @@ extern "C" { wrap_gui_skin, unwrap_gui_skin); SCM - irr_gui_getSkinFont (SCM wrapped_gui_skin, - SCM rest) + irr_gui_IGUISkin_getColor (SCM wrapped_gui_skin, + SCM color) { - SCM which = scm_from_utf8_symbol ("default"); - - scm_c_bind_keyword_arguments ("get-skin-font", rest, (scm_t_keyword_arguments_flags)0, - scm_from_utf8_keyword ("which"), &which, - SCM_UNDEFINED); - irr::gui::IGUISkin* skin = unwrap_gui_skin (wrapped_gui_skin); - irr::gui::IGUIFont* font = skin->getFont (scm_to_default_font (which)); - return wrap_gui_font (font); + irr::video::SColor scolor = skin->getColor (scm_to_default_color (color)); + return scm_from_color (scolor); } SCM @@ -71,6 +65,17 @@ extern "C" { return wrap_gui_font (font); } + SCM + irr_gui_IGUISkin_setColor (SCM wrapped_gui_skin, + SCM which, + SCM new_color) + { + irr::gui::IGUISkin* skin = unwrap_gui_skin (wrapped_gui_skin); + skin->setColor (scm_to_default_color (which), + scm_to_color (new_color)); + return SCM_UNSPECIFIED; + } + SCM irr_gui_setFont (SCM wrapped_gui_skin, SCM font, @@ -88,6 +93,117 @@ extern "C" { return SCM_UNSPECIFIED; } + irr::gui::EGUI_DEFAULT_COLOR + scm_to_default_color (SCM default_color) + { + char* color = scm_to_utf8_stringn (scm_symbol_to_string (default_color), NULL); + if (!strcmp (color, "3d-dark-shadow")) + { + return irr::gui::EGDC_3D_DARK_SHADOW; + } + else if (!strcmp (color, "3d-shadow")) + { + return irr::gui::EGDC_3D_SHADOW; + } + else if (!strcmp (color, "3d-face")) + { + return irr::gui::EGDC_3D_FACE; + } + else if (!strcmp (color, "3d-high-light")) + { + return irr::gui::EGDC_3D_HIGH_LIGHT; + } + else if (!strcmp (color, "3d-light")) + { + return irr::gui::EGDC_3D_LIGHT; + } + else if (!strcmp (color, "active-border")) + { + return irr::gui::EGDC_ACTIVE_BORDER; + } + else if (!strcmp (color, "active-caption")) + { + return irr::gui::EGDC_ACTIVE_CAPTION; + } + else if (!strcmp (color, "app-workspace")) + { + return irr::gui::EGDC_APP_WORKSPACE; + } + else if (!strcmp (color, "button-text")) + { + return irr::gui::EGDC_BUTTON_TEXT; + } + else if (!strcmp (color, "gray-text")) + { + return irr::gui::EGDC_GRAY_TEXT; + } + else if (!strcmp (color, "high-light")) + { + return irr::gui::EGDC_HIGH_LIGHT; + } + else if (!strcmp (color, "high-light-text")) + { + return irr::gui::EGDC_HIGH_LIGHT_TEXT; + } + else if (!strcmp (color, "inactive-border")) + { + return irr::gui::EGDC_INACTIVE_BORDER; + } + else if (!strcmp (color, "inactive-caption")) + { + return irr::gui::EGDC_INACTIVE_CAPTION; + } + else if (!strcmp (color, "tooltip")) + { + return irr::gui::EGDC_TOOLTIP; + } + else if (!strcmp (color, "tooltip-background")) + { + return irr::gui::EGDC_TOOLTIP_BACKGROUND; + } + else if (!strcmp (color, "scrollbar")) + { + return irr::gui::EGDC_SCROLLBAR; + } + else if (!strcmp (color, "window")) + { + return irr::gui::EGDC_WINDOW; + } + else if (!strcmp (color, "window-symbol")) + { + return irr::gui::EGDC_WINDOW_SYMBOL; + } + else if (!strcmp (color, "icon")) + { + return irr::gui::EGDC_ICON; + } + else if (!strcmp (color, "icon-high-light")) + { + return irr::gui::EGDC_ICON_HIGH_LIGHT; + } + else if (!strcmp (color, "gray-window-symbol")) + { + return irr::gui::EGDC_GRAY_WINDOW_SYMBOL; + } + else if (!strcmp (color, "editable")) + { + return irr::gui::EGDC_EDITABLE; + } + else if (!strcmp (color, "gray-editable")) + { + return irr::gui::EGDC_GRAY_EDITABLE; + } + else if (!strcmp (color, "focused-editable")) + { + return irr::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)); + } + } + irr::gui::EGUI_DEFAULT_FONT scm_to_default_font (SCM default_font) {