ladybird/Applications/TextEditor/TextEditorWidget.h
0xtechnobabble ecf58ddd4f TextEditor: Implement replacement functionality
This patch adds a new replace widget that cooperates with the find
widget, the replace widget takes the input in the find textbox, searches
for occurences of that input, and replaces them with the input provied
in the replace textbox.
2020-01-12 01:41:36 +01:00

62 lines
1.7 KiB
C++

#pragma once
#include <AK/FileSystemPath.h>
#include <AK/Function.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GTextEditor.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GWindow.h>
class GButton;
class GTextBox;
class GTextEditor;
class GStatusBar;
class TextEditorWidget final : public GWidget {
C_OBJECT(TextEditorWidget)
public:
virtual ~TextEditorWidget() override;
void open_sesame(const String& path);
bool request_close();
GTextEditor& editor() { return *m_editor; }
private:
TextEditorWidget();
void set_path(const FileSystemPath& file);
void update_title();
virtual void drop_event(GDropEvent&) override;
RefPtr<GTextEditor> m_editor;
String m_path;
String m_name;
String m_extension;
RefPtr<GAction> m_new_action;
RefPtr<GAction> m_open_action;
RefPtr<GAction> m_save_action;
RefPtr<GAction> m_save_as_action;
RefPtr<GAction> m_find_replace_action;
RefPtr<GAction> m_line_wrapping_setting_action;
RefPtr<GAction> m_find_next_action;
RefPtr<GAction> m_find_previous_action;
RefPtr<GAction> m_replace_next_action;
RefPtr<GAction> m_replace_previous_action;
RefPtr<GAction> m_replace_all_action;
RefPtr<GStatusBar> m_statusbar;
RefPtr<GTextBox> m_find_textbox;
RefPtr<GTextBox> m_replace_textbox;
GButton* m_find_previous_button { nullptr };
GButton* m_find_next_button { nullptr };
GButton* m_replace_previous_button { nullptr };
GButton* m_replace_next_button { nullptr };
GButton* m_replace_all_button { nullptr };
RefPtr<GWidget> m_find_replace_widget;
RefPtr<GWidget> m_find_widget;
RefPtr<GWidget> m_replace_widget;
bool m_document_dirty { false };
bool m_document_opening { false };
};