diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-27 12:55:10 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-27 12:55:10 +0100 |
commit | e39b1f11f96d7e6865cb9187a8f5a72ea320a6b3 (patch) | |
tree | 44c73993a2f19cc7f3814ac9157128105f973dbb /DevTools/HackStudio/EditorWrapper.h | |
parent | de2b25e2c1091be248bc9776914995fd6ab3e0ec (diff) | |
download | serenity-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/EditorWrapper.h')
-rw-r--r-- | DevTools/HackStudio/EditorWrapper.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/DevTools/HackStudio/EditorWrapper.h b/DevTools/HackStudio/EditorWrapper.h new file mode 100644 index 0000000000..b0b932525f --- /dev/null +++ b/DevTools/HackStudio/EditorWrapper.h @@ -0,0 +1,24 @@ +#pragma once + +#include <LibGUI/GWidget.h> + +class GLabel; +class Editor; + +class EditorWrapper : public GWidget { + C_OBJECT(EditorWrapper) +public: + virtual ~EditorWrapper() override; + + Editor& editor() { return *m_editor; } + const Editor& editor() const { return *m_editor; } + + GLabel& filename_label() { return *m_filename_label; } + +private: + explicit EditorWrapper(GWidget* parent = nullptr); + + RefPtr<GLabel> m_filename_label; + RefPtr<GLabel> m_cursor_label; + RefPtr<Editor> m_editor; +}; |