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 * @file 18 * @kit ArkUI 19 */ 20 21/** 22 * Enumerates the icon styles. 23 * 24 * @enum { number } 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 10 27 */ 28/** 29 * Enumerates the icon styles. 30 * 31 * @enum { number } 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @atomicservice 34 * @since 11 35 */ 36declare enum PasteIconStyle { 37 /** 38 * Icon rendered as lines. 39 * 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @since 10 42 */ 43 /** 44 * Icon rendered as lines. 45 * 46 * @syscap SystemCapability.ArkUI.ArkUI.Full 47 * @atomicservice 48 * @since 11 49 */ 50 LINES = 0 51} 52 53/** 54 * Enumerates the text that can be displayed on the paste button. 55 * 56 * @enum { number } 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @since 10 59 */ 60/** 61 * Enumerates the text that can be displayed on the paste button. 62 * 63 * @enum { number } 64 * @syscap SystemCapability.ArkUI.ArkUI.Full 65 * @atomicservice 66 * @since 11 67 */ 68declare enum PasteDescription { 69 /** 70 * Paste 71 * 72 * @syscap SystemCapability.ArkUI.ArkUI.Full 73 * @since 10 74 */ 75 /** 76 * Paste 77 * 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @atomicservice 80 * @since 11 81 */ 82 PASTE = 0 83} 84 85/** 86 * Declares the interface for setting the paste button options. 87 * 88 * @interface PasteButtonOptions 89 * @syscap SystemCapability.ArkUI.ArkUI.Full 90 * @since 10 91 */ 92/** 93 * Declares the interface for setting the paste button options. 94 * 95 * @interface PasteButtonOptions 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @atomicservice 98 * @since 11 99 */ 100declare interface PasteButtonOptions { 101 /** 102 * Style of the icon to be drawn. 103 * 104 * @type { ?PasteIconStyle } 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @since 10 107 */ 108 /** 109 * Style of the icon to be drawn. 110 * 111 * @type { ?PasteIconStyle } 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @atomicservice 114 * @since 11 115 */ 116 icon?: PasteIconStyle; 117 118 /** 119 * Text to be displayed on the button. 120 * 121 * @type { ?PasteDescription } 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @since 10 124 */ 125 /** 126 * Text to be displayed on the button. 127 * 128 * @type { ?PasteDescription } 129 * @syscap SystemCapability.ArkUI.ArkUI.Full 130 * @atomicservice 131 * @since 11 132 */ 133 text?: PasteDescription; 134 135 /** 136 * Type of the button. 137 * 138 * @type { ?ButtonType } 139 * @syscap SystemCapability.ArkUI.ArkUI.Full 140 * @since 10 141 */ 142 /** 143 * Type of the button. 144 * 145 * @type { ?ButtonType } 146 * @syscap SystemCapability.ArkUI.ArkUI.Full 147 * @atomicservice 148 * @since 11 149 */ 150 buttonType?: ButtonType; 151} 152 153/** 154 * Enumerates the click event results of the paste button. 155 * 156 * @enum { number } 157 * @syscap SystemCapability.ArkUI.ArkUI.Full 158 * @since 10 159 */ 160/** 161 * Enumerates the click event results of the paste button. 162 * 163 * @enum { number } 164 * @syscap SystemCapability.ArkUI.ArkUI.Full 165 * @atomicservice 166 * @since 11 167 */ 168declare enum PasteButtonOnClickResult { 169 /** 170 * Success. 171 * 172 * @syscap SystemCapability.ArkUI.ArkUI.Full 173 * @since 10 174 */ 175 /** 176 * Success. 177 * 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @atomicservice 180 * @since 11 181 */ 182 SUCCESS = 0, 183 184 /** 185 * Failure because the application is not temporarily authorized for accessing the current pasteboard data. 186 * 187 * @syscap SystemCapability.ArkUI.ArkUI.Full 188 * @since 10 189 */ 190 /** 191 * Failure because the application is not temporarily authorized for accessing the current pasteboard data. 192 * 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @atomicservice 195 * @since 11 196 */ 197 TEMPORARY_AUTHORIZATION_FAILED = 1 198} 199 200/** 201 * Defines the interface for setting a paste button. 202 * 203 * @interface PasteButtonInterface 204 * @syscap SystemCapability.ArkUI.ArkUI.Full 205 * @since 10 206 */ 207/** 208 * Defines the interface for setting a paste button. 209 * 210 * @interface PasteButtonInterface 211 * @syscap SystemCapability.ArkUI.ArkUI.Full 212 * @atomicservice 213 * @since 11 214 */ 215interface PasteButtonInterface { 216 /** 217 * Creates a paste button. 218 * 219 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @since 10 222 */ 223 /** 224 * Creates a paste button. 225 * 226 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 227 * @syscap SystemCapability.ArkUI.ArkUI.Full 228 * @atomicservice 229 * @since 11 230 */ 231 (): PasteButtonAttribute; 232 233 /** 234 * Creates a paste button with the specified composition. 235 * If an attribute is not set, the corresponding element will not be drawn. 236 * 237 * @param { PasteButtonOptions } options - Indicates the options of the paste button. 238 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 239 * @syscap SystemCapability.ArkUI.ArkUI.Full 240 * @since 10 241 */ 242 /** 243 * Creates a paste button with the specified composition. 244 * If an attribute is not set, the corresponding element will not be drawn. 245 * 246 * @param { PasteButtonOptions } options - Indicates the options of the paste button. 247 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 248 * @syscap SystemCapability.ArkUI.ArkUI.Full 249 * @atomicservice 250 * @since 11 251 */ 252 (options: PasteButtonOptions): PasteButtonAttribute; 253} 254 255/** 256 * Callback function when the paste button is clicked. 257 * 258 * @typedef { function } PasteButtonCallback 259 * @param { ClickEvent } event - The click event. 260 * @param { PasteButtonOnClickResult } result - The result of click event. 261 * @param { BusinessError<void> } [error] - The error code and message of click event. 262 * @syscap SystemCapability.ArkUI.ArkUI.Full 263 * @atomicservice 264 * @since 18 265 */ 266type PasteButtonCallback = (event: ClickEvent, result: PasteButtonOnClickResult, error?: BusinessError<void>) => void; 267 268/** 269 * Defines the attributes of the paste button. 270 * 271 * @extends SecurityComponentMethod<PasteButtonAttribute> 272 * @syscap SystemCapability.ArkUI.ArkUI.Full 273 * @since 10 274 */ 275/** 276 * Defines the attributes of the paste button. 277 * 278 * @extends SecurityComponentMethod<PasteButtonAttribute> 279 * @syscap SystemCapability.ArkUI.ArkUI.Full 280 * @atomicservice 281 * @since 11 282 */ 283declare class PasteButtonAttribute extends SecurityComponentMethod<PasteButtonAttribute> { 284 /** 285 * Called when the paste button is clicked. 286 * 287 * @param { function } event 288 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 289 * @syscap SystemCapability.ArkUI.ArkUI.Full 290 * @since 10 291 */ 292 /** 293 * Called when the paste button is clicked. 294 * 295 * @param { function } event 296 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @atomicservice 299 * @since 11 300 */ 301 /** 302 * Called when the paste button is clicked. 303 * 304 * @param { PasteButtonCallback } event 305 * @returns { PasteButtonAttribute } Returns the attribute of the paste button. 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @atomicservice 308 * @since 18 309 */ 310 onClick(event: PasteButtonCallback): PasteButtonAttribute; 311} 312 313/** 314 * Defines a button that interacts with the security component service to 315 * request the permission for accessing the current pasteboard data. 316 * 317 * @syscap SystemCapability.ArkUI.ArkUI.Full 318 * @since 10 319 */ 320/** 321 * Defines a button that interacts with the security component service to 322 * request the permission for accessing the current pasteboard data. 323 * 324 * @syscap SystemCapability.ArkUI.ArkUI.Full 325 * @atomicservice 326 * @since 11 327 */ 328declare const PasteButton: PasteButtonInterface; 329 330/** 331 * Defines a paste button instance for secure access. 332 * 333 * @syscap SystemCapability.ArkUI.ArkUI.Full 334 * @since 10 335 */ 336/** 337 * Defines a paste button instance for secure access. 338 * 339 * @syscap SystemCapability.ArkUI.ArkUI.Full 340 * @atomicservice 341 * @since 11 342 */ 343declare const PasteButtonInstance: PasteButtonAttribute; 344