1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-31 03:00:05 +00:00

TextInputTarget: Add password keyboard type

This commit is contained in:
reuk 2022-11-29 13:08:04 +00:00
parent 03a2b557ad
commit 06798ab897
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
4 changed files with 14 additions and 3 deletions

View file

@ -108,7 +108,8 @@ public:
decimalKeyboard,
urlKeyboard,
emailAddressKeyboard,
phoneNumberKeyboard
phoneNumberKeyboard,
passwordKeyboard
};
/** Returns the target's preference for the type of keyboard that would be most appropriate.

View file

@ -456,9 +456,10 @@ public:
case TextInputTarget::urlKeyboard: return UIKeyboardTypeURL;
case TextInputTarget::emailAddressKeyboard: return UIKeyboardTypeEmailAddress;
case TextInputTarget::phoneNumberKeyboard: return UIKeyboardTypePhonePad;
default: jassertfalse; break;
case TextInputTarget::passwordKeyboard: return UIKeyboardTypeASCIICapable;
}
jassertfalse;
return UIKeyboardTypeDefault;
}
@ -1816,6 +1817,10 @@ void UIViewComponentPeer::grabFocus()
void UIViewComponentPeer::textInputRequired (Point<int>, TextInputTarget&)
{
// We need to restart the text input session so that the keyboard can change types if necessary.
if ([hiddenTextInput.get() isFirstResponder])
[hiddenTextInput.get() resignFirstResponder];
[hiddenTextInput.get() becomeFirstResponder];
}

View file

@ -2306,6 +2306,11 @@ void TextEditor::setTemporaryUnderlining (const Array<Range<int>>& newUnderlined
repaint();
}
TextInputTarget::VirtualKeyboardType TextEditor::getKeyboardType()
{
return passwordCharacter != 0 ? passwordKeyboard : keyboardType;
}
//==============================================================================
UndoManager* TextEditor::getUndoManager() noexcept
{

View file

@ -742,7 +742,7 @@ public:
/** @internal */
void setTemporaryUnderlining (const Array<Range<int>>&) override;
/** @internal */
VirtualKeyboardType getKeyboardType() override { return keyboardType; }
VirtualKeyboardType getKeyboardType() override;
protected:
//==============================================================================