1/* 2 * Copyright (c) 2021-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 * Declare the type of status button 18 * 19 * @enum { number } 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @since 8 22 */ 23/** 24 * Declare the type of status button 25 * 26 * @enum { number } 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @since 9 29 * @form 30 */ 31/** 32 * Declare the type of status button 33 * 34 * @enum { number } 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @crossplatform 37 * @since 10 38 * @form 39 */ 40declare enum ToggleType { 41 /** 42 * Checkbox 43 * 44 * @syscap SystemCapability.ArkUI.ArkUI.Full 45 * @since 8 46 */ 47 /** 48 * Checkbox 49 * 50 * @syscap SystemCapability.ArkUI.ArkUI.Full 51 * @since 9 52 * @form 53 */ 54 /** 55 * Checkbox 56 * 57 * @syscap SystemCapability.ArkUI.ArkUI.Full 58 * @crossplatform 59 * @since 10 60 * @form 61 */ 62 Checkbox, 63 64 /** 65 * Switch 66 * 67 * @syscap SystemCapability.ArkUI.ArkUI.Full 68 * @since 8 69 */ 70 /** 71 * Switch 72 * 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @since 9 75 * @form 76 */ 77 /** 78 * Switch 79 * 80 * @syscap SystemCapability.ArkUI.ArkUI.Full 81 * @crossplatform 82 * @since 10 83 * @form 84 */ 85 Switch, 86 87 /** 88 * Button 89 * 90 * @syscap SystemCapability.ArkUI.ArkUI.Full 91 * @since 8 92 */ 93 /** 94 * Button 95 * 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @since 9 98 * @form 99 */ 100 /** 101 * Button 102 * 103 * @syscap SystemCapability.ArkUI.ArkUI.Full 104 * @crossplatform 105 * @since 10 106 * @form 107 */ 108 Button, 109} 110 111/** 112 * Defines the toggle interface. 113 * 114 * @interface ToggleInterface 115 * @syscap SystemCapability.ArkUI.ArkUI.Full 116 * @since 8 117 */ 118/** 119 * Defines the toggle interface. 120 * 121 * @interface ToggleInterface 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @since 9 124 * @form 125 */ 126/** 127 * Defines the toggle interface. 128 * 129 * @interface ToggleInterface 130 * @syscap SystemCapability.ArkUI.ArkUI.Full 131 * @crossplatform 132 * @since 10 133 * @form 134 */ 135interface ToggleInterface { 136 /** 137 * Set parameters to obtain the toggle. 138 * 139 * @param { object } options 140 * @returns { ToggleAttribute } 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @since 8 143 */ 144 /** 145 * Set parameters to obtain the toggle. 146 * 147 * @param { object } options 148 * @returns { ToggleAttribute } 149 * @syscap SystemCapability.ArkUI.ArkUI.Full 150 * @since 9 151 * @form 152 */ 153 /** 154 * Set parameters to obtain the toggle. 155 * 156 * @param { object } options 157 * @returns { ToggleAttribute } 158 * @syscap SystemCapability.ArkUI.ArkUI.Full 159 * @crossplatform 160 * @since 10 161 * @form 162 */ 163 (options: { type: ToggleType; isOn?: boolean }): ToggleAttribute; 164} 165 166/** 167 * Defines the toggle attribute functions 168 * 169 * @extends CommonMethod 170 * @since 8 171 */ 172/** 173 * Defines the toggle attribute functions 174 * 175 * @extends CommonMethod 176 * @since 9 177 * @form 178 */ 179/** 180 * Defines the toggle attribute functions 181 * 182 * @extends CommonMethod 183 * @crossplatform 184 * @since 10 185 * @form 186 */ 187declare class ToggleAttribute extends CommonMethod<ToggleAttribute> { 188 /** 189 * Called when the selected state of the component changes. 190 * 191 * @param { function } callback 192 * @returns { ToggleAttribute } 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @since 8 195 */ 196 /** 197 * Called when the selected state of the component changes. 198 * 199 * @param { function } callback 200 * @returns { ToggleAttribute } 201 * @syscap SystemCapability.ArkUI.ArkUI.Full 202 * @since 9 203 * @form 204 */ 205 /** 206 * Called when the selected state of the component changes. 207 * 208 * @param { function } callback 209 * @returns { ToggleAttribute } 210 * @syscap SystemCapability.ArkUI.ArkUI.Full 211 * @crossplatform 212 * @since 10 213 * @form 214 */ 215 onChange(callback: (isOn: boolean) => void): ToggleAttribute; 216 217 /** 218 * Called when the color of the selected button is set. 219 * 220 * @param { ResourceColor } value 221 * @returns { ToggleAttribute } 222 * @syscap SystemCapability.ArkUI.ArkUI.Full 223 * @since 8 224 */ 225 /** 226 * Called when the color of the selected button is set. 227 * 228 * @param { ResourceColor } value 229 * @returns { ToggleAttribute } 230 * @syscap SystemCapability.ArkUI.ArkUI.Full 231 * @since 9 232 * @form 233 */ 234 /** 235 * Called when the color of the selected button is set. 236 * 237 * @param { ResourceColor } value 238 * @returns { ToggleAttribute } 239 * @syscap SystemCapability.ArkUI.ArkUI.Full 240 * @crossplatform 241 * @since 10 242 * @form 243 */ 244 selectedColor(value: ResourceColor): ToggleAttribute; 245 246 /** 247 * Called when the color of the selected button is set. 248 * 249 * @param { ResourceColor } color 250 * @returns { ToggleAttribute } 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @since 8 253 */ 254 /** 255 * Called when the color of the selected button is set. 256 * 257 * @param { ResourceColor } color 258 * @returns { ToggleAttribute } 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @since 9 261 * @form 262 */ 263 /** 264 * Called when the color of the selected button is set. 265 * 266 * @param { ResourceColor } color 267 * @returns { ToggleAttribute } 268 * @syscap SystemCapability.ArkUI.ArkUI.Full 269 * @crossplatform 270 * @since 10 271 * @form 272 */ 273 switchPointColor(color: ResourceColor): ToggleAttribute; 274} 275 276/** 277 * Defines Toggle Component. 278 * 279 * @syscap SystemCapability.ArkUI.ArkUI.Full 280 * @since 8 281 */ 282/** 283 * Defines Toggle Component. 284 * 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @since 9 287 * @form 288 */ 289/** 290 * Defines Toggle Component. 291 * 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @crossplatform 294 * @since 10 295 * @form 296 */ 297declare const Toggle: ToggleInterface; 298 299/** 300 * Defines Toggle Component instance. 301 * 302 * @syscap SystemCapability.ArkUI.ArkUI.Full 303 * @since 8 304 */ 305/** 306 * Defines Toggle Component instance. 307 * 308 * @syscap SystemCapability.ArkUI.ArkUI.Full 309 * @since 9 310 * @form 311 */ 312/** 313 * Defines Toggle Component instance. 314 * 315 * @syscap SystemCapability.ArkUI.ArkUI.Full 316 * @crossplatform 317 * @since 10 318 * @form 319 */ 320declare const ToggleInstance: ToggleAttribute; 321