LibGUI: Add an auto-repeat interval to GAbstractButton.

Use this in GSpinBox to implement auto-increment / auto-decrement while you
are pressing down the respective buttons. :^)
This commit is contained in:
Andreas Kling 2019-07-13 10:27:19 +02:00
parent c53f6a52e0
commit b425de18cc
Notes: sideshowbarker 2024-07-19 13:18:32 +09:00
5 changed files with 35 additions and 2 deletions

View file

@ -19,10 +19,12 @@ GSpinBox::GSpinBox(GWidget* parent)
m_increment_button->set_focusable(false);
m_increment_button->set_text("\xf6");
m_increment_button->on_click = [this](GButton&) { set_value(m_value + 1); };
m_increment_button->set_auto_repeat_interval(150);
m_decrement_button = new GButton(this);
m_decrement_button->set_focusable(false);
m_decrement_button->set_text("\xf7");
m_decrement_button->on_click = [this](GButton&) { set_value(m_value - 1); };
m_decrement_button->set_auto_repeat_interval(150);
}
GSpinBox::~GSpinBox()