mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-10-27 00:48:31 -04:00
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#pragma once
|
|
|
|
#include "windows/AppWindow.hpp"
|
|
#include "Application.hpp"
|
|
#include "application-calculator/widgets/MathOperationsBox.hpp"
|
|
#include <module-gui/gui/widgets/Text.hpp>
|
|
#include <module-utils/tinyexpr/tinyexpr.h>
|
|
|
|
namespace gui
|
|
{
|
|
|
|
class CalculatorMainWindow : public gui::AppWindow
|
|
{
|
|
gui::Text *mathOperationInput = nullptr;
|
|
gui::MathOperationsBox *mathBox = nullptr;
|
|
|
|
bool clearInput = false;
|
|
void writeEquation(bool lastCharIsSymbol, const UTF8 &symbol);
|
|
void applyInputCallback();
|
|
bool isPreviousNumberDecimal();
|
|
bool isSymbol(uint32_t character);
|
|
|
|
public:
|
|
CalculatorMainWindow(app::Application *app, std::string name);
|
|
|
|
~CalculatorMainWindow() override = default;
|
|
void buildInterface() override;
|
|
bool onInput(const gui::InputEvent &inputEvent) override;
|
|
};
|
|
|
|
} // namespace gui
|