• 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
16import { int32 } from "@koalaui/common"
17import { contextNode, remember, scheduleCallback } from "@koalaui/runtime"
18import { PeerNode, PeerNodeType } from "../PeerNode"
19import { rememberMutableState } from '@koalaui/runtime';
20import { KPointer } from "@koalaui/interop"
21import { ArkCommonMethodPeer, StateStyles, CommonMethod, StateStylesOps } from '../component'
22import { InteropNativeModule } from "@koalaui/interop"
23import { ArkCommonAttributeSet } from "./modifiers/ArkCommonModifier";
24
25export function hookStateStyleImpl(node: ArkCommonMethodPeer, stateStyle: StateStyles | undefined): void {
26
27    // let currentState = rememberMutableState<int32>(0)
28    // remember(() => {
29    //     StateStylesOps.onStateStyleChange(node.getPeerPtr(), (state: int32) => {
30    //         currentState.value = state
31    //     })
32    // })
33
34    // const UI_STATE_NORMAL = 0;
35    // const UI_STATE_PRESSED = 1;
36    // const UI_STATE_FOCUSED = 1 << 1;
37    // const UI_STATE_DISABLED = 1 << 2;
38    // const UI_STATE_SELECTED = 1 << 3;
39
40    // let cm = new ArkCommonAttributeSet();
41
42    // if (currentState.value === UI_STATE_NORMAL) {
43    //     stateStyle?.normal?.(cm)
44    // }
45    // if (currentState.value & UI_STATE_PRESSED) {
46    //     stateStyle?.clicked?.(cm)
47    //     stateStyle?.pressed?.(cm)
48    // }
49    // if (currentState.value & UI_STATE_FOCUSED) {
50    //     stateStyle?.focused?.(cm)
51    // }
52    // if (currentState.value & UI_STATE_DISABLED) {
53    //     stateStyle?.disabled?.(cm)
54    // }
55    // if (currentState.value & UI_STATE_SELECTED) {
56    //     stateStyle?.selected?.(cm)
57    // }
58    // cm.applyModifierPatch(node)
59}