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 * @deprecated since 15 36 */ 37declare enum LocationIconStyle { 38 /** 39 * Icon filled with the specified color. 40 * 41 * @syscap SystemCapability.ArkUI.ArkUI.Full 42 * @since 10 43 */ 44 /** 45 * Icon filled with the specified color. 46 * 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @atomicservice 49 * @since 11 50 * @deprecated since 15 51 */ 52 FULL_FILLED = 0, 53 54 /** 55 * Icon rendered as lines. 56 * 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @since 10 59 */ 60 /** 61 * Icon rendered as lines. 62 * 63 * @syscap SystemCapability.ArkUI.ArkUI.Full 64 * @atomicservice 65 * @since 11 66 * @deprecated since 15 67 */ 68 LINES = 1 69} 70 71/** 72 * Enumerates the text that can be displayed on the location button. 73 * 74 * @enum { number } 75 * @syscap SystemCapability.ArkUI.ArkUI.Full 76 * @since 10 77 */ 78/** 79 * Enumerates the text that can be displayed on the location button. 80 * 81 * @enum { number } 82 * @syscap SystemCapability.ArkUI.ArkUI.Full 83 * @atomicservice 84 * @since 11 85 * @deprecated since 15 86 */ 87declare enum LocationDescription { 88 /** 89 * Current Location 90 * 91 * @syscap SystemCapability.ArkUI.ArkUI.Full 92 * @since 10 93 */ 94 /** 95 * Current Location 96 * 97 * @syscap SystemCapability.ArkUI.ArkUI.Full 98 * @atomicservice 99 * @since 11 100 * @deprecated since 15 101 */ 102 CURRENT_LOCATION = 0, 103 104 /** 105 * Add Location 106 * 107 * @syscap SystemCapability.ArkUI.ArkUI.Full 108 * @since 10 109 */ 110 /** 111 * Add Location 112 * 113 * @syscap SystemCapability.ArkUI.ArkUI.Full 114 * @atomicservice 115 * @since 11 116 * @deprecated since 15 117 */ 118 ADD_LOCATION = 1, 119 120 /** 121 * Select Location 122 * 123 * @syscap SystemCapability.ArkUI.ArkUI.Full 124 * @since 10 125 */ 126 /** 127 * Select Location 128 * 129 * @syscap SystemCapability.ArkUI.ArkUI.Full 130 * @atomicservice 131 * @since 11 132 * @deprecated since 15 133 */ 134 SELECT_LOCATION = 2, 135 136 /** 137 * Share Location 138 * 139 * @syscap SystemCapability.ArkUI.ArkUI.Full 140 * @since 10 141 */ 142 /** 143 * Share Location 144 * 145 * @syscap SystemCapability.ArkUI.ArkUI.Full 146 * @atomicservice 147 * @since 11 148 * @deprecated since 15 149 */ 150 SHARE_LOCATION = 3, 151 152 /** 153 * Send Location 154 * 155 * @syscap SystemCapability.ArkUI.ArkUI.Full 156 * @since 10 157 */ 158 /** 159 * Send Location 160 * 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @atomicservice 163 * @since 11 164 * @deprecated since 15 165 */ 166 SEND_LOCATION = 4, 167 168 /** 169 * Locating 170 * 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @since 10 173 */ 174 /** 175 * Locating 176 * 177 * @syscap SystemCapability.ArkUI.ArkUI.Full 178 * @atomicservice 179 * @since 11 180 * @deprecated since 15 181 */ 182 LOCATING = 5, 183 184 /** 185 * Location 186 * 187 * @syscap SystemCapability.ArkUI.ArkUI.Full 188 * @since 10 189 */ 190 /** 191 * Location 192 * 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @atomicservice 195 * @since 11 196 * @deprecated since 15 197 */ 198 LOCATION = 6, 199 200 /** 201 * Send Current Location 202 * 203 * @syscap SystemCapability.ArkUI.ArkUI.Full 204 * @since 10 205 */ 206 /** 207 * Send Current Location 208 * 209 * @syscap SystemCapability.ArkUI.ArkUI.Full 210 * @atomicservice 211 * @since 11 212 * @deprecated since 15 213 */ 214 SEND_CURRENT_LOCATION = 7, 215 216 /** 217 * Relocation 218 * 219 * @syscap SystemCapability.ArkUI.ArkUI.Full 220 * @since 10 221 */ 222 /** 223 * Relocation 224 * 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @atomicservice 227 * @since 11 228 * @deprecated since 15 229 */ 230 RELOCATION = 8, 231 232 /** 233 * Punch In 234 * 235 * @syscap SystemCapability.ArkUI.ArkUI.Full 236 * @since 10 237 */ 238 /** 239 * Punch In 240 * 241 * @syscap SystemCapability.ArkUI.ArkUI.Full 242 * @atomicservice 243 * @since 11 244 * @deprecated since 15 245 */ 246 PUNCH_IN = 9, 247 248 /** 249 * Current Position 250 * 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @since 10 253 */ 254 /** 255 * Current Position 256 * 257 * @syscap SystemCapability.ArkUI.ArkUI.Full 258 * @atomicservice 259 * @since 11 260 * @deprecated since 15 261 */ 262 CURRENT_POSITION = 10 263} 264 265/** 266 * Declares the interface for setting the location button options. 267 * 268 * @interface LocationButtonOptions 269 * @syscap SystemCapability.ArkUI.ArkUI.Full 270 * @since 10 271 */ 272/** 273 * Declares the interface for setting the location button options. 274 * 275 * @interface LocationButtonOptions 276 * @syscap SystemCapability.ArkUI.ArkUI.Full 277 * @atomicservice 278 * @since 11 279 * @deprecated since 15 280 */ 281declare interface LocationButtonOptions { 282 /** 283 * Style of the icon to be drawn. 284 * 285 * @type { ?LocationIconStyle } 286 * @syscap SystemCapability.ArkUI.ArkUI.Full 287 * @since 10 288 */ 289 /** 290 * Style of the icon to be drawn. 291 * 292 * @type { ?LocationIconStyle } 293 * @syscap SystemCapability.ArkUI.ArkUI.Full 294 * @atomicservice 295 * @since 11 296 * @deprecated since 15 297 */ 298 icon?: LocationIconStyle; 299 300 /** 301 * Text to be displayed on the button. 302 * 303 * @type { ?LocationDescription } 304 * @syscap SystemCapability.ArkUI.ArkUI.Full 305 * @since 10 306 */ 307 /** 308 * Text to be displayed on the button. 309 * 310 * @type { ?LocationDescription } 311 * @syscap SystemCapability.ArkUI.ArkUI.Full 312 * @atomicservice 313 * @since 11 314 * @deprecated since 15 315 */ 316 text?: LocationDescription; 317 318 /** 319 * Type of the button. 320 * 321 * @type { ?ButtonType } 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @since 10 324 */ 325 /** 326 * Type of the button. 327 * 328 * @type { ?ButtonType } 329 * @syscap SystemCapability.ArkUI.ArkUI.Full 330 * @atomicservice 331 * @since 11 332 * @deprecated since 15 333 */ 334 buttonType?: ButtonType; 335} 336 337/** 338 * Enumerates the click event results of the location button. 339 * 340 * @enum { number } 341 * @syscap SystemCapability.ArkUI.ArkUI.Full 342 * @since 10 343 */ 344/** 345 * Enumerates the click event results of the location button. 346 * 347 * @enum { number } 348 * @syscap SystemCapability.ArkUI.ArkUI.Full 349 * @atomicservice 350 * @since 11 351 * @deprecated since 15 352 */ 353declare enum LocationButtonOnClickResult { 354 /** 355 * Success. 356 * 357 * @syscap SystemCapability.ArkUI.ArkUI.Full 358 * @since 10 359 */ 360 /** 361 * Success. 362 * 363 * @syscap SystemCapability.ArkUI.ArkUI.Full 364 * @atomicservice 365 * @since 11 366 * @deprecated since 15 367 */ 368 SUCCESS = 0, 369 370 /** 371 * Failure because the application is not temporarily authorized for accessing location data. 372 * 373 * @syscap SystemCapability.ArkUI.ArkUI.Full 374 * @since 10 375 */ 376 /** 377 * Failure because the application is not temporarily authorized for accessing location data. 378 * 379 * @syscap SystemCapability.ArkUI.ArkUI.Full 380 * @atomicservice 381 * @since 11 382 * @deprecated since 15 383 */ 384 TEMPORARY_AUTHORIZATION_FAILED = 1 385} 386 387/** 388 * Defines the interface for setting a location button. 389 * 390 * @interface LocationButtonInterface 391 * @syscap SystemCapability.ArkUI.ArkUI.Full 392 * @since 10 393 */ 394/** 395 * Defines the interface for setting a location button. 396 * 397 * @interface LocationButtonInterface 398 * @syscap SystemCapability.ArkUI.ArkUI.Full 399 * @atomicservice 400 * @since 11 401 * @deprecated since 15 402 */ 403interface LocationButtonInterface { 404 /** 405 * Creates a location button. 406 * 407 * @returns { LocationButtonAttribute } TReturns the attribute of the location button. 408 * @syscap SystemCapability.ArkUI.ArkUI.Full 409 * @since 10 410 */ 411 /** 412 * Creates a location button. 413 * 414 * @returns { LocationButtonAttribute } TReturns the attribute of the location button. 415 * @syscap SystemCapability.ArkUI.ArkUI.Full 416 * @atomicservice 417 * @since 11 418 * @deprecated since 15 419 */ 420 (): LocationButtonAttribute; 421 422 /** 423 * Creates a location button with the specified composition. 424 * If an attribute is not set, the corresponding element will not be drawn. 425 * 426 * @param { LocationButtonOptions } options - Indicates the options of the location button. 427 * @returns { LocationButtonAttribute } Returns the attribute of the location button. 428 * @syscap SystemCapability.ArkUI.ArkUI.Full 429 * @since 10 430 */ 431 /** 432 * Creates a location button with the specified composition. 433 * If an attribute is not set, the corresponding element will not be drawn. 434 * 435 * @param { LocationButtonOptions } options - Indicates the options of the location button. 436 * @returns { LocationButtonAttribute } Returns the attribute of the location button. 437 * @syscap SystemCapability.ArkUI.ArkUI.Full 438 * @atomicservice 439 * @since 11 440 * @deprecated since 15 441 */ 442 (options: LocationButtonOptions): LocationButtonAttribute; 443} 444 445/** 446 * Callback function when the location button is clicked. 447 * 448 * @typedef { function } LocationButtonCallback 449 * @param { ClickEvent } event - The click event. 450 * @param { LocationButtonOnClickResult } result - The result of click event. 451 * @param { BusinessError<void> } [error] - The error code and message of click event. 452 * @syscap SystemCapability.ArkUI.ArkUI.Full 453 * @atomicservice 454 * @since 18 455 */ 456type LocationButtonCallback = (event: ClickEvent, result: LocationButtonOnClickResult, error?: BusinessError<void>) => void; 457 458/** 459 * Defines the attributes of the location button. 460 * 461 * @extends SecurityComponentMethod<LocationButtonAttribute> 462 * @syscap SystemCapability.ArkUI.ArkUI.Full 463 * @since 10 464 */ 465/** 466 * Defines the attributes of the location button. 467 * 468 * @extends SecurityComponentMethod<LocationButtonAttribute> 469 * @syscap SystemCapability.ArkUI.ArkUI.Full 470 * @atomicservice 471 * @since 11 472 * @deprecated since 15 473 */ 474declare class LocationButtonAttribute extends SecurityComponentMethod<LocationButtonAttribute> { 475 /** 476 * Called when the location button is clicked. 477 * 478 * @param { function } event 479 * @returns { LocationButtonAttribute } Returns the attribute of the location button. 480 * @syscap SystemCapability.ArkUI.ArkUI.Full 481 * @since 10 482 */ 483 /** 484 * Called when the location button is clicked. 485 * 486 * @param { function } event 487 * @returns { LocationButtonAttribute } Returns the attribute of the location button. 488 * @syscap SystemCapability.ArkUI.ArkUI.Full 489 * @atomicservice 490 * @since 11 491 */ 492 /** 493 * Called when the location button is clicked. 494 * 495 * @param { LocationButtonCallback } event 496 * @returns { LocationButtonAttribute } Returns the attribute of the location button. 497 * @syscap SystemCapability.ArkUI.ArkUI.Full 498 * @atomicservice 499 * @since 18 500 */ 501 onClick(event: LocationButtonCallback): LocationButtonAttribute; 502} 503 504/** 505 * Defines a button that interacts with the security component service to 506 * request the authorization for accessing location data. 507 * 508 * @syscap SystemCapability.ArkUI.ArkUI.Full 509 * @since 10 510 */ 511/** 512 * Defines a button that interacts with the security component service to 513 * request the authorization for accessing location data. 514 * 515 * @syscap SystemCapability.ArkUI.ArkUI.Full 516 * @atomicservice 517 * @since 11 518 * @deprecated since 15 519 * @useinstead ohos.abilityAccessCtrl#requestPermissionsFromUser 520 */ 521declare const LocationButton: LocationButtonInterface; 522 523/** 524 * Defines a location button instance for secure access. 525 * 526 * @syscap SystemCapability.ArkUI.ArkUI.Full 527 * @since 10 528 */ 529/** 530 * Defines a location button instance for secure access. 531 * 532 * @syscap SystemCapability.ArkUI.ArkUI.Full 533 * @atomicservice 534 * @since 11 535 * @deprecated since 15 536 */ 537declare const LocationButtonInstance: LocationButtonAttribute; 538