blob: 9bcf9783efca86d12cb02fe4ba923dfb5af70355 [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.ui.text;
using fuchsia.ui.views;
/// Allows clients to receive a `TextField` interface for the currently focused text field.
[Discoverable]
protocol TextInputContext {
/// Get current focused text field.
/// Server will not respond until a text field is focused. Server also responds when
/// a new text field is focused. It also responds to newly connected clients, if
/// there is a focused text field.
/// When the text field loses focus, the `TextField` handle will be closed.
WatchFocusedTextField() -> (TextField text_field);
};
/// Allows clients to manage currently focused `TextField` interface.
/// When the focused text field changes, `TextInputContext` clients receive a notification.
[Discoverable]
protocol TextInputContextManager {
/// Reports client's `ViewRef` to the protocol provider.
/// Server ensures the client is focused prior to handling other methods defined in
/// this protocol.
SetView(fuchsia.ui.views.ViewRef view_ref);
/// Create a new focused `TextField` handle and binds the `TextField` to the channel
/// provided, following the recommended pattern for request pipelining.
/// After that, a handle to the same `TextField` will be dispatched as a response to
/// other callers of `TextInputContext.WatchFocusedTextField`. Any previously focused
/// fields are disconnected.
/// Client must call `SetView` in order to receive responses on this method.
/// Server will not respond until the client is focused.
CreateNewFocusedTextField(request<TextField> text_field);
};