No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Keyboard.h 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #import <AVFoundation/AVFoundation.h>
  3. typedef struct
  4. {
  5. const char* text;
  6. const char* placeholder;
  7. UIKeyboardType keyboardType;
  8. UITextAutocorrectionType autocorrectionType;
  9. UITextSpellCheckingType spellcheckingType;
  10. UIKeyboardAppearance appearance;
  11. BOOL multiline;
  12. BOOL secure;
  13. int characterLimit;
  14. BOOL oneTimeCode;
  15. }
  16. KeyboardShowParam;
  17. @interface KeyboardDelegate : NSObject<UITextFieldDelegate, UITextViewDelegate>
  18. {
  19. }
  20. - (void)setPendingSelectionRequest;
  21. - (BOOL)textFieldShouldReturn:(UITextField*)textField;
  22. - (void)textInputDone:(id)sender;
  23. - (void)textInputCancel:(id)sender;
  24. - (void)textInputLostFocus;
  25. - (void)textViewDidChange:(UITextView *)textView;
  26. - (void)becomeFirstResponder;
  27. #if PLATFORM_IOS || PLATFORM_VISIONOS
  28. - (void)textInputModeDidChange:(NSNotification*)notification;
  29. - (void)keyboardWillShow:(NSNotification*)notification;
  30. - (void)keyboardDidShow:(NSNotification*)notification;
  31. - (void)keyboardWillHide:(NSNotification*)notification;
  32. - (void)keyboardDidHide:(NSNotification*)notification;
  33. - (void)keyboardDidChangeFrame:(NSNotification*)notification;
  34. - (void)positionInput:(CGRect)keyboardRect x:(float)x y:(float)y;
  35. #endif
  36. // on older devices initial keyboard creation might be slow, so it is good to init in on initial loading.
  37. // on the other hand, if you dont use keyboard (or use it rarely), you can avoid having all related stuff in memory:
  38. // keyboard will be created on demand anyway (in Instance method)
  39. + (void)Initialize;
  40. + (KeyboardDelegate*)Instance;
  41. + (void)Destroy;
  42. - (id)init;
  43. - (void)setKeyboardParams:(KeyboardShowParam)param;
  44. - (void)show;
  45. - (void)hide;
  46. - (void)shouldHideInput:(BOOL)hide;
  47. + (void)StartReorientation;
  48. + (void)FinishReorientation;
  49. - (CGRect)queryArea;
  50. - (NSString*)getText;
  51. - (void)setText:(NSString*)newText;
  52. - (BOOL)hasExternalKeyboard;
  53. @property (readonly, nonatomic, getter = queryArea) CGRect area;
  54. @property (readonly, nonatomic) BOOL active;
  55. @property (readonly, nonatomic) KeyboardStatus status;
  56. @property (retain, nonatomic, getter = getText, setter = setText:) NSString* text;
  57. @property (assign, nonatomic) int characterLimit;
  58. @property (readonly, nonatomic) BOOL canGetSelection;
  59. @property (nonatomic, getter = querySelection, setter = assignSelection:) NSRange selection;
  60. @property (nonatomic) BOOL hasUsedDictation;
  61. @end