summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/GSpinBox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibGUI/GSpinBox.cpp')
-rw-r--r--Libraries/LibGUI/GSpinBox.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/Libraries/LibGUI/GSpinBox.cpp b/Libraries/LibGUI/GSpinBox.cpp
index fe33a3e3dd..9482ee6341 100644
--- a/Libraries/LibGUI/GSpinBox.cpp
+++ b/Libraries/LibGUI/GSpinBox.cpp
@@ -59,10 +59,7 @@ GSpinBox::~GSpinBox()
void GSpinBox::set_value(int value)
{
- if (value < m_min)
- value = m_min;
- if (value > m_max)
- value = m_max;
+ value = clamp(value, m_min, m_max);
if (m_value == value)
return;
m_value = value;
@@ -82,10 +79,7 @@ void GSpinBox::set_range(int min, int max)
m_max = max;
int old_value = m_value;
- if (m_value < m_min)
- m_value = m_min;
- if (m_value > m_max)
- m_value = m_max;
+ m_value = clamp(m_value, m_min, m_max);
if (on_change && m_value != old_value)
on_change(m_value);