1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +00:00

Spreadsheet: Document runtime functions and add a help window

...that can automatically generate documentation pages from the objects.
This commit is contained in:
AnotherTest 2020-08-24 20:05:20 +04:30 committed by Andreas Kling
parent 12cf3e13c0
commit 3a07f6e345
8 changed files with 352 additions and 2 deletions

View file

@ -25,11 +25,13 @@
*/
#include "SpreadsheetWidget.h"
#include "HelpWindow.h"
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/JsonObjectSerializer.h>
#include <LibCore/File.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/Label.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/Splitter.h>
@ -52,6 +54,17 @@ SpreadsheetWidget::SpreadsheetWidget()
auto& current_cell_label = top_bar.add<GUI::Label>("");
current_cell_label.set_preferred_size(50, 0);
current_cell_label.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
auto& help_button = top_bar.add<GUI::Button>("🛈");
help_button.set_preferred_size(20, 20);
help_button.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
help_button.on_click = [&](auto) {
auto docs = m_selected_view->sheet().gather_documentation();
auto help_window = HelpWindow::the();
help_window->set_docs(move(docs));
help_window->show();
};
auto& cell_value_editor = top_bar.add<GUI::TextEditor>(GUI::TextEditor::Type::SingleLine);
cell_value_editor.set_scrollbars_enabled(false);