SoftwareKeyboardConfig.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using System.Runtime.InteropServices;
  2. namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
  3. {
  4. /// <summary>
  5. /// A structure that defines the configuration options of the software keyboard.
  6. /// </summary>
  7. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
  8. struct SoftwareKeyboardConfig
  9. {
  10. private const int SubmitTextLength = 8;
  11. private const int HeaderTextLength = 64;
  12. private const int SubtitleTextLength = 128;
  13. private const int GuideTextLength = 256;
  14. /// <summary>
  15. /// Type of keyboard.
  16. /// </summary>
  17. public KeyboardMode Mode;
  18. /// <summary>
  19. /// The string displayed in the Submit button.
  20. /// </summary>
  21. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubmitTextLength + 1)]
  22. public string SubmitText;
  23. /// <summary>
  24. /// The character displayed in the left button of the numeric keyboard.
  25. /// This is ignored when Mode is not set to NumbersOnly.
  26. /// </summary>
  27. public char LeftOptionalSymbolKey;
  28. /// <summary>
  29. /// The character displayed in the right button of the numeric keyboard.
  30. /// This is ignored when Mode is not set to NumbersOnly.
  31. /// </summary>
  32. public char RightOptionalSymbolKey;
  33. /// <summary>
  34. /// When set, predictive typing is enabled making use of the system dictionary,
  35. /// and any custom user dictionary.
  36. /// </summary>
  37. [MarshalAs(UnmanagedType.I1)]
  38. public bool PredictionEnabled;
  39. /// <summary>
  40. /// Specifies prohibited characters that cannot be input into the text entry area.
  41. /// </summary>
  42. public InvalidCharFlags InvalidCharFlag;
  43. /// <summary>
  44. /// The initial position of the text cursor displayed in the text entry area.
  45. /// </summary>
  46. public InitialCursorPosition InitialCursorPosition;
  47. /// <summary>
  48. /// The string displayed in the header area of the keyboard.
  49. /// </summary>
  50. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = HeaderTextLength + 1)]
  51. public string HeaderText;
  52. /// <summary>
  53. /// The string displayed in the subtitle area of the keyboard.
  54. /// </summary>
  55. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = SubtitleTextLength + 1)]
  56. public string SubtitleText;
  57. /// <summary>
  58. /// The placeholder string displayed in the text entry area when no text is entered.
  59. /// </summary>
  60. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = GuideTextLength + 1)]
  61. public string GuideText;
  62. /// <summary>
  63. /// When non-zero, specifies the maximum allowed length of the string entered into the text entry area.
  64. /// </summary>
  65. public int StringLengthMax;
  66. /// <summary>
  67. /// When non-zero, specifies the minimum allowed length of the string entered into the text entry area.
  68. /// </summary>
  69. public int StringLengthMin;
  70. /// <summary>
  71. /// When enabled, hides input characters as dots in the text entry area.
  72. /// </summary>
  73. public PasswordMode PasswordMode;
  74. /// <summary>
  75. /// Specifies whether the text entry area is displayed as a single-line entry, or a multi-line entry field.
  76. /// </summary>
  77. public InputFormMode InputFormMode;
  78. /// <summary>
  79. /// When set, enables or disables the return key. This value is ignored when single-line entry is specified as the InputFormMode.
  80. /// </summary>
  81. [MarshalAs(UnmanagedType.I1)]
  82. public bool UseNewLine;
  83. /// <summary>
  84. /// When set, the software keyboard will return a UTF-8 encoded string, rather than UTF-16.
  85. /// </summary>
  86. [MarshalAs(UnmanagedType.I1)]
  87. public bool UseUtf8;
  88. /// <summary>
  89. /// When set, the software keyboard will blur the game application rendered behind the keyboard.
  90. /// </summary>
  91. [MarshalAs(UnmanagedType.I1)]
  92. public bool UseBlurBackground;
  93. /// <summary>
  94. /// Offset into the work buffer of the initial text when the keyboard is first displayed.
  95. /// </summary>
  96. public int InitialStringOffset;
  97. /// <summary>
  98. /// Length of the initial text.
  99. /// </summary>
  100. public int InitialStringLength;
  101. /// <summary>
  102. /// Offset into the work buffer of the custom user dictionary.
  103. /// </summary>
  104. public int CustomDictionaryOffset;
  105. /// <summary>
  106. /// Number of entries in the custom user dictionary.
  107. /// </summary>
  108. public int CustomDictionaryCount;
  109. /// <summary>
  110. /// When set, the text entered will be validated on the application side after the keyboard has been submitted.
  111. /// </summary>
  112. [MarshalAs(UnmanagedType.I1)]
  113. public bool CheckText;
  114. }
  115. }