Keyboard.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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)keyboardWillShow:(NSNotification*)notification;
  27. - (void)keyboardDidShow:(NSNotification*)notification;
  28. - (void)keyboardWillHide:(NSNotification*)notification;
  29. - (void)keyboardDidHide:(NSNotification*)notification;
  30. - (void)becomeFirstResponder;
  31. // on older devices initial keyboard creation might be slow, so it is good to init in on initial loading.
  32. // on the other hand, if you dont use keyboard (or use it rarely), you can avoid having all related stuff in memory:
  33. // keyboard will be created on demand anyway (in Instance method)
  34. + (void)Initialize;
  35. + (KeyboardDelegate*)Instance;
  36. + (void)Destroy;
  37. - (id)init;
  38. - (void)setKeyboardParams:(KeyboardShowParam)param;
  39. - (void)show;
  40. - (void)hide;
  41. - (void)positionInput:(CGRect)keyboardRect x:(float)x y:(float)y;
  42. - (void)shouldHideInput:(BOOL)hide;
  43. + (void)StartReorientation;
  44. + (void)FinishReorientation;
  45. - (CGRect)queryArea;
  46. - (NSString*)getText;
  47. - (void)setText:(NSString*)newText;
  48. - (BOOL)hasExternalKeyboard;
  49. - (UITextField*)getTextField;
  50. @property (readonly, nonatomic, getter = queryArea) CGRect area;
  51. @property (readonly, nonatomic) BOOL active;
  52. @property (readonly, nonatomic) KeyboardStatus status;
  53. @property (retain, nonatomic, getter = getText, setter = setText:) NSString* text;
  54. @property (assign, nonatomic) int characterLimit;
  55. @property (readonly, nonatomic) BOOL canGetSelection;
  56. @property (nonatomic, getter = querySelection, setter = assignSelection:) NSRange selection;
  57. @property (nonatomic) BOOL hasUsedDictation;
  58. @end