1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:57:44 +00:00

LibGUI: Add optional placeholder to TextEditor

This lets you show some disabled text when no text is entered, and the
editor is not focused.
This commit is contained in:
Peter Elliott 2020-09-20 12:20:24 -07:00 committed by Andreas Kling
parent 5b6ccbb918
commit fa96e57c15
4 changed files with 19 additions and 1 deletions

View file

@ -60,6 +60,9 @@ public:
virtual void set_document(TextDocument&);
const String& placeholder() const { return m_placeholder; }
void set_placeholder(const StringView& placeholder) { m_placeholder = placeholder; }
void set_visualize_trailing_whitespace(bool);
bool visualize_trailing_whitespace() const { return m_visualize_trailing_whitespace; }
@ -301,6 +304,8 @@ private:
RefPtr<TextDocument> m_document;
String m_placeholder { "" };
template<typename Callback>
void for_each_visual_line(size_t line_index, Callback) const;