• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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
16const __ArcScrollBar__ = requireInternal("arkui.ArcScrollBar");
17const ModifierMap = requireNapi('arkui.modifier').ModifierMap;
18const ModifierUtils = requireNapi('arkui.modifier').ModifierUtils;
19
20class ArcScrollBarComponent extends ArkScrollBarComponent {
21    constructor(nativePtr, classType) {
22        super(nativePtr, classType);
23    }
24}
25
26class ArcScrollBarModifier extends ArcScrollBarComponent {
27    constructor(nativePtr, classType) {
28        super(nativePtr, classType);
29        this._modifiersWithKeys = new ModifierMap();
30    }
31    applyNormalAttribute(instance) {
32        ModifierUtils.applySetOnChange(this);
33        ModifierUtils.applyAndMergeModifier(instance, this);
34    }
35}
36
37class ArcScrollBar extends ScrollBar {
38    static attributeModifier(modifier) {
39        attributeModifierFunc.call(this, modifier, (nativePtr) => {
40            return new ArcScrollBarComponent(nativePtr);
41        }, (nativePtr, classType, modifierJS) => {
42            return new ArcScrollBarModifier(nativePtr, classType);
43        });
44    }
45
46    static create(value) {
47        __ArcScrollBar__.create(value);
48    }
49}
50
51export default {
52    ArcScrollBar,
53};
54