summaryrefslogtreecommitdiff
path: root/Applications/Calculator/CalculatorWidget.h
blob: 7ecfec5f0c94ef933ee5097495295f8f1aacf295 (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
#pragma once

#include "Calculator.h"
#include "Keypad.h"
#include <AK/Vector.h>
#include <LibGUI/GWidget.h>

class GTextBox;
class GButton;
class GLabel;

class CalculatorWidget final : public GWidget {
    C_OBJECT(CalculatorWidget)
public:
    explicit CalculatorWidget(GWidget*);
    virtual ~CalculatorWidget();

private:
    void add_button(GButton&, Calculator::Operation);
    void add_button(GButton&, int);
    void add_button(GButton&);

    void update_display();

    Calculator m_calculator;
    Keypad m_keypad;

    GTextBox* m_entry { nullptr };
    GLabel* m_label { nullptr };
};