1 /*
2 * Copyright (c) 2023-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
16 #include "core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.h"
17
18 #include "base/memory/referenced.h"
19 #include "base/log/event_report.h"
20 #include "base/subwindow/subwindow.h"
21 #include "base/subwindow/subwindow_manager.h"
22 #include "base/utils/utils.h"
23 #include "core/common/container.h"
24 #include "core/components/common/layout/constants.h"
25 #include "core/components_ng/pattern/container_modal/container_modal_pattern.h"
26 #include "core/components_ng/pattern/container_modal/container_modal_theme.h"
27 #include "core/components_ng/pattern/container_modal/enhance/container_modal_view_enhance.h"
28 #include "core/components_ng/pattern/image/image_layout_property.h"
29 #include "core/components_ng/pattern/text/text_layout_property.h"
30
31 namespace OHOS::Ace::NG {
32 namespace {
33 constexpr int32_t MAX_RECOVER_BUTTON_INDEX = 0;
34 constexpr int32_t MINIMIZE_BUTTON_INDEX = 1;
35 constexpr int32_t CLOSE_BUTTON_INDEX = 2;
36 constexpr int32_t TITLE_POPUP_DURATION = 400;
37 const int32_t DOUBLE_CLICK_TO_RECOVER = 2;
38 const int32_t DOUBLE_CLICK_TO_MAXIMIZE = 1;
39
GetNotMovingWindowManager(WeakPtr<FrameNode> & weak)40 RefPtr<WindowManager> GetNotMovingWindowManager(WeakPtr<FrameNode>& weak)
41 {
42 auto node = weak.Upgrade();
43 CHECK_NULL_RETURN(node, nullptr);
44 auto pipeline = node->GetContextRefPtr();
45 CHECK_NULL_RETURN(pipeline, nullptr);
46 const auto& windowManager = pipeline->GetWindowManager();
47 CHECK_NULL_RETURN(windowManager, nullptr);
48 return windowManager;
49 }
50 } // namespace
51
ShowTitle(bool isShow,bool hasDeco,bool needUpdate)52 void ContainerModalPatternEnhance::ShowTitle(bool isShow, bool hasDeco, bool needUpdate)
53 {
54 auto containerNode = GetHost();
55 CHECK_NULL_VOID(containerNode);
56 auto customTitleRow = GetCustomTitleRow();
57 CHECK_NULL_VOID(customTitleRow);
58 auto floatingTitleRow = GetFloatingTitleRow();
59 CHECK_NULL_VOID(floatingTitleRow);
60 bool isFocus_ = GetIsFocus();
61 if (needUpdate) {
62 LOGI("title is need update, isFocus_: %{public}d", isFocus_);
63 ChangeCustomTitle(isFocus_);
64 ChangeControlButtons(isFocus_);
65 return;
66 }
67 auto pipelineContext = PipelineContext::GetCurrentContext();
68 CHECK_NULL_VOID(pipelineContext);
69 auto theme = pipelineContext->GetTheme<ContainerModalTheme>();
70 auto stackNode = GetStackNode();
71 CHECK_NULL_VOID(stackNode);
72 auto windowManager = pipelineContext->GetWindowManager();
73 CHECK_NULL_VOID(windowManager);
74 windowMode_ = windowManager->GetWindowMode();
75 isShow = isShow && hasDeco;
76 // set container window show state to RS
77 pipelineContext->SetContainerWindow(isShow);
78 // update container modal padding and border
79 auto layoutProperty = containerNode->GetLayoutProperty();
80 CHECK_NULL_VOID(layoutProperty);
81 layoutProperty->UpdateAlignment(Alignment::TOP_LEFT);
82 bool isFloatingWindow = windowManager->GetWindowMode() == WindowMode::WINDOW_MODE_FLOATING;
83 BorderWidthProperty borderWidth;
84 borderWidth.SetBorderWidth((isFloatingWindow && isShow) ? CONTAINER_BORDER_WIDTH : 0.0_vp);
85 layoutProperty->UpdateBorderWidth(borderWidth);
86 auto renderContext = containerNode->GetRenderContext();
87 CHECK_NULL_VOID(renderContext);
88 renderContext->UpdateBackgroundColor(theme->GetBackGroundColor(isFocus_));
89 // only floating window show border
90 BorderRadiusProperty borderRadius;
91 borderRadius.SetRadius((isFloatingWindow && isShow) ? CONTAINER_OUTER_RADIUS : 0.0_vp);
92 renderContext->UpdateBorderRadius(borderRadius);
93 BorderColorProperty borderColor;
94 borderColor.SetColor((isFloatingWindow && isShow) ? CONTAINER_BORDER_COLOR : Color::TRANSPARENT);
95 renderContext->UpdateBorderColor(borderColor);
96
97 // update stack content border
98 auto stackLayoutProperty = stackNode->GetLayoutProperty();
99 CHECK_NULL_VOID(stackLayoutProperty);
100 stackLayoutProperty->UpdateLayoutWeight(1.0f);
101 auto stackRenderContext = stackNode->GetRenderContext();
102 CHECK_NULL_VOID(stackRenderContext);
103 BorderRadiusProperty stageBorderRadius;
104 stageBorderRadius.SetRadius((isFloatingWindow && isShow) ? GetStackNodeRadius() : 0.0_vp);
105 stackRenderContext->UpdateBorderRadius(stageBorderRadius);
106 stackRenderContext->SetClipToBounds(true);
107 auto customTitleLayoutProperty = customTitleRow->GetLayoutProperty();
108 CHECK_NULL_VOID(customTitleLayoutProperty);
109 customTitleLayoutProperty->UpdateVisibility(
110 (isShow && customTitleSettedShow_) ? VisibleType::VISIBLE : VisibleType::GONE);
111
112 auto floatingLayoutProperty = floatingTitleRow->GetLayoutProperty();
113 CHECK_NULL_VOID(floatingLayoutProperty);
114 floatingLayoutProperty->UpdateVisibility(VisibleType::GONE);
115 auto controlButtonsNode = GetControlButtonRow();
116 CHECK_NULL_VOID(controlButtonsNode);
117 auto controlButtonsLayoutProperty = controlButtonsNode->GetLayoutProperty();
118 CHECK_NULL_VOID(controlButtonsLayoutProperty);
119 ChangeFloatingTitle(isFocus_);
120 ChangeControlButtons(isFocus_);
121 auto controlButtonsContext = controlButtonsNode->GetRenderContext();
122 CHECK_NULL_VOID(controlButtonsContext);
123 controlButtonsContext->OnTransformTranslateUpdate({ 0.0f, 0.0f, 0.0f });
124 controlButtonsLayoutProperty->UpdateVisibility(isShow ? VisibleType::VISIBLE : VisibleType::GONE);
125 SetControlButtonVisibleBeforeAnim(isShow ? VisibleType::VISIBLE : VisibleType::GONE);
126 auto gestureRow = GetGestureRow();
127 CHECK_NULL_VOID(gestureRow);
128 if (enableContainerModalGesture_) {
129 AddPanEvent(customTitleRow);
130 AddPanEvent(gestureRow);
131 }
132
133 UpdateGestureRowVisible();
134 InitColumnTouchTestFunc();
135 controlButtonsNode->SetHitTestMode(HitTestMode::HTMTRANSPARENT_SELF);
136 auto stack = GetStackNode();
137 CHECK_NULL_VOID(stack);
138 stack->UpdateInspectorId(CONTAINER_MODAL_STACK_ID);
139 }
140
GetTitleItemByIndex(const RefPtr<FrameNode> & controlButtonsNode,int32_t originIndex)141 RefPtr<UINode> ContainerModalPatternEnhance::GetTitleItemByIndex(
142 const RefPtr<FrameNode>& controlButtonsNode, int32_t originIndex)
143 {
144 return controlButtonsNode->GetChildAtIndex(originIndex);
145 }
146
OnWindowFocused()147 void ContainerModalPatternEnhance::OnWindowFocused()
148 {
149 ContainerModalPattern::OnWindowFocused();
150 ContainerModalPattern::SetIsHoveredMenu(false);
151 }
152
OnWindowUnfocused()153 void ContainerModalPatternEnhance::OnWindowUnfocused()
154 {
155 if (SubwindowManager::GetInstance()->GetCurrentWindow() &&
156 SubwindowManager::GetInstance()->GetCurrentWindow()->GetShown()) {
157 SetIsFocus(false);
158 ContainerModalPattern::SetIsHoveredMenu(true);
159 return;
160 }
161 ContainerModalPattern::OnWindowUnfocused();
162 ContainerModalPattern::SetIsHoveredMenu(false);
163 }
164
OnWindowForceUnfocused()165 void ContainerModalPatternEnhance::OnWindowForceUnfocused()
166 {
167 if (!GetIsFocus()) {
168 ContainerModalPattern::SetIsHoveredMenu(false);
169 ContainerModalPattern::OnWindowUnfocused();
170 }
171 }
172
ChangeCustomTitle(bool isFocus)173 void ContainerModalPatternEnhance::ChangeCustomTitle(bool isFocus)
174 {
175 // update custom title label
176 auto customTitleNode = GetCustomTitleNode();
177 CHECK_NULL_VOID(customTitleNode);
178 isFocus ? customTitleNode->FireOnWindowFocusedCallback() : customTitleNode->FireOnWindowUnfocusedCallback();
179 }
180
ChangeControlButtons(bool isFocus)181 void ContainerModalPatternEnhance::ChangeControlButtons(bool isFocus)
182 {
183 auto controlButtonsNode = GetControlButtonRow();
184 CHECK_NULL_VOID(controlButtonsNode);
185
186 // update maximize button
187 auto maximizeButton =
188 AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, MAX_RECOVER_BUTTON_INDEX));
189 auto pipeline = PipelineContext::GetCurrentContext();
190 CHECK_NULL_VOID(pipeline);
191 auto windowManager = pipeline->GetWindowManager();
192 MaximizeMode mode = windowManager->GetCurrentWindowMaximizeMode();
193 InternalResource::ResourceId maxId =
194 (mode == MaximizeMode::MODE_AVOID_SYSTEM_BAR || windowMode_ == WindowMode::WINDOW_MODE_FULLSCREEN ||
195 windowMode_ == WindowMode::WINDOW_MODE_SPLIT_PRIMARY ||
196 windowMode_ == WindowMode::WINDOW_MODE_SPLIT_SECONDARY)
197 ? InternalResource::ResourceId::IC_WINDOW_RESTORES
198 : InternalResource::ResourceId::IC_WINDOW_MAX;
199 ChangeTitleButtonIcon(maximizeButton, maxId, isFocus, false);
200
201 // update minimize button
202 auto minimizeButton =
203 AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, MINIMIZE_BUTTON_INDEX));
204 ChangeTitleButtonIcon(minimizeButton, InternalResource::ResourceId::IC_WINDOW_MIN, isFocus, false);
205
206 // update close button
207 auto closeButton = AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, CLOSE_BUTTON_INDEX));
208 ChangeTitleButtonIcon(closeButton, InternalResource::ResourceId::IC_WINDOW_CLOSE, isFocus, true);
209 }
210
ChangeFloatingTitle(bool isFocus)211 void ContainerModalPatternEnhance::ChangeFloatingTitle(bool isFocus)
212 {
213 auto pipeline = PipelineContext::GetCurrentContext();
214 CHECK_NULL_VOID(pipeline);
215 auto windowManager = pipeline->GetWindowManager();
216 CHECK_NULL_VOID(windowManager);
217
218 if (windowManager->GetWindowMode() != WindowMode::WINDOW_MODE_FLOATING &&
219 windowManager->GetWindowMode() != WindowMode::WINDOW_MODE_FULLSCREEN) {
220 windowManager->SetCurrentWindowMaximizeMode(MaximizeMode::MODE_RECOVER);
221 }
222
223 auto floatingTitleRow = GetFloatingTitleRow();
224 CHECK_NULL_VOID(floatingTitleRow);
225 auto floatingContext = floatingTitleRow->GetRenderContext();
226 CHECK_NULL_VOID(floatingContext);
227 auto pipelineContext = PipelineContext::GetCurrentContext();
228 CHECK_NULL_VOID(pipelineContext);
229 auto theme = pipelineContext->GetTheme<ContainerModalTheme>();
230 floatingContext->UpdateBackgroundColor(theme->GetBackGroundColor(isFocus));
231 // update floating custom title label
232 auto customFloatingTitleNode = GetFloatingTitleNode();
233 CHECK_NULL_VOID(customFloatingTitleNode);
234 isFocus ? customFloatingTitleNode->FireOnWindowFocusedCallback()
235 : customFloatingTitleNode->FireOnWindowUnfocusedCallback();
236 }
237
ChangeTitleButtonIcon(const RefPtr<FrameNode> & buttonNode,InternalResource::ResourceId icon,bool isFocus,bool isCloseBtn)238 void ContainerModalPatternEnhance::ChangeTitleButtonIcon(
239 const RefPtr<FrameNode>& buttonNode, InternalResource::ResourceId icon, bool isFocus, bool isCloseBtn)
240 {
241 ContainerModalPattern::ChangeTitleButtonIcon(buttonNode, icon, isFocus, isCloseBtn);
242 }
243
SetContainerButtonHide(bool hideSplit,bool hideMaximize,bool hideMinimize,bool hideClose)244 void ContainerModalPatternEnhance::SetContainerButtonHide(bool hideSplit, bool hideMaximize, bool hideMinimize,
245 bool hideClose)
246 {
247 auto controlButtonsNode = GetControlButtonRow();
248 CHECK_NULL_VOID(controlButtonsNode);
249 ContainerModalViewEnhance::SetEnableSplit(!hideSplit);
250
251 auto maximizeBtn =
252 AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, MAX_RECOVER_BUTTON_INDEX));
253 CHECK_NULL_VOID(maximizeBtn);
254 maximizeBtn->GetLayoutProperty()->UpdateVisibility(hideMaximize ? VisibleType::GONE : VisibleType::VISIBLE);
255 maximizeBtn->MarkDirtyNode();
256
257 auto minimizeBtn =
258 AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, MINIMIZE_BUTTON_INDEX));
259 CHECK_NULL_VOID(minimizeBtn);
260 minimizeBtn->GetLayoutProperty()->UpdateVisibility(hideMinimize ? VisibleType::GONE : VisibleType::VISIBLE);
261 minimizeBtn->MarkDirtyNode();
262
263 auto closeBtn = AceType::DynamicCast<FrameNode>(GetTitleItemByIndex(controlButtonsNode, CLOSE_BUTTON_INDEX));
264 CHECK_NULL_VOID(closeBtn);
265 closeBtn->GetLayoutProperty()->UpdateVisibility(hideClose ? VisibleType::GONE : VisibleType::VISIBLE);
266 closeBtn->MarkDirtyNode();
267 InitTitleRowLayoutProperty(GetCustomTitleRow());
268 }
269
UpdateTitleInTargetPos(bool isShow,int32_t height)270 void ContainerModalPatternEnhance::UpdateTitleInTargetPos(bool isShow, int32_t height)
271 {
272 auto floatingTitleNode = GetFloatingTitleRow();
273 CHECK_NULL_VOID(floatingTitleNode);
274 auto floatingLayoutProperty = floatingTitleNode->GetLayoutProperty();
275 CHECK_NULL_VOID(floatingLayoutProperty);
276 auto floatingContext = floatingTitleNode->GetRenderContext();
277 CHECK_NULL_VOID(floatingContext);
278
279 auto controlButtonsNode = GetControlButtonRow();
280 CHECK_NULL_VOID(controlButtonsNode);
281 auto controlButtonsLayoutProperty = controlButtonsNode->GetLayoutProperty();
282 CHECK_NULL_VOID(controlButtonsLayoutProperty);
283 auto buttonsContext = controlButtonsNode->GetRenderContext();
284 CHECK_NULL_VOID(buttonsContext);
285
286 auto titlePopupDistance = titleHeight_.ConvertToPx();
287 auto cubicBezierCurve = AceType::MakeRefPtr<CubicCurve>(0.00, 0.00, 0.20, 1.00);
288 AnimationOption option;
289 option.SetDuration(TITLE_POPUP_DURATION);
290 option.SetCurve(cubicBezierCurve);
291
292 if (isShow && CanShowFloatingTitle()) {
293 floatingContext->OnTransformTranslateUpdate({ 0.0f, height - static_cast<float>(titlePopupDistance), 0.0f });
294 floatingLayoutProperty->UpdateVisibility(floatingTitleSettedShow_ ? VisibleType::VISIBLE : VisibleType::GONE);
295 AnimationUtils::Animate(option, [floatingContext, height]() {
296 auto rect = floatingContext->GetPaintRectWithoutTransform();
297 floatingContext->OnTransformTranslateUpdate({ 0.0f, static_cast<float>(height - rect.GetY()), 0.0f });
298 });
299 buttonsContext->OnTransformTranslateUpdate({ 0.0f, height - static_cast<float>(titlePopupDistance), 0.0f });
300 SetControlButtonVisibleBeforeAnim(controlButtonsLayoutProperty->GetVisibilityValue());
301 controlButtonsLayoutProperty->UpdateVisibility(VisibleType::VISIBLE);
302 AnimationUtils::Animate(option, [buttonsContext, titlePopupDistance, height]() {
303 auto rect = buttonsContext->GetPaintRectWithoutTransform();
304 buttonsContext->OnTransformTranslateUpdate({ 0.0f, static_cast<float>(height -
305 (titlePopupDistance - CONTAINER_TITLE_HEIGHT.ConvertToPx())/2 - rect.GetY()), 0.0f });
306 });
307 }
308
309 if (!isShow && CanHideFloatingTitle()) {
310 auto beforeVisible = GetControlButtonVisibleBeforeAnim();
311 AnimationUtils::Animate(
312 option,
313 [floatingContext, buttonsContext, titlePopupDistance, beforeVisible]() {
314 floatingContext->OnTransformTranslateUpdate({ 0.0f, static_cast<float>(-titlePopupDistance), 0.0f });
315 buttonsContext->OnTransformTranslateUpdate({ 0.0f,
316 beforeVisible == VisibleType::VISIBLE ? 0.0f : static_cast<float>(-titlePopupDistance), 0.0f });
317 },
318 [floatingLayoutProperty, controlButtonsLayoutProperty, beforeVisible, weak = WeakClaim(this)]() {
319 auto containerModal = weak.Upgrade();
320 CHECK_NULL_VOID(containerModal);
321 floatingLayoutProperty->UpdateVisibility(VisibleType::GONE);
322 controlButtonsLayoutProperty->UpdateVisibility(containerModal->GetControlButtonVisibleBeforeAnim());
323 });
324 }
325 }
326
ClearTapGestureEvent(RefPtr<FrameNode> & containerTitleRow)327 void ContainerModalPatternEnhance::ClearTapGestureEvent(RefPtr<FrameNode>& containerTitleRow)
328 {
329 auto eventHub = containerTitleRow->GetOrCreateGestureEventHub();
330 CHECK_NULL_VOID(eventHub);
331 eventHub->ClearGesture();
332 eventHub->OnModifyDone();
333 }
334
SetTapGestureEvent(RefPtr<FrameNode> & containerTitleRow)335 void ContainerModalPatternEnhance::SetTapGestureEvent(RefPtr<FrameNode>& containerTitleRow)
336 {
337 auto eventHub = containerTitleRow->GetOrCreateGestureEventHub();
338 CHECK_NULL_VOID(eventHub);
339 auto tapGesture = AceType::MakeRefPtr<NG::TapGesture>(2, 1);
340 CHECK_NULL_VOID(tapGesture);
341 WeakPtr<FrameNode> weakNode = frameNode_;
342 tapGesture->SetOnActionId([weakNode](GestureEvent& info) mutable {
343 TAG_LOGI(AceLogTag::ACE_APPBAR, "container window double click.");
344 auto containerNode = weakNode.Upgrade();
345 CHECK_NULL_VOID(containerNode);
346 auto windowManager = GetNotMovingWindowManager(weakNode);
347 CHECK_NULL_VOID(windowManager);
348 auto windowMode = windowManager->GetWindowMode();
349 auto maximizeMode = windowManager->GetCurrentWindowMaximizeMode();
350 if (maximizeMode == MaximizeMode::MODE_AVOID_SYSTEM_BAR || windowMode == WindowMode::WINDOW_MODE_FULLSCREEN ||
351 windowMode == WindowMode::WINDOW_MODE_SPLIT_PRIMARY ||
352 windowMode == WindowMode::WINDOW_MODE_SPLIT_SECONDARY) {
353 EventReport::ReportDoubleClickTitle(DOUBLE_CLICK_TO_RECOVER);
354 windowManager->WindowRecover();
355 } else if (windowMode == WindowMode::WINDOW_MODE_FLOATING) {
356 EventReport::ReportDoubleClickTitle(DOUBLE_CLICK_TO_MAXIMIZE);
357 windowManager->WindowMaximize(true);
358 }
359 containerNode->OnWindowFocused();
360 });
361 eventHub->AddGesture(tapGesture);
362 eventHub->OnModifyDone();
363 }
364
EnablePanEventOnNode(RefPtr<FrameNode> & node,bool isEnable,const std::string & rowName)365 void ContainerModalPatternEnhance::EnablePanEventOnNode(
366 RefPtr<FrameNode>& node, bool isEnable, const std::string& rowName)
367 {
368 if (!node) {
369 TAG_LOGI(AceLogTag::ACE_APPBAR, "%{public}s is not exist when set pan event", rowName.c_str());
370 return;
371 }
372
373 if (isEnable) {
374 AddPanEvent(node);
375 } else {
376 RemovePanEvent(node);
377 }
378 }
379
EnableTapGestureOnNode(RefPtr<FrameNode> & node,bool isEnable,const std::string & rowName)380 void ContainerModalPatternEnhance::EnableTapGestureOnNode(
381 RefPtr<FrameNode>& node, bool isEnable, const std::string& rowName)
382 {
383 if (!node) {
384 TAG_LOGI(AceLogTag::ACE_APPBAR, "%{public}s is not exist when set tap gesture", rowName.c_str());
385 return;
386 }
387
388 if (isEnable) {
389 SetTapGestureEvent(node);
390 } else {
391 ClearTapGestureEvent(node);
392 }
393 }
394
HandleGestureRowHitTestMode(RefPtr<FrameNode> & gestureRow)395 void ContainerModalPatternEnhance::HandleGestureRowHitTestMode(RefPtr<FrameNode>& gestureRow)
396 {
397 if (!gestureRow) {
398 TAG_LOGI(AceLogTag::ACE_APPBAR, "gestureRow is not exist when HandleHitTestMode");
399 return;
400 }
401
402 if (enableContainerModalGesture_) {
403 gestureRow->SetHitTestMode(HitTestMode::HTMDEFAULT);
404 } else {
405 gestureRow->SetHitTestMode(HitTestMode::HTMTRANSPARENT);
406 }
407 }
408
EnableContainerModalGesture(bool isEnable)409 void ContainerModalPatternEnhance::EnableContainerModalGesture(bool isEnable)
410 {
411 TAG_LOGI(AceLogTag::ACE_APPBAR, "set event on container modal is %{public}d", isEnable);
412
413 enableContainerModalGesture_ = isEnable;
414
415 auto floatingTitleRow = GetFloatingTitleRow();
416 auto customTitleRow = GetCustomTitleRow();
417 auto gestureRow = GetGestureRow();
418 HandleGestureRowHitTestMode(gestureRow);
419 EnableTapGestureOnNode(floatingTitleRow, isEnable, "floating title row");
420 EnablePanEventOnNode(customTitleRow, isEnable, "custom title row");
421 EnableTapGestureOnNode(customTitleRow, isEnable, "custom title row");
422 EnablePanEventOnNode(gestureRow, isEnable, "gesture row");
423 EnableTapGestureOnNode(gestureRow, isEnable, "gesture row");
424 }
425
GetFloatingTitleVisible()426 bool ContainerModalPatternEnhance::GetFloatingTitleVisible()
427 {
428 auto floatingTitleRow = GetFloatingTitleRow();
429 CHECK_NULL_RETURN(floatingTitleRow, false);
430 auto floatingTitleRowProp = floatingTitleRow->GetLayoutProperty();
431 CHECK_NULL_RETURN(floatingTitleRowProp, false);
432 return (floatingTitleRowProp->GetVisibilityValue() == VisibleType::VISIBLE);
433 }
434
GetCustomTitleVisible()435 bool ContainerModalPatternEnhance::GetCustomTitleVisible()
436 {
437 auto customTitleRow = GetCustomTitleRow();
438 CHECK_NULL_RETURN(customTitleRow, false);
439 auto customTitleRowProp = customTitleRow->GetLayoutProperty();
440 CHECK_NULL_RETURN(customTitleRowProp, false);
441 return (customTitleRowProp->GetVisibilityValue() == VisibleType::VISIBLE);
442 }
443
GetControlButtonVisible()444 bool ContainerModalPatternEnhance::GetControlButtonVisible()
445 {
446 auto controlButtonRow = GetControlButtonRow();
447 CHECK_NULL_RETURN(controlButtonRow, false);
448 auto controlButtonRowProp = controlButtonRow->GetLayoutProperty();
449 CHECK_NULL_RETURN(controlButtonRowProp, false);
450 return (controlButtonRowProp->GetVisibilityValue() == VisibleType::VISIBLE);
451 }
452 } // namespace OHOS::Ace::NG
453