diff options
Diffstat (limited to 'src/gui/guiFormSpecMenu.cpp')
-rw-r--r-- | src/gui/guiFormSpecMenu.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index aee7da869..ea6072cab 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -712,6 +712,13 @@ void GUIFormSpecMenu::parseButton(parserData* data, const std::string &element, if (style.isNotDefault(StyleSpec::BGCOLOR)) { e->setColor(style.getColor(StyleSpec::BGCOLOR)); } + if (style.isNotDefault(StyleSpec::BGCOLOR_HOVERED)) { + e->setHoveredColor(style.getColor(StyleSpec::BGCOLOR_HOVERED)); + } + if (style.isNotDefault(StyleSpec::BGCOLOR_PRESSED)) { + e->setPressedColor(style.getColor(StyleSpec::BGCOLOR_PRESSED)); + } + if (style.isNotDefault(StyleSpec::TEXTCOLOR)) { e->setOverrideColor(style.getColor(StyleSpec::TEXTCOLOR)); } @@ -720,11 +727,17 @@ void GUIFormSpecMenu::parseButton(parserData* data, const std::string &element, if (style.isNotDefault(StyleSpec::BGIMG)) { std::string image_name = style.get(StyleSpec::BGIMG, ""); + std::string hovered_image_name = style.get(StyleSpec::BGIMG_HOVERED, ""); std::string pressed_image_name = style.get(StyleSpec::BGIMG_PRESSED, ""); video::ITexture *texture = 0; + video::ITexture *hovered_texture = 0; video::ITexture *pressed_texture = 0; texture = m_tsrc->getTexture(image_name); + if (!hovered_image_name.empty()) + hovered_texture = m_tsrc->getTexture(hovered_image_name); + else + hovered_texture = texture; if (!pressed_image_name.empty()) pressed_texture = m_tsrc->getTexture(pressed_image_name); else @@ -733,6 +746,8 @@ void GUIFormSpecMenu::parseButton(parserData* data, const std::string &element, e->setUseAlphaChannel(style.getBool(StyleSpec::ALPHA, true)); e->setImage(guiScalingImageButton( Environment->getVideoDriver(), texture, geom.X, geom.Y)); + e->setHoveredImage(guiScalingImageButton( + Environment->getVideoDriver(), hovered_texture, geom.X, geom.Y)); e->setPressedImage(guiScalingImageButton( Environment->getVideoDriver(), pressed_texture, geom.X, geom.Y)); e->setScaleImage(true); @@ -1620,7 +1635,7 @@ void GUIFormSpecMenu::parseImageButton(parserData* data, const std::string &elem else pressed_texture = texture; - gui::IGUIButton *e = Environment->addButton(rect, this, spec.fid, spec.flabel.c_str()); + GUIButton *e = GUIButton::addButton(Environment, rect, this, spec.fid, spec.flabel.c_str()); if (spec.fname == data->focused_fieldname) { Environment->setFocus(e); @@ -1818,7 +1833,7 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data, const std::string & 258 + m_fields.size() ); - gui::IGUIButton *e = Environment->addButton(rect, this, spec.fid, L""); + gui::IGUIButton *e = GUIButton::addButton(Environment, rect, this, spec.fid, L""); auto style = getStyleForElement("item_image_button", spec.fname, "image_button"); e->setNotClipped(style.getBool(StyleSpec::NOCLIP, false)); @@ -2697,7 +2712,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) core::rect<s32>(size.X/2-70, pos.Y, (size.X/2-70)+140, pos.Y + (m_btn_height*2)); const wchar_t *text = wgettext("Proceed"); - Environment->addButton(mydata.rect, this, 257, text); + GUIButton::addButton(Environment, mydata.rect, this, 257, text); delete[] text; } |