client_keyboard.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_IOS_CLIENT_KEYBOARD_H_
  5. #define REMOTING_IOS_CLIENT_KEYBOARD_H_
  6. #import <Foundation/Foundation.h>
  7. #import <UIKit/UIKit.h>
  8. namespace remoting {
  9. struct KeypressInfo;
  10. } // namespace remoting
  11. @protocol ClientKeyboardDelegate<NSObject>
  12. - (void)clientKeyboardShouldSend:(NSString*)text;
  13. - (void)clientKeyboardShouldSendKey:(const remoting::KeypressInfo&)key;
  14. - (void)clientKeyboardShouldDelete;
  15. @end
  16. // A class for capturing keyboard inputs and forwarding them to the delegate.
  17. // It should remain first responder in order to capture all key inputs. Note
  18. // that it will hide the soft keyboard and refuse to resign first responder if
  19. // you try to resign first responder when the soft keyboard is showing.
  20. @interface ClientKeyboard : UIView<UIKeyInput, UITextInputTraits>
  21. @property(nonatomic) UIKeyboardAppearance keyboardAppearance;
  22. @property(nonatomic) UIKeyboardType keyboardType;
  23. @property(nonatomic) UITextAutocapitalizationType autocapitalizationType;
  24. @property(nonatomic) UITextAutocorrectionType autocorrectionType;
  25. @property(nonatomic) UITextSpellCheckingType spellCheckingType;
  26. // This property comes from the UITextInput protocol. It is called when the user
  27. // taps the arrow button on the soft keyboard. This property doesn't do anything
  28. // but is just to prevent the app from crashing. It's probably Apple's bug to
  29. // show the arrow buttons in the first place.
  30. // TODO(yuweih): Implement this as arrow key injection once we get the non-text
  31. // key injection working.
  32. // TODO(yuweih): Implement the UITextInput protocol to support multi-stage input
  33. // methods.
  34. @property(readwrite, copy) UITextRange* selectedTextRange;
  35. // Set to true to show the soft keyboard. Default value is NO.
  36. @property(nonatomic) BOOL showsSoftKeyboard;
  37. // This delegate is used to call back to handler key entry.
  38. @property(weak, nonatomic) id<ClientKeyboardDelegate> delegate;
  39. @end
  40. #endif // REMOTING_IOS_CLIENT_KEYBOARD_H_