diff --git a/GsKit/widgets/GsButton.cpp b/GsKit/widgets/GsButton.cpp index da5e7ee76..250f9b52d 100644 --- a/GsKit/widgets/GsButton.cpp +++ b/GsKit/widgets/GsButton.cpp @@ -253,7 +253,7 @@ void GsButton::processLogic() } void GsButton::drawNoStyle(const SDL_Rect& lRect) -{ +{ if(lRect.h == 0 || lRect.w == 0) return; @@ -306,6 +306,9 @@ void GsButton::drawEnabledButton(GsWeakSurface &, void GsButton::processRender(const GsRect &RectDispCoordFloat) { + if(mHidden) + return; + // Transform to the display coordinates auto displayRect = getRect(); @@ -323,6 +326,9 @@ void GsButton::processRender(const GsRect &RectDispCoordFloat) void GsButton::processRender(const GsRect &backRect, const GsRect &frontRect) { + if(mHidden) + return; + // Transform this object display coordinates auto objBackRect = backRect.transformed(getRect()); auto objFrontRect = objBackRect.clipped(frontRect); diff --git a/GsKit/widgets/GsButton.h b/GsKit/widgets/GsButton.h index 3479bb6aa..aa076cdb3 100644 --- a/GsKit/widgets/GsButton.h +++ b/GsKit/widgets/GsButton.h @@ -165,6 +165,11 @@ class GsButton : public GsControl mRounded = rounded; } + void hide(const bool val = true) + { + mHidden = val; + } + protected: @@ -195,6 +200,8 @@ class GsButton : public GsControl // if hovered or selected bool mRounded = false; + + bool mHidden = false; }; std::shared_ptr createButtonFrom(const GsKit::ptree &node);