diff --git a/src/widgets/smooth_widget/smooth_widget.cpp b/src/widgets/smooth_widget/smooth_widget.cpp index a2c99ec..6165f32 100644 --- a/src/widgets/smooth_widget/smooth_widget.cpp +++ b/src/widgets/smooth_widget/smooth_widget.cpp @@ -16,28 +16,28 @@ void SmoothWidgetBase::popOut() { onPopOut(); iterateChildren([&](WidgetBase* child) { ((SmoothWidgetBase*)child)->popOut(); }); - _smooth_base_data.is_widget_retracting = false; + _smooth_base_data.is_hiding = false; } -void SmoothWidgetBase::retract() +void SmoothWidgetBase::hide() { - onRetract(); - iterateChildren([&](WidgetBase* child) { ((SmoothWidgetBase*)child)->retract(); }); - _smooth_base_data.is_widget_retracting = true; + onHide(); + iterateChildren([&](WidgetBase* child) { ((SmoothWidgetBase*)child)->hide(); }); + _smooth_base_data.is_hiding = true; } -bool SmoothWidgetBase::isRetracting() +bool SmoothWidgetBase::isHidden() { // Self check if (!isTransitionFinish()) return false; - if (!_smooth_base_data.is_widget_retracting) + if (!_smooth_base_data.is_hiding) return false; // Children check for (const auto& i : _base_data.children) { - if (!((SmoothWidgetBase*)i)->isRetracting()) + if (!((SmoothWidgetBase*)i)->isHidden()) return false; } return true; @@ -48,7 +48,7 @@ bool SmoothWidgetBase::isPoppedOut() // Self check if (!isTransitionFinish()) return false; - if (_smooth_base_data.is_widget_retracting) + if (_smooth_base_data.is_hiding) return false; // Children check @@ -60,6 +60,20 @@ bool SmoothWidgetBase::isPoppedOut() return true; } +bool SmoothWidgetBase::isHidding() +{ + if (_smooth_base_data.is_hiding && !isHidden()) + return true; + return false; +} + +bool SmoothWidgetBase::isPoppingOut() +{ + if (!_smooth_base_data.is_hiding && !isPoppedOut()) + return true; + return false; +} + void SmoothWidgetBase::updateTransition(const TimeSize_t& currentTime) { // Update transition diff --git a/src/widgets/smooth_widget/smooth_widget.h b/src/widgets/smooth_widget/smooth_widget.h index eb6953f..6959f8a 100644 --- a/src/widgets/smooth_widget/smooth_widget.h +++ b/src/widgets/smooth_widget/smooth_widget.h @@ -30,7 +30,7 @@ namespace SmoothUIToolKit Transition4D transition; // Transition direction - bool is_widget_retracting = true; + bool is_hiding = true; }; SmoothBaseData_t _smooth_base_data; @@ -49,10 +49,10 @@ namespace SmoothUIToolKit virtual void popOut(); /** - * @brief Retract widget + * @brief Hide widget * */ - virtual void retract(); + virtual void hide(); /** * @brief Is transition finished @@ -63,12 +63,12 @@ namespace SmoothUIToolKit virtual bool isTransitionFinish() { return _smooth_base_data.transition.isFinish(); } /** - * @brief Is widget completely retracting + * @brief Is widget completely isHidden * * @return true * @return false */ - virtual bool isRetracting(); + virtual bool isHidden(); /** * @brief Is widget completely popped out @@ -78,6 +78,22 @@ namespace SmoothUIToolKit */ virtual bool isPoppedOut(); + /** + * @brief Is widget hidding currently + * + * @return true + * @return false + */ + virtual bool isHidding(); + + /** + * @brief Is widget popping out currently + * + * @return true + * @return false + */ + virtual bool isPoppingOut(); + /** * @brief Update transition * @@ -103,10 +119,10 @@ namespace SmoothUIToolKit virtual void onPopOut() {} /** - * @brief Setup your retract transition + * @brief Setup your hiding transition * */ - virtual void onRetract() {} + virtual void onHide() {} }; } // namespace Widgets } // namespace SmoothUIToolKit