mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-09 21:19:57 +00:00
frontend/applets: Add frontend software keyboard provider and default
Default implementation will return "yuzu" for any string. GUI clients (or CLI) can implement the Frontend::SoftwareKeyboardApplet class and register an instance to provide functionality.
This commit is contained in:
parent
5b95de0c9c
commit
ae53b84efd
3 changed files with 63 additions and 0 deletions
|
@ -77,6 +77,8 @@ add_library(core STATIC
|
|||
file_sys/vfs_vector.h
|
||||
file_sys/xts_archive.cpp
|
||||
file_sys/xts_archive.h
|
||||
frontend/applets/software_keyboard.cpp
|
||||
frontend/applets/software_keyboard.h
|
||||
frontend/emu_window.cpp
|
||||
frontend/emu_window.h
|
||||
frontend/framebuffer_layout.cpp
|
||||
|
|
17
src/core/frontend/applets/software_keyboard.cpp
Normal file
17
src/core/frontend/applets/software_keyboard.cpp
Normal file
|
@ -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
|
44
src/core/frontend/applets/software_keyboard.h
Normal file
44
src/core/frontend/applets/software_keyboard.h
Normal file
|
@ -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
|
Loading…
Reference in a new issue