• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef FRAMEWORKS_CORE_INTERFACES_NATIVE_NODE_VIEW_MODEL_H
16 #define FRAMEWORKS_CORE_INTERFACES_NATIVE_NODE_VIEW_MODEL_H
17 
18 #pragma once
19 
20 #include "core/interfaces/native/node/node_api.h"
21 #include "core/interfaces/native/node/extension_companion_node.h"
22 
23 namespace OHOS::Ace::NG::ViewModel {
24 
25 void* CreateNode(ArkUINodeType tag, ArkUI_Int32 nodeId);
26 
27 void* CreateNodeWithParams(ArkUINodeType tag, ArkUI_Int32 nodeId, const ArkUI_Params& params);
28 
29 ArkUI_CharPtr GetName(void* nativePtr);
30 
31 void DisposeNode(void* nativePtr);
32 
33 void AddChild(void* parentNode, void* childNode);
34 
35 void RemoveChild(void* parentNode, void* childNode);
36 
37 void RemoveChildMultiThread(void* parentNode, void* childNode);
38 
39 void InsertChildAt(void* parentNode, void* childNode, int32_t position);
40 
41 void InsertChildAfter(void* parentNode, void* childNode, void* siblingNode);
42 
43 void InsertChildBefore(void* parentNode, void* childNode, void* siblingNode);
44 
45 void RegisterCompanion(void* node, int peerId, ArkUI_Int32 flags);
46 
47 ExtensionCompanionNode* GetCompanion(void* nodePtr);
48 
49 void SetCustomCallback(ArkUIVMContext context, void* nodePtr, ArkUI_Int32 callback);
50 
51 void SetCallbackMethod(ArkUIAPICallbackMethod* method);
52 
53 ArkUIAPICallbackMethod* GetCallbackMethod();
54 
55 ArkUI_Int32 MeasureNode(ArkUIVMContext context, ArkUINodeHandle nodePtr, ArkUI_Float32* data);
56 
57 ArkUI_Int32 LayoutNode(ArkUIVMContext context, ArkUINodeHandle nodePtr, ArkUI_Float32  (*data)[2]);
58 
59 ArkUI_Int32 DrawNode(ArkUIVMContext context, ArkUINodeHandle nodePtr, ArkUI_Float32* data);
60 
61 ArkUI_Bool IsBuilderNode(void* nodePtr);
62 
63 void SetAttachNodePtr(ArkUINodeHandle nodePtr, void* attachNode);
64 
65 void* GetAttachNodePtr(ArkUINodeHandle nodePtr);
66 
67 void* CreateCustomNode(ArkUI_CharPtr tag);
68 
69 void* GetOrCreateCustomNode(ArkUI_CharPtr tag);
70 
71 void* CreateCustomNodeByNodeId(ArkUI_CharPtr tag, ArkUI_Int32 nodeId);
72 
73 } // namespace OHOS::Ace::NG::ViewModel
74 #endif
75