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