mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
Spreadsheet: Add Help menu
This commit is contained in:
parent
d2beff41c9
commit
15b68b4653
2 changed files with 23 additions and 0 deletions
|
@ -44,6 +44,7 @@ public:
|
||||||
void add_sheet();
|
void add_sheet();
|
||||||
|
|
||||||
const String& current_filename() const { return m_workbook->current_filename(); }
|
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);
|
void set_filename(const String& filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -24,10 +24,12 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "HelpWindow.h"
|
||||||
#include "Spreadsheet.h"
|
#include "Spreadsheet.h"
|
||||||
#include "SpreadsheetWidget.h"
|
#include "SpreadsheetWidget.h"
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
|
#include <LibGUI/AboutDialog.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/FilePicker.h>
|
#include <LibGUI/FilePicker.h>
|
||||||
#include <LibGUI/Forward.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&) {
|
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();
|
spreadsheet_widget.add_sheet();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
app_menu.add_separator();
|
||||||
|
|
||||||
app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) {
|
app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) {
|
||||||
app->quit(0);
|
app->quit(0);
|
||||||
}));
|
}));
|
||||||
|
@ -138,6 +143,23 @@ int main(int argc, char* argv[])
|
||||||
spreadsheet_widget.set_filename(current_filename);
|
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));
|
app->set_menubar(move(menubar));
|
||||||
|
|
||||||
window->show();
|
window->show();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue