aboutsummaryrefslogtreecommitdiff
path: root/src/gui/guiButton.h
diff options
context:
space:
mode:
authorHugues Ross <hugues.ross@gmail.com>2019-10-12 12:44:23 -0400
committerSmallJoker <SmallJoker@users.noreply.github.com>2019-10-12 18:44:23 +0200
commit69a2099c04527404f2d0942f2088b3d22dd75b5a (patch)
tree8d6fcc7dd688ace290b50f171dc319ccb68e5a5e /src/gui/guiButton.h
parent894008ce6fa02aed05f1ac12e0d7bc62e2476359 (diff)
downloadminetest-69a2099c04527404f2d0942f2088b3d22dd75b5a.tar.gz
minetest-69a2099c04527404f2d0942f2088b3d22dd75b5a.tar.bz2
minetest-69a2099c04527404f2d0942f2088b3d22dd75b5a.zip
Add more visual feedback for button states (#8916)
- Add style properties for overriding the the hovered/pressed state - By default, hovered buttons are a lighter version of the base color - By default, pressed buttons are a darker version of the base color - Add hovered bg image support for image buttons (style property)
Diffstat (limited to 'src/gui/guiButton.h')
-rw-r--r--src/gui/guiButton.h38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/gui/guiButton.h b/src/gui/guiButton.h
index 63e29ccfc..3c353d240 100644
--- a/src/gui/guiButton.h
+++ b/src/gui/guiButton.h
@@ -102,34 +102,30 @@ public:
//! Checks if an override color is enabled
virtual bool isOverrideColorEnabled(void) const;
+ // PATCH
//! Sets an image which should be displayed on the button when it is in the given state.
virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state,
- video::ITexture* image=0,
+ video::ITexture* image=nullptr,
const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0));
//! Sets an image which should be displayed on the button when it is in normal state.
- virtual void setImage(video::ITexture* image=0) override
- {
- setImage(gui::EGBIS_IMAGE_UP, image);
- }
+ virtual void setImage(video::ITexture* image=nullptr) override;
//! Sets an image which should be displayed on the button when it is in normal state.
- virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) override
- {
- setImage(gui::EGBIS_IMAGE_UP, image, pos);
- }
+ virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) override;
//! Sets an image which should be displayed on the button when it is in pressed state.
- virtual void setPressedImage(video::ITexture* image=0) override
- {
- setImage(gui::EGBIS_IMAGE_DOWN, image);
- }
+ virtual void setPressedImage(video::ITexture* image=nullptr) override;
//! Sets an image which should be displayed on the button when it is in pressed state.
- virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) override
- {
- setImage(gui::EGBIS_IMAGE_DOWN, image, pos);
- }
+ virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) override;
+
+ //! Sets an image which should be displayed on the button when it is in hovered state.
+ virtual void setHoveredImage(video::ITexture* image=nullptr);
+ // END PATCH
+
+ //! Sets an image which should be displayed on the button when it is in hovered state.
+ virtual void setHoveredImage(video::ITexture* image, const core::rect<s32>& pos);
//! Sets the sprite bank used by the button
virtual void setSpriteBank(gui::IGUISpriteBank* bank=0) override;
@@ -215,6 +211,10 @@ public:
void setColor(video::SColor color);
+ // PATCH
+ void setHoveredColor(video::SColor color);
+ void setPressedColor(video::SColor color);
+ // END PATCH
//! Do not drop returned handle
@@ -307,4 +307,8 @@ private:
bool ScaleImage;
video::SColor Colors[4];
+ // PATCH
+ video::SColor HoveredColors[4];
+ video::SColor PressedColors[4];
+ // END PATCH
};