2018-11-10 01:10:58 +00:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-11-12 01:16:38 +00:00
|
|
|
#include <optional>
|
2018-11-10 01:10:58 +00:00
|
|
|
#include <string>
|
|
|
|
#include "common/bit_field.h"
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
2018-11-11 21:39:25 +00:00
|
|
|
namespace Core::Frontend {
|
|
|
|
struct SoftwareKeyboardParameters {
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-11-10 01:10:58 +00:00
|
|
|
class SoftwareKeyboardApplet {
|
|
|
|
public:
|
2018-11-11 21:39:25 +00:00
|
|
|
virtual ~SoftwareKeyboardApplet();
|
2018-11-10 01:10:58 +00:00
|
|
|
|
2018-11-12 01:16:38 +00:00
|
|
|
virtual std::optional<std::u16string> GetText(SoftwareKeyboardParameters parameters) const = 0;
|
2018-11-11 21:41:31 +00:00
|
|
|
virtual void SendTextCheckDialog(std::u16string error_message) const = 0;
|
2018-11-10 01:10:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
|
2018-11-11 21:39:25 +00:00
|
|
|
public:
|
2018-11-12 01:16:38 +00:00
|
|
|
std::optional<std::u16string> GetText(SoftwareKeyboardParameters parameters) const override;
|
2018-11-11 21:41:31 +00:00
|
|
|
void SendTextCheckDialog(std::u16string error_message) const override;
|
2018-11-10 01:10:58 +00:00
|
|
|
};
|
|
|
|
|
2018-11-11 21:39:25 +00:00
|
|
|
} // namespace Core::Frontend
|