1 /*
2  * Copyright (c) 2021 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_RENDER_MULTIMODAL_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_MULTIMODAL_RENDER_MULTIMODAL_H
18 
19 #include "core/components/declaration/common/attribute.h"
20 #include "core/event/multimodal/multimodal_properties.h"
21 #include "core/event/multimodal/multimodal_scene.h"
22 #include "core/gestures/click_recognizer.h"
23 #include "core/pipeline/base/render_node.h"
24 
25 namespace OHOS::Ace {
26 
27 class RenderMultimodal : public RenderNode {
28     DECLARE_ACE_TYPE(RenderMultimodal, RenderNode)
29 
30 public:
31     RenderMultimodal();
32     ~RenderMultimodal() override;
33 
34     static RefPtr<RenderNode> Create();
35     void Update(const RefPtr<Component>& component) override;
36 
37     void PerformLayout() override;
38 
39 protected:
40     void OnHiddenChanged(bool hidden) override;
41 
42     bool isSubscriptShow_ = false;
43     VoiceEvent voiceEvent_;
44     VoiceEvent subscript_;
45 
46 private:
47     void PrepareMultimodalEvent(const CommonMultimodalAttribute& multimodalProperties);
48     void OnEventTrigger();
49     void OnSubscriptSwitchChange(bool isOn);
50 
51     ClickCallback clickCallback_;
52     MultimodalEventCallback multimodalEventCallback_;
53     WeakPtr<MultiModalScene> multiModalScene_;
54     EventCallback<void(bool)> subscriptSwitchCallback_;
55     int32_t pageId_ = -1;
56     bool useSubscript_ = false;
57     bool useAutoSubscriptId_ = false;
58 };
59 
60 } // namespace OHOS::Ace
61 
62 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_MULTIMODAL_RENDER_MULTIMODAL_H
63