TextEditorWidget.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include <AK/FileSystemPath.h>
  3. #include <AK/Function.h>
  4. #include <LibGUI/GApplication.h>
  5. #include <LibGUI/GTextEditor.h>
  6. #include <LibGUI/GWidget.h>
  7. #include <LibGUI/GWindow.h>
  8. class GButton;
  9. class GTextBox;
  10. class GTextEditor;
  11. class GStatusBar;
  12. class TextEditorWidget final : public GWidget {
  13. C_OBJECT(TextEditorWidget)
  14. public:
  15. virtual ~TextEditorWidget() override;
  16. void open_sesame(const String& path);
  17. bool request_close();
  18. private:
  19. TextEditorWidget();
  20. void set_path(const FileSystemPath& file);
  21. void update_title();
  22. ObjectPtr<GTextEditor> m_editor;
  23. String m_path;
  24. String m_name;
  25. String m_extension;
  26. RefPtr<GAction> m_new_action;
  27. RefPtr<GAction> m_open_action;
  28. RefPtr<GAction> m_save_action;
  29. RefPtr<GAction> m_save_as_action;
  30. RefPtr<GAction> m_find_action;
  31. RefPtr<GAction> m_line_wrapping_setting_action;
  32. RefPtr<GAction> m_find_next_action;
  33. RefPtr<GAction> m_find_previous_action;
  34. ObjectPtr<GStatusBar> m_statusbar;
  35. ObjectPtr<GTextBox> m_find_textbox;
  36. GButton* m_find_previous_button { nullptr };
  37. GButton* m_find_next_button { nullptr };
  38. ObjectPtr<GWidget> m_find_widget;
  39. bool m_document_dirty { false };
  40. };