1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * Enumerates the icon styles. 18 * 19 * @enum { number } 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @since 10 22 */ 23declare enum PasteIconStyle { 24 /** 25 * Icon rendered as lines. 26 * 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @since 10 29 */ 30 LINES = 0 31} 32 33/** 34 * Enumerates the text that can be displayed on the paste button. 35 * 36 * @enum { number } 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @since 10 39 */ 40declare enum PasteDescription { 41 /** 42 * Paste 43 * 44 * @syscap SystemCapability.ArkUI.ArkUI.Full 45 * @since 10 46 */ 47 PASTE = 0 48} 49 50/** 51 * Declares the interface for setting the paste button options. 52 * 53 * @interface PasteButtonOptions 54 * @syscap SystemCapability.ArkUI.ArkUI.Full 55 * @since 10 56 */ 57declare interface PasteButtonOptions { 58 /** 59 * Style of the icon to be drawn. 60 * 61 * @type { ?PasteIconStyle } 62 * @syscap SystemCapability.ArkUI.ArkUI.Full 63 * @since 10 64 */ 65 icon?: PasteIconStyle; 66 67 /** 68 * Text to be displayed on the button. 69 * 70 * @type { ?PasteDescription } 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @since 10 73 */ 74 text?: PasteDescription; 75 76 /** 77 * Type of the button. 78 * 79 * @type { ?ButtonType } 80 * @syscap SystemCapability.ArkUI.ArkUI.Full 81 * @since 10 82 */ 83 buttonType?: ButtonType; 84} 85 86/** 87 * Enumerates the click event results of the paste button. 88 * 89 * @enum { number } 90 * @syscap SystemCapability.ArkUI.ArkUI.Full 91 * @since 10 92 */ 93declare enum PasteButtonOnClickResult { 94 /** 95 * Success. 96 * 97 * @syscap SystemCapability.ArkUI.ArkUI.Full 98 * @since 10 99 */ 100 SUCCESS = 0, 101 102 /** 103 * Failure because the application is not temporarily authorized for accessing the current pasteboard data. 104 * 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @since 10 107 */ 108 TEMPORARY_AUTHORIZATION_FAILED = 1 109} 110 111/** 112 * Defines the interface for setting a paste button. 113 * 114 * @interface PasteButtonInterface 115 * @syscap SystemCapability.ArkUI.ArkUI.Full 116 * @since 10 117 */ 118interface PasteButtonInterface { 119 /** 120 * Creates a paste button. 121 * 122 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 123 * @syscap SystemCapability.ArkUI.ArkUI.Full 124 * @since 10 125 */ 126 (): PasteButtonAttribute; 127 128 /** 129 * Creates a paste button with the specified composition. 130 * If an attribute is not set, the corresponding element will not be drawn. 131 * 132 * @param { PasteButtonOptions } options - Indicates the options of the paste button. 133 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 134 * @syscap SystemCapability.ArkUI.ArkUI.Full 135 * @since 10 136 */ 137 (options: PasteButtonOptions): PasteButtonAttribute; 138} 139 140/** 141 * Defines the attributes of the paste button. 142 * 143 * @extends SecurityComponentMethod<PasteButtonAttribute> 144 * @syscap SystemCapability.ArkUI.ArkUI.Full 145 * @since 10 146 */ 147declare class PasteButtonAttribute extends SecurityComponentMethod<PasteButtonAttribute> { 148 /** 149 * Called when the paste button is clicked. 150 * 151 * @param { function } event 152 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @since 10 155 */ 156 onClick(event: (event: ClickEvent, result: PasteButtonOnClickResult) => void): PasteButtonAttribute; 157} 158 159/** 160 * Defines a button that interacts with the security component service to 161 * request the permission for accessing the current pasteboard data. 162 * 163 * @syscap SystemCapability.ArkUI.ArkUI.Full 164 * @since 10 165 */ 166declare const PasteButton: PasteButtonInterface; 167 168/** 169 * Defines a paste button instance for secure access. 170 * 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @since 10 173 */ 174declare const PasteButtonInstance: PasteButtonAttribute; 175