blob: 24608650a19faa91fa1596e127bfa6c3254d1089 [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() -> (resource struct {
text_field client_end:TextField;
});
};
/// 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(resource struct {
view_ref fuchsia.ui.views.ViewRef;
});
/// 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(resource struct {
text_field server_end:TextField;
});
};