1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 07:25:07 +00:00
serenity/Applications/TextEditor/TextEditorWidget.h
Andreas Kling b1763238d7 TextEditor: Ask the user before closing a dirty (modified) document
It's a little unfortunate that we have two separate code paths that can
lead to asking the user about this. Longer-term we should find a way to
unify these things.

Fixes #491.
2019-08-27 20:39:01 +02:00

44 lines
1.1 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 TextEditorWidget final : public GWidget {
public:
TextEditorWidget();
virtual ~TextEditorWidget() override;
void open_sesame(const String& path);
bool request_close();
private:
void set_path(const FileSystemPath& file);
void update_title();
GTextEditor* m_editor { nullptr };
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_action;
RefPtr<GAction> m_line_wrapping_setting_action;
RefPtr<GAction> m_find_next_action;
RefPtr<GAction> m_find_previous_action;
GTextBox* m_find_textbox { nullptr };
GButton* m_find_previous_button { nullptr };
GButton* m_find_next_button { nullptr };
GWidget* m_find_widget { nullptr };
bool m_document_dirty { false };
};