blob: 768dbe862aa6988cbdc28f12e9240ad613b05ac4 [file] [log] [blame]
// Copyright 2017 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.input;
using fuchsia.ui.input3;
type KeyboardType = strict enum {
TEXT = 0;
NUMBER = 1;
PHONE = 2;
DATETIME = 3;
};
type InputMethodAction = strict enum {
UNSPECIFIED = 0;
NONE = 1;
GO = 2;
SEARCH = 3;
SEND = 4;
NEXT = 5;
DONE = 6;
PREVIOUS = 7;
};
/// The current text, selection, and composing state for editing a run of text.
type TextInputState = struct {
/// Current state revision to avoid race conditions.
revision uint32;
/// The current text being edited.
text string;
/// The range of text that is currently selected.
selection TextSelection;
/// The range of text that is still being composed.
composing TextRange;
};
/// A interface for interacting with a text input control.
protocol InputMethodEditor {
SetKeyboardType(struct {
keyboard_type KeyboardType;
});
SetState(struct {
state TextInputState;
});
// DEPRECATED: Instead, use `fuchsia.ui.input3.KeyEventInjector`.
// TODO(fxbug.dev/72752)
InjectInput(struct {
event InputEvent;
});
// DEPRECATED: Instead, use `fuchsia.ui.input3.KeyEventInjector`.
// TODO(fxbug.dev/72752)
@transitional
DispatchKey3(struct {
event fuchsia.ui.input3.KeyEvent;
}) -> (struct {
handled bool;
});
// TODO(fxbug.dev/26729): remove these in a later change, after PlatformView has been
// switched over to open/close on the input_connection_ instead.
Show();
Hide();
};
/// An interface to receive information from `TextInputService`.
protocol InputMethodEditorClient {
DidUpdateState(struct {
state TextInputState;
event InputEvent:optional;
});
OnAction(struct {
action InputMethodAction;
});
};