2019-01-31 14:14:43 -08:00
|
|
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The affinity of the current cursor position. If the cursor is at a position representing
|
|
|
|
|
* a line break, the cursor may be drawn either at the end of the current line (upstream)
|
|
|
|
|
* or at the beginning of the next (downstream).
|
|
|
|
|
*/
|
2019-08-14 15:53:17 -07:00
|
|
|
typedef NS_ENUM(NSUInteger, FlutterTextAffinity) {
|
|
|
|
|
FlutterTextAffinityUpstream,
|
|
|
|
|
FlutterTextAffinityDownstream
|
|
|
|
|
};
|
2019-01-31 14:14:43 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Data model representing text input state during an editing session.
|
|
|
|
|
*/
|
2019-08-14 15:53:17 -07:00
|
|
|
@interface FlutterTextInputModel : NSObject
|
2019-01-31 14:14:43 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The full text being edited.
|
|
|
|
|
*/
|
|
|
|
|
@property(nonnull, copy) NSMutableString* text;
|
|
|
|
|
/**
|
|
|
|
|
* The range of text currently selected. This may have length zero to represent a single
|
|
|
|
|
* cursor position.
|
|
|
|
|
*/
|
|
|
|
|
@property NSRange selectedRange;
|
|
|
|
|
/**
|
|
|
|
|
* The affinity for the current cursor position.
|
|
|
|
|
*/
|
2019-08-14 15:53:17 -07:00
|
|
|
@property FlutterTextAffinity textAffinity;
|
2019-01-31 14:14:43 -08:00
|
|
|
/**
|
|
|
|
|
* The range of text that is marked for edit, i.e. under the effects of a multi-keystroke input
|
|
|
|
|
* combination.
|
|
|
|
|
*/
|
|
|
|
|
@property NSRange markedRange;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Representation of the model's data as a state dictionary suitable for interchange with the
|
|
|
|
|
* Flutter Dart layer.
|
|
|
|
|
*/
|
|
|
|
|
@property(nonnull) NSDictionary* state;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ID of the text input client.
|
|
|
|
|
*/
|
|
|
|
|
@property(nonatomic, readonly, nonnull) NSNumber* clientID;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Keyboard type of the client. See available options:
|
|
|
|
|
* https://docs.flutter.io/flutter/services/TextInputType-class.html
|
|
|
|
|
*/
|
|
|
|
|
@property(nonatomic, readonly, nonnull) NSString* inputType;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* An action requested by the user on the input client. See available options:
|
|
|
|
|
* https://docs.flutter.io/flutter/services/TextInputAction-class.html
|
|
|
|
|
*/
|
|
|
|
|
@property(nonatomic, readonly, nonnull) NSString* inputAction;
|
|
|
|
|
|
|
|
|
|
- (nullable instancetype)init NS_UNAVAILABLE;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes a text input model with a [clientId] and [config] arguments. [config] arguments
|
|
|
|
|
* provide information on the text input connection.
|
|
|
|
|
*/
|
|
|
|
|
- (nullable instancetype)initWithClientID:(nonnull NSNumber*)clientID
|
|
|
|
|
configuration:(nonnull NSDictionary*)config;
|
|
|
|
|
@end
|