mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +00:00
Calculator: Add a "Custom" entry to the rounding menu
This entry pop a dialog to ask the user to enter a value. The Calculator will automatically put itself in this mode if you enter a number with more digits in the fractional part than the actual maximum length.
This commit is contained in:
parent
de568f87fd
commit
e3b22c395d
8 changed files with 157 additions and 10 deletions
29
Userland/Applications/Calculator/RoundingDialog.h
Normal file
29
Userland/Applications/Calculator/RoundingDialog.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Lucas Chollet <lucas.chollet@free.fr>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGUI/Dialog.h>
|
||||
|
||||
class RoundingDialog : public GUI::Dialog {
|
||||
C_OBJECT(RoundingDialog);
|
||||
|
||||
public:
|
||||
static ExecResult show(GUI::Window* parent_window, unsigned& rounding_value);
|
||||
|
||||
private:
|
||||
RoundingDialog(GUI::Window* parent_window);
|
||||
virtual ~RoundingDialog() override = default;
|
||||
|
||||
RefPtr<GUI::SpinBox> m_rounding_spinbox;
|
||||
RefPtr<GUI::Widget> m_buttons_container;
|
||||
RefPtr<GUI::DialogButton> m_ok_button;
|
||||
RefPtr<GUI::DialogButton> m_cancel_button;
|
||||
|
||||
static constexpr unsigned m_dialog_length = 200;
|
||||
static constexpr unsigned m_dialog_height = 54;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue