mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:12:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #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:
 | |
|     virtual ~CalculatorWidget() override;
 | |
| 
 | |
| private:
 | |
|     explicit CalculatorWidget(GWidget*);
 | |
|     void add_button(GButton&, Calculator::Operation);
 | |
|     void add_button(GButton&, int);
 | |
|     void add_button(GButton&);
 | |
| 
 | |
|     void update_display();
 | |
| 
 | |
|     Calculator m_calculator;
 | |
|     Keypad m_keypad;
 | |
| 
 | |
|     RefPtr<GTextBox> m_entry;
 | |
|     RefPtr<GLabel> m_label;
 | |
| 
 | |
|     RefPtr<GButton> m_digit_button[10];
 | |
|     RefPtr<GButton> m_mem_add_button;
 | |
|     RefPtr<GButton> m_mem_save_button;
 | |
|     RefPtr<GButton> m_mem_recall_button;
 | |
|     RefPtr<GButton> m_mem_clear_button;
 | |
|     RefPtr<GButton> m_clear_button;
 | |
|     RefPtr<GButton> m_clear_error_button;
 | |
|     RefPtr<GButton> m_backspace_button;
 | |
|     RefPtr<GButton> m_decimal_point_button;
 | |
|     RefPtr<GButton> m_sign_button;
 | |
|     RefPtr<GButton> m_add_button;
 | |
|     RefPtr<GButton> m_subtract_button;
 | |
|     RefPtr<GButton> m_multiply_button;
 | |
|     RefPtr<GButton> m_divide_button;
 | |
|     RefPtr<GButton> m_sqrt_button;
 | |
|     RefPtr<GButton> m_inverse_button;
 | |
|     RefPtr<GButton> m_percent_button;
 | |
|     RefPtr<GButton> m_equals_button;
 | |
| 
 | |
| };
 | 
