summaryrefslogtreecommitdiffstats
path: root/src/core/frontend
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-10 02:10:58 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-18 16:53:47 +0100
commitae53b84efd5523e2aba3255f9f713d4a1df563b3 (patch)
tree6c368afbdc6c0376c9e4291a735c9c0c50b0aa91 /src/core/frontend
parentam/applets: Add Applet superclass to describe a generic applet (diff)
downloadyuzu-ae53b84efd5523e2aba3255f9f713d4a1df563b3.tar
yuzu-ae53b84efd5523e2aba3255f9f713d4a1df563b3.tar.gz
yuzu-ae53b84efd5523e2aba3255f9f713d4a1df563b3.tar.bz2
yuzu-ae53b84efd5523e2aba3255f9f713d4a1df563b3.tar.lz
yuzu-ae53b84efd5523e2aba3255f9f713d4a1df563b3.tar.xz
yuzu-ae53b84efd5523e2aba3255f9f713d4a1df563b3.tar.zst
yuzu-ae53b84efd5523e2aba3255f9f713d4a1df563b3.zip
Diffstat (limited to 'src/core/frontend')
-rw-r--r--src/core/frontend/applets/software_keyboard.cpp17
-rw-r--r--src/core/frontend/applets/software_keyboard.h44
2 files changed, 61 insertions, 0 deletions
diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp
new file mode 100644
index 000000000..8cb888a62
--- /dev/null
+++ b/src/core/frontend/applets/software_keyboard.cpp
@@ -0,0 +1,17 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "common/logging/backend.h"
+#include "core/frontend/applets/software_keyboard.h"
+
+namespace Frontend {
+bool DefaultSoftwareKeyboardApplet::GetText(Parameters parameters, std::u16string& text) {
+ if (parameters.initial_text.empty())
+ text = Common::UTF8ToUTF16("yuzu");
+ else
+ text = parameters.initial_text;
+
+ return true;
+}
+} // namespace Frontend
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h
new file mode 100644
index 000000000..d368385d2
--- /dev/null
+++ b/src/core/frontend/applets/software_keyboard.h
@@ -0,0 +1,44 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <string>
+#include "common/bit_field.h"
+#include "common/common_types.h"
+
+namespace Frontend {
+class SoftwareKeyboardApplet {
+public:
+ struct Parameters {
+ std::u16string submit_text;
+ std::u16string header_text;
+ std::u16string sub_text;
+ std::u16string guide_text;
+ std::u16string initial_text;
+ std::size_t max_length;
+ bool password;
+ bool cursor_at_beginning;
+
+ union {
+ u8 value;
+
+ BitField<1, 1, u8> disable_space;
+ BitField<2, 1, u8> disable_address;
+ BitField<3, 1, u8> disable_percent;
+ BitField<4, 1, u8> disable_slash;
+ BitField<6, 1, u8> disable_number;
+ BitField<7, 1, u8> disable_download_code;
+ };
+ };
+
+ virtual bool GetText(Parameters parameters, std::u16string& text) = 0;
+ virtual ~SoftwareKeyboardApplet() = default;
+};
+
+class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
+ bool GetText(Parameters parameters, std::u16string& text) override;
+};
+
+} // namespace Frontend