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

Spreadsheet: Move menu and action code to initialize_menubar()

Previously, all the code to add menus and actions was in main().
This was messy and didn't allow us to reference the actions from
SpreadsheetWidget, which is needed in order to add a toolbar.

This commit moves the menu and action adding code to method on
SpreadsheetWidget called initialize_menubar() which is based upon
applications such as TextEditor which have identically named methods
doing the same thing.

In additon, clipboard_action(), previouly a lambda in main(), has also
been made into a method on SpreadsheetWidget since it would otherwise
be destroyed when it goes out of scope. (This was previously avoided by
declaring the lambda in main() so it's always in scope.)
This commit is contained in:
Samuel Bowman 2021-09-30 21:31:35 -04:00 committed by Ali Mohammad Pur
parent 14c57b4b7f
commit d8bac4dbda
3 changed files with 165 additions and 153 deletions

View file

@ -40,6 +40,8 @@ public:
return m_selected_view->cursor();
}
void initialize_menubar(GUI::Window&);
private:
virtual void resize_event(GUI::ResizeEvent&) override;
@ -60,6 +62,8 @@ private:
bool m_should_change_selected_cells { false };
OwnPtr<Workbook> m_workbook;
void clipboard_action(bool is_cut);
};
}