Spreadsheet: Add Help menu

This commit is contained in:
Brendan Coles 2020-10-31 02:29:38 +00:00 committed by Andreas Kling
parent d2beff41c9
commit 15b68b4653
Notes: sideshowbarker 2024-07-19 01:37:28 +09:00
2 changed files with 23 additions and 0 deletions

View file

@ -44,6 +44,7 @@ public:
void add_sheet();
const String& current_filename() const { return m_workbook->current_filename(); }
const Sheet& current_worksheet() const { return m_selected_view->sheet(); }
void set_filename(const String& filename);
private:

View file

@ -24,10 +24,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "HelpWindow.h"
#include "Spreadsheet.h"
#include "SpreadsheetWidget.h"
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibGUI/AboutDialog.h>
#include <LibGUI/Application.h>
#include <LibGUI/FilePicker.h>
#include <LibGUI/Forward.h>
@ -99,6 +101,9 @@ int main(int argc, char* argv[])
app_menu.add_action(GUI::Action::create("Add New Sheet", Gfx::Bitmap::load_from_file("/res/icons/16x16/new-tab.png"), [&](auto&) {
spreadsheet_widget.add_sheet();
}));
app_menu.add_separator();
app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) {
app->quit(0);
}));
@ -138,6 +143,23 @@ int main(int argc, char* argv[])
spreadsheet_widget.set_filename(current_filename);
}));
auto& help_menu = menubar->add_menu("Help");
help_menu.add_action(GUI::Action::create(
"Functions Help", [&](auto&) {
auto docs = spreadsheet_widget.current_worksheet().gather_documentation();
auto help_window = Spreadsheet::HelpWindow::the();
help_window->set_docs(move(docs));
help_window->show();
},
window));
app_menu.add_separator();
help_menu.add_action(GUI::Action::create("About", [&](auto&) {
GUI::AboutDialog::show("Spreadsheet", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-spreadsheet.png"), window);
}));
app->set_menubar(move(menubar));
window->show();