Keyboard.h 2.0 KB

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