Keyboard.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. UIKeyboardAppearance appearance;
  10. BOOL multiline;
  11. BOOL secure;
  12. int characterLimit;
  13. BOOL oneTimeCode;
  14. }
  15. KeyboardShowParam;
  16. @interface KeyboardDelegate : NSObject<UITextFieldDelegate, UITextViewDelegate>
  17. {
  18. }
  19. - (BOOL)textFieldShouldReturn:(UITextField*)textField;
  20. - (void)textInputDone:(id)sender;
  21. - (void)textInputCancel:(id)sender;
  22. - (void)textInputLostFocus;
  23. - (void)textViewDidChange:(UITextView *)textView;
  24. - (void)keyboardWillShow:(NSNotification*)notification;
  25. - (void)keyboardDidShow:(NSNotification*)notification;
  26. - (void)keyboardWillHide:(NSNotification*)notification;
  27. - (void)keyboardDidHide:(NSNotification*)notification;
  28. - (void)becomeFirstResponder;
  29. // on older devices initial keyboard creation might be slow, so it is good to init in on initial loading.
  30. // on the other hand, if you dont use keyboard (or use it rarely), you can avoid having all related stuff in memory:
  31. // keyboard will be created on demand anyway (in Instance method)
  32. + (void)Initialize;
  33. + (KeyboardDelegate*)Instance;
  34. + (void)Destroy;
  35. - (id)init;
  36. - (void)setKeyboardParams:(KeyboardShowParam)param;
  37. - (void)show;
  38. - (void)hide;
  39. - (void)positionInput:(CGRect)keyboardRect x:(float)x y:(float)y;
  40. - (void)shouldHideInput:(BOOL)hide;
  41. + (void)StartReorientation;
  42. + (void)FinishReorientation;
  43. - (CGRect)queryArea;
  44. - (NSString*)getText;
  45. - (void)setText:(NSString*)newText;
  46. @property (readonly, nonatomic, getter = queryArea) CGRect area;
  47. @property (readonly, nonatomic) BOOL active;
  48. @property (readonly, nonatomic) KeyboardStatus status;
  49. @property (retain, nonatomic, getter = getText, setter = setText:) NSString* text;
  50. @property (assign, nonatomic) int characterLimit;
  51. @property (readonly, nonatomic) BOOL canGetSelection;
  52. @property (nonatomic, getter = querySelection, setter = assignSelection:) NSRange selection;
  53. @property (nonatomic) BOOL hasUsedDictation;
  54. @end