summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'Applications')
-rw-r--r--Applications/TextEditor/TextEditorWidget.cpp8
-rw-r--r--Applications/TextEditor/TextEditorWidget.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp
index 85941be96c..8e80520895 100644
--- a/Applications/TextEditor/TextEditorWidget.cpp
+++ b/Applications/TextEditor/TextEditorWidget.cpp
@@ -30,6 +30,7 @@ TextEditorWidget::TextEditorWidget()
find_widget->set_preferred_size(0, 22);
find_widget->set_layout(make<GBoxLayout>(Orientation::Horizontal));
find_widget->layout()->set_margins({ 2, 2, 2, 2 });
+ find_widget->set_visible(false);
m_find_textbox = new GTextBox(find_widget);
@@ -52,6 +53,11 @@ TextEditorWidget::TextEditorWidget()
}
};
+ m_find_action = GAction::create("Find...", { Mod_Ctrl, Key_F }, [this, find_widget](auto&) {
+ find_widget->set_visible(true);
+ m_find_textbox->set_focus(true);
+ });
+
auto* statusbar = new GStatusBar(this);
m_editor->on_cursor_change = [statusbar, this] {
@@ -120,6 +126,8 @@ TextEditorWidget::TextEditorWidget()
edit_menu->add_action(m_editor->copy_action());
edit_menu->add_action(m_editor->paste_action());
edit_menu->add_action(m_editor->delete_action());
+ edit_menu->add_separator();
+ edit_menu->add_action(*m_find_action);
menubar->add_menu(move(edit_menu));
auto font_menu = make<GMenu>("Font");
diff --git a/Applications/TextEditor/TextEditorWidget.h b/Applications/TextEditor/TextEditorWidget.h
index c8e7c1e28d..d8dab46777 100644
--- a/Applications/TextEditor/TextEditorWidget.h
+++ b/Applications/TextEditor/TextEditorWidget.h
@@ -28,6 +28,7 @@ private:
RefPtr<GAction> m_open_action;
RefPtr<GAction> m_save_action;
RefPtr<GAction> m_save_as_action;
+ RefPtr<GAction> m_find_action;
GTextBox* m_find_textbox { nullptr };
GButton* m_find_button { nullptr };