/*
* Copyright (c) 2025 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@!namespace("@ohos.multimodalInput.pointer", "pointer")
@!sts_export_default
@!sts_inject_into_module("import image from '@ohos.multimedia.image';")
@!sts_inject("""
static { loadLibraryWithPermissionCheck("Pointer.z", "@ohos.multimodalInput.pointer") }
""")
enum PointerStyle : i32 {
DEFAULT,
EAST,
WEST,
SOUTH,
NORTH,
WEST_EAST,
NORTH_SOUTH,
NORTH_EAST,
NORTH_WEST,
SOUTH_EAST,
SOUTH_WEST,
NORTH_EAST_SOUTH_WEST,
NORTH_WEST_SOUTH_EAST,
CROSS,
CURSOR_COPY,
CURSOR_FORBID,
COLOR_SUCKER,
HAND_GRABBING,
HAND_OPEN,
HAND_POINTING,
HELP,
MOVE,
RESIZE_LEFT_RIGHT,
RESIZE_UP_DOWN,
SCREENSHOT_CHOOSE,
SCREENSHOT_CURSOR,
TEXT_CURSOR,
ZOOM_IN,
ZOOM_OUT,
MIDDLE_BTN_EAST,
MIDDLE_BTN_WEST,
MIDDLE_BTN_SOUTH,
MIDDLE_BTN_NORTH,
MIDDLE_BTN_NORTH_SOUTH,
MIDDLE_BTN_NORTH_EAST,
MIDDLE_BTN_NORTH_WEST,
MIDDLE_BTN_SOUTH_EAST,
MIDDLE_BTN_SOUTH_WEST,
MIDDLE_BTN_NORTH_SOUTH_WEST_EAST,
HORIZONTAL_TEXT_CURSOR,
CURSOR_CROSS,
CURSOR_CIRCLE,
LOADING,
RUNNING,
MIDDLE_BTN_EAST_WEST,
RUNNING_LEFT = 45,
RUNNING_RIGHT = 46,
AECH_DEVELOPER_DEFINED_ICON = 47,
SCREENRECORDER_CURSOR = 48,
LASER_CURSOR = 49,
LASER_CURSOR_DOT = 50,
LASER_CURSOR_DOT_RED = 51,
DEVELOPER_DEFINED_ICON = -100,
}
enum PrimaryButton : i32 {
LEFT = 0,
RIGHT = 1
}
enum RightClickType : i32 {
TOUCHPAD_RIGHT_BUTTON = 1,
TOUCHPAD_LEFT_BUTTON = 2,
TOUCHPAD_TWO_FINGER_TAP = 3,
TOUCHPAD_TWO_FINGER_TAP_OR_RIGHT_BUTTON = 4,
TOUCHPAD_TWO_FINGER_TAP_OR_LEFT_BUTTON = 5,
}
struct CursorConfig {
followSystem : bool;
}
@gen_async("setPointerStyle")
@gen_promise("setPointerStyle")
function SetPointerStyleAsync(windowId: i32, pointerStyle: PointerStyle): void;
@rename("setPointerVisibleSync")
function SetPointerVisibleSyncImpl(visible: bool): void;
@rename("getPointerStyleSync")
function GetPointerStyleSyncImpl(windowId: i32): PointerStyle;
@rename("setPointerStyleSync")
function SetPointerStyleSyncImpl(windowId: i32, pointerStyle: PointerStyle): void;
struct CustomCursor {
pixelMap: @sts_type("image.PixelMap") Opaque;
focusX: Optional<i32>;
focusY: Optional<i32>;
}
@gen_async("setPointerVisible")
@gen_promise("setPointerVisible")
function SetPointerVisibleAsync(visible: bool): void;
@gen_async("setPointerSpeed")
@gen_promise("setPointerSpeed")
function SetPointerSpeedAsync(speed: i32): void;
@gen_async("getPointerSpeed")
@gen_promise("getPointerSpeed")
function GetPointerSpeedAsync(): i32;
@gen_async("isPointerVisible")
@gen_promise("isPointerVisible")
function IsPointerVisibleAsync(): bool;
@gen_async("getPointerStyle")
@gen_promise("getPointerStyle")
function GetPointerStyleAsync(windowId: i32): PointerStyle;
@gen_async("getTouchpadDoubleTapAndDragState")
@gen_promise("getTouchpadDoubleTapAndDragState")
function GetTouchpadDoubleTapAndDragStateAsync(): bool;
@gen_async("setTouchpadDoubleTapAndDragState")
@gen_promise("setTouchpadDoubleTapAndDragState")
function SetTouchpadDoubleTapAndDragStateAsync(isOpen: bool): void;
@rename("setCustomCursorSync")
function SetCustomCursorSyncImpl(windowId: i32, pixelMap: @sts_type("image.PixelMap") Opaque, focusX: Optional<i32>, focusY: Optional<i32>): void;
@gen_promise("setCustomCursor")
function SetCustomCursorPixelMapAsync(windowId: i32, pixelMap: @sts_type("image.PixelMap") Opaque, focusX: Optional<i32>, focusY: Optional<i32>): void;
@gen_promise("setCustomCursor")
function SetCustomCursorAsync(windowId: i32, cursor: CustomCursor, config: CursorConfig): void;
@rename("getPointerSpeedSync")
function GetPointerSpeedSyncImpl(): i32;
@gen_async("getTouchpadRightClickType")
@gen_promise("getTouchpadRightClickType")
function GetTouchpadRightClickTypeAsync(): RightClickType;
@gen_async("setTouchpadRightClickType")
@gen_promise("setTouchpadRightClickType")
function SetTouchpadRightClickTypeAsync(type: RightClickType): void;
@gen_async("getTouchpadSwipeSwitch")
@gen_promise("getTouchpadSwipeSwitch")
function GetTouchpadSwipeSwitchAsync(): bool;
@gen_async("setTouchpadSwipeSwitch")
@gen_promise("setTouchpadSwipeSwitch")
function SetTouchpadSwipeSwitchAsync(state: bool): void;
@gen_async("getTouchpadPinchSwitch")
@gen_promise("getTouchpadPinchSwitch")
function GetTouchpadPinchSwitchAsync(): bool;
@gen_async("setTouchpadPinchSwitch")
@gen_promise("setTouchpadPinchSwitch")
function SetTouchpadPinchSwitchAsync(state: bool): void;
@gen_async("getTouchpadPointerSpeed")
@gen_promise("getTouchpadPointerSpeed")
function GetTouchpadPointerSpeedAsync(): i32;
@gen_async("setTouchpadPointerSpeed")
@gen_promise("setTouchpadPointerSpeed")
function SetTouchpadPointerSpeedAsync(speed: i32): void;
@gen_async("getTouchpadTapSwitch")
@gen_promise("getTouchpadTapSwitch")
function GetTouchpadTapSwitchAsync(): bool;
@gen_async("setTouchpadTapSwitch")
@gen_promise("setTouchpadTapSwitch")
function SetTouchpadTapSwitchAsync(state: bool): void;
@gen_async("getTouchpadScrollDirection")
@gen_promise("getTouchpadScrollDirection")
function GetTouchpadScrollDirectionAsync(): bool;
@gen_async("setTouchpadScrollDirection")
@gen_promise("setTouchpadScrollDirection")
function SetTouchpadScrollDirectionAsync(state: bool): void;
@gen_async("getTouchpadScrollSwitch")
@gen_promise("getTouchpadScrollSwitch")
function GetTouchpadScrollSwitchAsync(): bool;
@gen_async("setTouchpadScrollSwitch")
@gen_promise("setTouchpadScrollSwitch")
function SetTouchpadScrollSwitchAsync(state: bool): void;
@gen_async("getMouseScrollRows")
@gen_promise("getMouseScrollRows")
function GetMouseScrollRowsAsync(): i32;
@gen_async("setMouseScrollRows")
@gen_promise("setMouseScrollRows")
function SetMouseScrollRowsAsync(rows: i32): void;
@gen_async("getHoverScrollState")
@gen_promise("getHoverScrollState")
function GetHoverScrollStateAsync(): bool;
@gen_async("setHoverScrollState")
@gen_promise("setHoverScrollState")
function SetHoverScrollStateAsync(state: bool): void;
@gen_async("getMousePrimaryButton")
@gen_promise("getMousePrimaryButton")
function GetMousePrimaryButtonAsync(): PrimaryButton;
@gen_async("setMousePrimaryButton")
@gen_promise("setMousePrimaryButton")
function SetMousePrimaryButtonAsync(primary: PrimaryButton): void;
@gen_async("getPointerSize")
@gen_promise("getPointerSize")
function GetPointerSizeAsync(): i32;
@rename("setPointerSizeSync")
function SetPointerSizeSyncImpl(size: i32): void;
@gen_async("setPointerSize")
@gen_promise("setPointerSize")
function SetPointerSizeAsync(size: i32): void;
@gen_async("getPointerColor")
@gen_promise("getPointerColor")
function GetPointerColorAsync(): i32;
@rename("setPointerColorSync")
function SetPointerColorSyncImpl(color: i32): void;
@gen_async("setPointerColor")
@gen_promise("setPointerColor")
function SetPointerColorAsync(color: i32): void;
@rename("setPointerSpeedSync")
function SetPointerSpeedSyncImpl(speed: i32): void;
@rename("isPointerVisibleSync")
function IsPointerVisibleSyncImpl(): bool;
@rename("getPointerColorSync")
function GetPointerColorSyncImpl(): i32;
@rename("getPointerSizeSync")
function GetPointerSizeSyncImpl(): i32;
@gen_async("getMouseScrollDirection")
@gen_promise("getMouseScrollDirection")
function GetMouseScrollDirectionAsync(): bool;
@gen_async("setMouseScrollDirection")
@gen_promise("setMouseScrollDirection")
function SetMouseScrollDirectionAsync(state: bool): void;