Skip to content

Commit

Permalink
Refactor WidgetRange increment and decrement methods
Browse files Browse the repository at this point in the history
The code now simplifies the increment and decrement methods in the WidgetRange class, improving readability and maintainability.
  • Loading branch information
forntoh committed Oct 22, 2024
1 parent 548996b commit d2f055e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/widget/WidgetRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

#include "BaseWidgetValue.h"

/**
* @class WidgetRange
* @brief Widget that allows user to select a value from a range.
* Manages a value within a specified range, allowing incrementing and decrementing.
*/
template <typename T>
class WidgetRange : public BaseWidgetValue<T> {
protected:
Expand Down Expand Up @@ -49,17 +54,11 @@ class WidgetRange : public BaseWidgetValue<T> {
if (renderer->isInEditMode()) {
switch (command) {
case UP:
if (increment()) {
BaseWidgetValue<T>::handleChange();
return true;
}
return false;
if (increment()) BaseWidgetValue<T>::handleChange();
return true;
case DOWN:
if (decrement()) {
BaseWidgetValue<T>::handleChange();
return true;
}
return false;
if (decrement()) BaseWidgetValue<T>::handleChange();
return true;
default:
return false;
}
Expand Down

0 comments on commit d2f055e

Please sign in to comment.