summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorMax Wipfli <mail@maxwipfli.ch>2021-06-25 17:59:50 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-30 11:12:25 +0200
commit9f0ce2dc818df8b5b8cd77d8c297bed237a9a250 (patch)
tree79b5f235a0ad741566becfbafc39db38972e23b7 /Userland/Libraries
parentde67d86696cec8a3efb46fe4f44c606334841994 (diff)
downloadserenity-9f0ce2dc818df8b5b8cd77d8c297bed237a9a250.zip
LibGUI: Add PasswordBox
This patch adds a PasswordBox. At the moment, it's simply a TextBox with it's substitution code point set to '*', and the undo and redo actions disabled.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGUI/TextBox.cpp8
-rw-r--r--Userland/Libraries/LibGUI/TextBox.h7
2 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/TextBox.cpp b/Userland/Libraries/LibGUI/TextBox.cpp
index 8b64774c1f..45a28ac086 100644
--- a/Userland/Libraries/LibGUI/TextBox.cpp
+++ b/Userland/Libraries/LibGUI/TextBox.cpp
@@ -72,4 +72,12 @@ void TextBox::add_input_to_history(String input)
m_history_index++;
}
+PasswordBox::PasswordBox()
+ : TextBox()
+{
+ set_substitution_code_point('*');
+ undo_action().set_enabled(false);
+ redo_action().set_enabled(false);
+}
+
}
diff --git a/Userland/Libraries/LibGUI/TextBox.h b/Userland/Libraries/LibGUI/TextBox.h
index 9a2ff26af5..374f579e0a 100644
--- a/Userland/Libraries/LibGUI/TextBox.h
+++ b/Userland/Libraries/LibGUI/TextBox.h
@@ -6,6 +6,7 @@
#pragma once
+#include <LibGUI/Action.h>
#include <LibGUI/TextEditor.h>
namespace GUI {
@@ -36,4 +37,10 @@ private:
String m_saved_input;
};
+class PasswordBox : public TextBox {
+ C_OBJECT(PasswordBox)
+public:
+ PasswordBox();
+};
+
}