mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Spreadsheet: Add Help menu
This commit is contained in:
parent
d2beff41c9
commit
15b68b4653
Notes:
sideshowbarker
2024-07-19 01:37:28 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/15b68b46531 Pull-request: https://github.com/SerenityOS/serenity/pull/3879
2 changed files with 23 additions and 0 deletions
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue