1 /*
2  * Copyright (c) 2021-2022 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_MULTIMODAL_MULTIMODAL_COMPONENT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_MULTIMODAL_MULTIMODAL_COMPONENT_H
18 
19 #include "core/components/declaration/common/attribute.h"
20 #include "core/components/multimodal/multimodal_element.h"
21 #include "core/components/multimodal/render_multimodal.h"
22 #include "core/event/multimodal/multimodal_properties.h"
23 #include "core/pipeline/base/sole_child_component.h"
24 
25 namespace OHOS::Ace {
26 
27 class MultimodalComponent final : public SoleChildComponent {
DECLARE_ACE_TYPE(MultimodalComponent,SoleChildComponent)28     DECLARE_ACE_TYPE(MultimodalComponent, SoleChildComponent)
29 
30 public:
31     explicit MultimodalComponent(int32_t pageId) : pageId_(pageId) {}
32     ~MultimodalComponent() override = default;
33 
GetMultimodalProperties()34     const CommonMultimodalAttribute& GetMultimodalProperties() const
35     {
36         return multimodalProperties_;
37     }
SetMultimodalProperties(const CommonMultimodalAttribute & multimodalProperties)38     void SetMultimodalProperties(const CommonMultimodalAttribute& multimodalProperties)
39     {
40         multimodalProperties_ = multimodalProperties;
41     }
42 
GetPageId()43     int32_t GetPageId() const
44     {
45         return pageId_;
46     }
47 
GetOnClickId()48     const EventMarker& GetOnClickId() const
49     {
50         return onClickId_;
51     }
SetOnClickId(const EventMarker & onClickId)52     void SetOnClickId(const EventMarker& onClickId)
53     {
54         onClickId_ = onClickId;
55     }
56 
CreateElement()57     RefPtr<Element> CreateElement() override
58     {
59         return MakeRefPtr<MultimodalElement>();
60     }
61 
CreateRenderNode()62     RefPtr<RenderNode> CreateRenderNode() override
63     {
64         return RenderMultimodal::Create();
65     }
66 
67 private:
68     CommonMultimodalAttribute multimodalProperties_;
69     EventMarker onClickId_;
70     int32_t pageId_ = -1;
71 };
72 
73 } // namespace OHOS::Ace
74 
75 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_MULTIMODAL_MULTIMODAL_COMPONENT_H
76