summaryrefslogtreecommitdiff
path: root/DevTools/HackStudio/Editor.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-27 12:55:10 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-10-27 12:55:10 +0100
commite39b1f11f96d7e6865cb9187a8f5a72ea320a6b3 (patch)
tree44c73993a2f19cc7f3814ac9157128105f973dbb /DevTools/HackStudio/Editor.h
parentde2b25e2c1091be248bc9776914995fd6ab3e0ec (diff)
downloadserenity-e39b1f11f96d7e6865cb9187a8f5a72ea320a6b3.zip
HackStudio: Support multiple editors on screen
This patch adds Editor (subclass of GTextEditor) and EditorWrapper. An EditorWrapper is a composite widget that adds a little statusbar above an Editor widget. The statusbar is used for showing the filename and the current cursor position. More things can definitely be added. To get to the currently active editor, call current_editor(). You can also get to the current editor's wrapper by calling.. current_editor_wrapper(). Which editor is current is determined by which was was last focused by the user.
Diffstat (limited to 'DevTools/HackStudio/Editor.h')
-rw-r--r--DevTools/HackStudio/Editor.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h
new file mode 100644
index 0000000000..349984eaab
--- /dev/null
+++ b/DevTools/HackStudio/Editor.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include <LibGUI/GTextEditor.h>
+
+class Editor final : public GTextEditor {
+ C_OBJECT(Editor)
+public:
+ virtual ~Editor() override {}
+
+ Function<void()> on_focus;
+
+private:
+ virtual void focusin_event(CEvent& event) override;
+
+ Editor(GWidget* parent)
+ : GTextEditor(GTextEditor::MultiLine, parent)
+ {
+ }
+};