diff options
author | Samuel Bowman <sam@sambowman.tech> | 2021-09-30 22:48:25 -0400 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-10-01 08:34:59 +0330 |
commit | db98ed5ed0ba175e6f4c413750ca05932818aa4b (patch) | |
tree | d35b1c51687c73907bd5a1e69b0f315d9b046f5b /Userland/Applications/Spreadsheet | |
parent | e422bfbe88ae5cd9ef5c7fbee836fe0dbf90f149 (diff) | |
download | serenity-db98ed5ed0ba175e6f4c413750ca05932818aa4b.zip |
Spreadsheet: Add a toolbar
This commit adds a basic toolbar with the following actions:
Add New Sheet, Open, Save, Cut, Copy, and Paste.
Diffstat (limited to 'Userland/Applications/Spreadsheet')
-rw-r--r-- | Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index bf22d4daef..5556c386b2 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -18,6 +18,8 @@ #include <LibGUI/Splitter.h> #include <LibGUI/TabWidget.h> #include <LibGUI/TextEditor.h> +#include <LibGUI/Toolbar.h> +#include <LibGUI/ToolbarContainer.h> #include <LibGfx/FontDatabase.h> #include <string.h> @@ -28,6 +30,10 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s { set_fill_with_background_color(true); set_layout<GUI::VerticalBoxLayout>().set_margins(2); + + auto& toolbar_container = add<GUI::ToolbarContainer>(); + auto& toolbar = toolbar_container.add<GUI::Toolbar>(); + auto& container = add<GUI::VerticalSplitter>(); auto& top_bar = container.add<GUI::Frame>(); @@ -207,6 +213,14 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s window()); m_about_action = GUI::CommonActions::make_about_action("Spreadsheet", GUI::Icon::default_icon("app-spreadsheet"), window()); + + toolbar.add_action(*m_new_action); + toolbar.add_action(*m_open_action); + toolbar.add_action(*m_save_action); + toolbar.add_separator(); + toolbar.add_action(*m_cut_action); + toolbar.add_action(*m_copy_action); + toolbar.add_action(*m_paste_action); } void SpreadsheetWidget::resize_event(GUI::ResizeEvent& event) |