Keyboard.h 1.8 KB

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