blob: 8f256bd62fad049d02d2c589df1eaa201029cf0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NumericLimits.h>
#include <LibGUI/TextBox.h>
class NumericInput final : public GUI::TextBox {
C_OBJECT(NumericInput)
public:
NumericInput();
virtual ~NumericInput() override = default;
Function<void(i32)> on_number_changed;
void set_min_number(i32 number);
void set_max_number(i32 number);
void set_current_number(i32 number, bool call_change_handler = true);
private:
void on_focus_lost();
bool m_needs_text_reset { false };
i32 m_current_number { 0 };
i32 m_min_number { NumericLimits<i32>::min() };
i32 m_max_number { NumericLimits<i32>::max() };
};
|