mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
Spreadsheet: Add a toolbar
This commit adds a basic toolbar with the following actions: Add New Sheet, Open, Save, Cut, Copy, and Paste.
This commit is contained in:
parent
e422bfbe88
commit
db98ed5ed0
1 changed files with 14 additions and 0 deletions
|
@ -18,6 +18,8 @@
|
||||||
#include <LibGUI/Splitter.h>
|
#include <LibGUI/Splitter.h>
|
||||||
#include <LibGUI/TabWidget.h>
|
#include <LibGUI/TabWidget.h>
|
||||||
#include <LibGUI/TextEditor.h>
|
#include <LibGUI/TextEditor.h>
|
||||||
|
#include <LibGUI/Toolbar.h>
|
||||||
|
#include <LibGUI/ToolbarContainer.h>
|
||||||
#include <LibGfx/FontDatabase.h>
|
#include <LibGfx/FontDatabase.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -28,6 +30,10 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s
|
||||||
{
|
{
|
||||||
set_fill_with_background_color(true);
|
set_fill_with_background_color(true);
|
||||||
set_layout<GUI::VerticalBoxLayout>().set_margins(2);
|
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& container = add<GUI::VerticalSplitter>();
|
||||||
|
|
||||||
auto& top_bar = container.add<GUI::Frame>();
|
auto& top_bar = container.add<GUI::Frame>();
|
||||||
|
@ -207,6 +213,14 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s
|
||||||
window());
|
window());
|
||||||
|
|
||||||
m_about_action = GUI::CommonActions::make_about_action("Spreadsheet", GUI::Icon::default_icon("app-spreadsheet"), 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)
|
void SpreadsheetWidget::resize_event(GUI::ResizeEvent& event)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue