1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:07:36 +00:00

Calculator: Add a separator line between the menu and the main UI

This commit is contained in:
Andreas Kling 2021-04-10 16:08:14 +02:00
parent 3bca395190
commit 8e74c9dbb6
2 changed files with 237 additions and 226 deletions

View file

@ -1,272 +1,283 @@
@GUI::Widget { @GUI::Widget {
fixed_width: 254 fixed_width: 254
fixed_height: 213 fixed_height: 215
fill_with_background_color: true fill_with_background_color: true
layout: @GUI::VerticalBoxLayout
layout: @GUI::VerticalBoxLayout {
margins: [10, 0, 10, 0]
}
@GUI::TextBox {
name: "entry_textbox"
font_type: "FixedWidth"
}
@GUI::Widget { @GUI::Widget {
layout: @GUI::HorizontalBoxLayout layout: @GUI::VerticalBoxLayout
@GUI::Label { @GUI::HorizontalSeparator {
name: "label" fixed_height: 2
fixed_width: 35
fixed_height: 27
} }
@GUI::Widget { @GUI::Widget {
fixed_width: 5 layout: @GUI::VerticalBoxLayout {
} margins: [10, 2, 10, 0]
}
@GUI::Button { @GUI::TextBox {
name: "backspace_button" name: "entry_textbox"
text: "Backspace" font_type: "FixedWidth"
fixed_width: 65 }
fixed_height: 28
foreground_color: "brown"
}
@GUI::Button { @GUI::Widget {
name: "clear_error_button" layout: @GUI::HorizontalBoxLayout
text: "CE"
fixed_width: 55
fixed_height: 28
foreground_color: "brown"
}
@GUI::Button { @GUI::Label {
name: "clear_button" name: "label"
text: "C" fixed_width: 35
fixed_width: 60 fixed_height: 27
fixed_height: 28 }
foreground_color: "brown"
}
}
@GUI::Widget { @GUI::Widget {
layout: @GUI::HorizontalBoxLayout fixed_width: 5
}
@GUI::Button { @GUI::Button {
name: "mem_clear_button" name: "backspace_button"
text: "MC" text: "Backspace"
fixed_width: 35 fixed_width: 65
fixed_height: 28 fixed_height: 28
foreground_color: "red" foreground_color: "brown"
} }
@GUI::Widget { @GUI::Button {
fixed_width: 5 name: "clear_error_button"
} text: "CE"
fixed_width: 55
fixed_height: 28
foreground_color: "brown"
}
@GUI::Button { @GUI::Button {
name: "7_button" name: "clear_button"
text: "7" text: "C"
fixed_width: 35 fixed_width: 60
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "brown"
} }
}
@GUI::Button { @GUI::Widget {
name: "8_button" layout: @GUI::HorizontalBoxLayout
text: "8"
fixed_width: 35
fixed_height: 28
foreground_color: "blue"
}
@GUI::Button { @GUI::Button {
name: "9_button" name: "mem_clear_button"
text: "9" text: "MC"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "red"
} }
@GUI::Button { @GUI::Widget {
name: "divide_button" fixed_width: 5
text: "/" }
fixed_width: 35
fixed_height: 28
}
@GUI::Button { @GUI::Button {
name: "sqrt_button" name: "7_button"
text: "sqrt" text: "7"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "blue"
} }
}
@GUI::Widget { @GUI::Button {
layout: @GUI::HorizontalBoxLayout name: "8_button"
text: "8"
fixed_width: 35
fixed_height: 28
foreground_color: "blue"
}
@GUI::Button { @GUI::Button {
name: "mem_recall_button" name: "9_button"
text: "MR" text: "9"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "red" foreground_color: "blue"
} }
@GUI::Widget { @GUI::Button {
fixed_width: 5 name: "divide_button"
} text: "/"
fixed_width: 35
fixed_height: 28
}
@GUI::Button { @GUI::Button {
name: "4_button" name: "sqrt_button"
text: "4" text: "sqrt"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "blue"
} }
}
@GUI::Button { @GUI::Widget {
name: "5_button" layout: @GUI::HorizontalBoxLayout
text: "5"
fixed_width: 35
fixed_height: 28
foreground_color: "blue"
}
@GUI::Button { @GUI::Button {
name: "6_button" name: "mem_recall_button"
text: "6" text: "MR"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "red"
} }
@GUI::Button { @GUI::Widget {
name: "multiply_button" fixed_width: 5
text: "*" }
fixed_width: 35
fixed_height: 28
}
@GUI::Button { @GUI::Button {
name: "mod_button" name: "4_button"
text: "%" text: "4"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "blue"
} }
}
@GUI::Widget { @GUI::Button {
layout: @GUI::HorizontalBoxLayout name: "5_button"
text: "5"
fixed_width: 35
fixed_height: 28
foreground_color: "blue"
}
@GUI::Button { @GUI::Button {
name: "mem_save_button" name: "6_button"
text: "MS" text: "6"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "red" foreground_color: "blue"
} }
@GUI::Widget { @GUI::Button {
fixed_width: 5 name: "multiply_button"
} text: "*"
fixed_width: 35
fixed_height: 28
}
@GUI::Button { @GUI::Button {
name: "1_button" name: "mod_button"
text: "1" text: "%"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "blue"
} }
}
@GUI::Button { @GUI::Widget {
name: "2_button" layout: @GUI::HorizontalBoxLayout
text: "2"
fixed_width: 35
fixed_height: 28
foreground_color: "blue"
}
@GUI::Button { @GUI::Button {
name: "3_button" name: "mem_save_button"
text: "3" text: "MS"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "red"
} }
@GUI::Button { @GUI::Widget {
name: "subtract_button" fixed_width: 5
text: "-" }
fixed_width: 35
fixed_height: 28
}
@GUI::Button { @GUI::Button {
name: "inverse_button" name: "1_button"
text: "1/x" text: "1"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "blue"
} }
}
@GUI::Widget { @GUI::Button {
layout: @GUI::HorizontalBoxLayout name: "2_button"
text: "2"
fixed_width: 35
fixed_height: 28
foreground_color: "blue"
}
@GUI::Button { @GUI::Button {
name: "mem_add_button" name: "3_button"
text: "M+" text: "3"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "red" foreground_color: "blue"
} }
@GUI::Widget { @GUI::Button {
fixed_width: 5 name: "subtract_button"
} text: "-"
fixed_width: 35
fixed_height: 28
}
@GUI::Button { @GUI::Button {
name: "0_button" name: "inverse_button"
text: "0" text: "1/x"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "blue"
} }
}
@GUI::Button { @GUI::Widget {
name: "sign_button" layout: @GUI::HorizontalBoxLayout
text: "+/-"
fixed_width: 35
fixed_height: 28
foreground_color: "blue"
}
@GUI::Button { @GUI::Button {
name: "decimal_button" name: "mem_add_button"
text: "." text: "M+"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "blue" foreground_color: "red"
} }
@GUI::Button { @GUI::Widget {
name: "add_button" fixed_width: 5
text: "+" }
fixed_width: 35
fixed_height: 28
}
@GUI::Button { @GUI::Button {
name: "equal_button" name: "0_button"
text: "=" text: "0"
fixed_width: 35 fixed_width: 35
fixed_height: 28 fixed_height: 28
foreground_color: "red" 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"
}
}
} }
} }
} }

View file

@ -62,7 +62,7 @@ int main(int argc, char** argv)
auto window = GUI::Window::construct(); auto window = GUI::Window::construct();
window->set_title("Calculator"); window->set_title("Calculator");
window->set_resizable(false); window->set_resizable(false);
window->resize(254, 213); window->resize(254, 215);
auto& widget = window->set_main_widget<CalculatorWidget>(); auto& widget = window->set_main_widget<CalculatorWidget>();