Calculator: Add a separator line between the menu and the main UI
This commit is contained in:
parent
3bca395190
commit
8e74c9dbb6
Notes:
sideshowbarker
2024-07-18 20:35:28 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8e74c9dbb61
2 changed files with 237 additions and 226 deletions
Userland/Applications/Calculator
|
@ -1,272 +1,283 @@
|
|||
@GUI::Widget {
|
||||
fixed_width: 254
|
||||
fixed_height: 213
|
||||
fixed_height: 215
|
||||
fill_with_background_color: true
|
||||
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [10, 0, 10, 0]
|
||||
}
|
||||
|
||||
@GUI::TextBox {
|
||||
name: "entry_textbox"
|
||||
font_type: "FixedWidth"
|
||||
}
|
||||
layout: @GUI::VerticalBoxLayout
|
||||
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
layout: @GUI::VerticalBoxLayout
|
||||
|
||||
@GUI::Label {
|
||||
name: "label"
|
||||
fixed_width: 35
|
||||
fixed_height: 27
|
||||
@GUI::HorizontalSeparator {
|
||||
fixed_height: 2
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [10, 2, 10, 0]
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "backspace_button"
|
||||
text: "Backspace"
|
||||
fixed_width: 65
|
||||
fixed_height: 28
|
||||
foreground_color: "brown"
|
||||
}
|
||||
@GUI::TextBox {
|
||||
name: "entry_textbox"
|
||||
font_type: "FixedWidth"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "clear_error_button"
|
||||
text: "CE"
|
||||
fixed_width: 55
|
||||
fixed_height: 28
|
||||
foreground_color: "brown"
|
||||
}
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
|
||||
@GUI::Button {
|
||||
name: "clear_button"
|
||||
text: "C"
|
||||
fixed_width: 60
|
||||
fixed_height: 28
|
||||
foreground_color: "brown"
|
||||
}
|
||||
}
|
||||
@GUI::Label {
|
||||
name: "label"
|
||||
fixed_width: 35
|
||||
fixed_height: 27
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "mem_clear_button"
|
||||
text: "MC"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "backspace_button"
|
||||
text: "Backspace"
|
||||
fixed_width: 65
|
||||
fixed_height: 28
|
||||
foreground_color: "brown"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "clear_error_button"
|
||||
text: "CE"
|
||||
fixed_width: 55
|
||||
fixed_height: 28
|
||||
foreground_color: "brown"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "7_button"
|
||||
text: "7"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "clear_button"
|
||||
text: "C"
|
||||
fixed_width: 60
|
||||
fixed_height: 28
|
||||
foreground_color: "brown"
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "8_button"
|
||||
text: "8"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
|
||||
@GUI::Button {
|
||||
name: "9_button"
|
||||
text: "9"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "mem_clear_button"
|
||||
text: "MC"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "divide_button"
|
||||
text: "/"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
}
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "sqrt_button"
|
||||
text: "sqrt"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "7_button"
|
||||
text: "7"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
@GUI::Button {
|
||||
name: "8_button"
|
||||
text: "8"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "mem_recall_button"
|
||||
text: "MR"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "9_button"
|
||||
text: "9"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "divide_button"
|
||||
text: "/"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "4_button"
|
||||
text: "4"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "sqrt_button"
|
||||
text: "sqrt"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "5_button"
|
||||
text: "5"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
|
||||
@GUI::Button {
|
||||
name: "6_button"
|
||||
text: "6"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "mem_recall_button"
|
||||
text: "MR"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "multiply_button"
|
||||
text: "*"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
}
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "mod_button"
|
||||
text: "%"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "4_button"
|
||||
text: "4"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
@GUI::Button {
|
||||
name: "5_button"
|
||||
text: "5"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "mem_save_button"
|
||||
text: "MS"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "6_button"
|
||||
text: "6"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "multiply_button"
|
||||
text: "*"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "1_button"
|
||||
text: "1"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "mod_button"
|
||||
text: "%"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "2_button"
|
||||
text: "2"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
|
||||
@GUI::Button {
|
||||
name: "3_button"
|
||||
text: "3"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "mem_save_button"
|
||||
text: "MS"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "subtract_button"
|
||||
text: "-"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
}
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "inverse_button"
|
||||
text: "1/x"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "1_button"
|
||||
text: "1"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
@GUI::Button {
|
||||
name: "2_button"
|
||||
text: "2"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "mem_add_button"
|
||||
text: "M+"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "3_button"
|
||||
text: "3"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "subtract_button"
|
||||
text: "-"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "0_button"
|
||||
text: "0"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "inverse_button"
|
||||
text: "1/x"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "sign_button"
|
||||
text: "+/-"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Widget {
|
||||
layout: @GUI::HorizontalBoxLayout
|
||||
|
||||
@GUI::Button {
|
||||
name: "decimal_button"
|
||||
text: "."
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
@GUI::Button {
|
||||
name: "mem_add_button"
|
||||
text: "M+"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "add_button"
|
||||
text: "+"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
}
|
||||
@GUI::Widget {
|
||||
fixed_width: 5
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "equal_button"
|
||||
text: "="
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
@GUI::Button {
|
||||
name: "0_button"
|
||||
text: "0"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "sign_button"
|
||||
text: "+/-"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "decimal_button"
|
||||
text: "."
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "blue"
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "add_button"
|
||||
text: "+"
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
}
|
||||
|
||||
@GUI::Button {
|
||||
name: "equal_button"
|
||||
text: "="
|
||||
fixed_width: 35
|
||||
fixed_height: 28
|
||||
foreground_color: "red"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ int main(int argc, char** argv)
|
|||
auto window = GUI::Window::construct();
|
||||
window->set_title("Calculator");
|
||||
window->set_resizable(false);
|
||||
window->resize(254, 213);
|
||||
window->resize(254, 215);
|
||||
|
||||
auto& widget = window->set_main_widget<CalculatorWidget>();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue