From 4d9340b57f0fbd4e499cf46ab0fa427583b1d312 Mon Sep 17 00:00:00 2001 From: jiangdayuan Date: Tue, 15 Feb 2022 20:50:28 +0800 Subject: [PATCH] add window title show or hide Signed-off-by: jiangdayuan Change-Id: I92c2830c8d61acf0035ba79e5963a7a9a35cf66e --- .../container_modal_component.cpp | 199 ++++++++++-------- .../container_modal_component.h | 23 +- .../container_modal_element.cpp | 142 ++++++++++++- .../container_modal/container_modal_element.h | 5 + .../render_container_modal.cpp | 5 +- frameworks/core/pipeline/pipeline_context.cpp | 15 +- frameworks/core/pipeline/pipeline_context.h | 2 + 7 files changed, 280 insertions(+), 111 deletions(-) diff --git a/frameworks/core/components/container_modal/container_modal_component.cpp b/frameworks/core/components/container_modal/container_modal_component.cpp index 188417a52d2..a3c16d8a8e6 100644 --- a/frameworks/core/components/container_modal/container_modal_component.cpp +++ b/frameworks/core/components/container_modal/container_modal_component.cpp @@ -25,6 +25,7 @@ #include "core/components/image/image_component.h" #include "core/components/padding/padding_component.h" #include "core/components/text/text_component.h" +#include "core/components/tween/tween_component.h" namespace OHOS::Ace { namespace { @@ -46,12 +47,11 @@ const Color CONTAINER_BORDER_COLOR = Color(0x33000000); const Color TITLE_TEXT_COLOR = Color(0xe5000000); const Color CONTENT_BACKGROUND_COLOR = Color(0xffffffff); const Color TITLE_BUTTON_BACKGROUND_COLOR = Color(0x33000000); -const Color TITLE_BUTTON_CLICKED_COLOR = Color(0x33000000); } // namespace -RefPtr ContainerModalComponent::Create(const WeakPtr& context, - const RefPtr& child) +RefPtr ContainerModalComponent::Create( + const WeakPtr& context, const RefPtr& child) { auto component = AceType::MakeRefPtr(context); component->SetChild(child); @@ -71,91 +71,23 @@ RefPtr ContainerModalComponent::CreateRenderNode() RefPtr ContainerModalComponent::GetMaximizeRecoverButtonIcon() const { - auto button = AceType::DynamicCast(titleMaximizeRecoverButton_); - if (!button || button->GetChildren().empty()) { + if (!titleMaximizeRecoverButton_ || titleMaximizeRecoverButton_->GetChildren().empty()) { LOGE("tile maximize recover button is null"); return nullptr; } - return button->GetChildren().front(); + return titleMaximizeRecoverButton_->GetChildren().front(); } RefPtr ContainerModalComponent::BuildTitle() { - std::list> titleChildren; - // title icon - auto image = AceType::MakeRefPtr(); - image->SetWidth(TITLE_ICON_SIZE); - image->SetHeight(TITLE_ICON_SIZE); - titleChildren.emplace_back(SetPadding(image, TITLE_PADDING_START, TITLE_ELEMENT_MARGIN_HORIZONTAL)); - titleIcon_ = image; - - // title text - auto text = AceType::MakeRefPtr(""); - TextStyle style; - style.SetFontSize(TITLE_TEXT_FONT_SIZE); - style.SetTextColor(TITLE_TEXT_COLOR); - style.SetFontWeight(FontWeight::W500); - style.SetAllowScale(false); - text->SetTextStyle(style); - titleLabel_ = text; - auto flexItem = AceType::MakeRefPtr(1.0, 1.0, 0.0, text); - titleChildren.emplace_back(flexItem); - - // title button - auto contextWptr = context_; - auto leftSplitBtn = BuildControlButton(InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_SPLIT_LEFT, - [contextWptr]() { - LOGI("left split button clicked"); - auto context = contextWptr.Upgrade(); - if (context) { - context->FireWindowSplitCallBack(); - } - }); - auto maximizeRecoverBtn = BuildControlButton(InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_MAXIMIZE, - [contextWptr]() { - auto context = contextWptr.Upgrade(); - if (context) { - auto mode = context->FireWindowGetModeCallBack(); - if (mode == WindowMode::WINDOW_MODE_FULLSCREEN) { - LOGI("recover button clicked"); - context->FireWindowRecoverCallBack(); - } else { - LOGI("maximize button clicked"); - context->FireWindowMaximizeCallBack(); - } - } - }); - titleMaximizeRecoverButton_ = maximizeRecoverBtn; - auto minimizeBtn = BuildControlButton(InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_MINIMIZE, - [contextWptr]() { - LOGI("minimize button clicked"); - auto context = contextWptr.Upgrade(); - if (context) { - context->FireWindowMinimizeCallBack(); - } - }); - auto closeBtn = BuildControlButton(InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_CLOSE, - [contextWptr]() { - LOGI("close button clicked"); - auto context = contextWptr.Upgrade(); - if (context) { - context->FireWindowCloseCallBack(); - } - }); - - titleChildren.emplace_back(SetPadding(leftSplitBtn, ZERO_PADDING, TITLE_ELEMENT_MARGIN_HORIZONTAL)); - titleChildren.emplace_back(SetPadding(maximizeRecoverBtn, ZERO_PADDING, TITLE_ELEMENT_MARGIN_HORIZONTAL)); - titleChildren.emplace_back(SetPadding(minimizeBtn, ZERO_PADDING, TITLE_ELEMENT_MARGIN_HORIZONTAL)); - titleChildren.emplace_back(SetPadding(closeBtn, ZERO_PADDING, TITLE_PADDING_END)); - // build title box - auto titleDecoration = AceType::MakeRefPtr(); + titleChildren_ = BuildTitleChildren(); auto titleBox = AceType::MakeRefPtr(); titleBox->SetHeight(CONTAINER_TITLE_HEIGHT); - auto row = AceType::MakeRefPtr(FlexAlign::FLEX_START, FlexAlign::CENTER, titleChildren); + auto row = AceType::MakeRefPtr(FlexAlign::FLEX_START, FlexAlign::CENTER, titleChildren_); // handle mouse move - titleBox->SetOnMouseId([contextWptr](MouseInfo& info) { + titleBox->SetOnMouseId([contextWptr = context_](MouseInfo& info) { auto context = contextWptr.Upgrade(); if (context && info.GetButton() == MouseButton::LEFT_BUTTON && info.GetAction() == MouseAction::MOVE) { context->FireWindowStartMoveCallBack(); @@ -163,14 +95,31 @@ RefPtr ContainerModalComponent::BuildTitle() }); // handle touch move - titleBox->SetOnTouchMoveId([contextWptr](const TouchEventInfo&) { + titleBox->SetOnTouchMoveId([contextWptr = context_](const TouchEventInfo&) { auto context = contextWptr.Upgrade(); if (context) { context->FireWindowStartMoveCallBack(); } }); titleBox->SetChild(row); - return titleBox; + auto display = AceType::MakeRefPtr(titleBox); + return display; +} + +RefPtr ContainerModalComponent::BuildFloatingTitle() +{ + // build floating title box + auto titleDecoration = AceType::MakeRefPtr(); + titleDecoration->SetBackgroundColor(CONTAINER_BACKGROUND_COLOR); + + auto titleBox = AceType::MakeRefPtr(); + titleBox->SetHeight(CONTAINER_TITLE_HEIGHT); + titleBox->SetBackDecoration(titleDecoration); + + auto row = AceType::MakeRefPtr(FlexAlign::FLEX_START, FlexAlign::CENTER, titleChildren_); + titleBox->SetChild(row); + auto tween = AceType::MakeRefPtr("ContainerModal", titleBox); + return tween; } RefPtr ContainerModalComponent::BuildContent() @@ -194,8 +143,8 @@ RefPtr ContainerModalComponent::BuildContent() return contentBox; } -RefPtr ContainerModalComponent::BuildControlButton(InternalResource::ResourceId icon, - std::function&& clickCallback) +RefPtr ContainerModalComponent::BuildControlButton( + InternalResource::ResourceId icon, std::function&& clickCallback) { auto image = AceType::MakeRefPtr(icon); image->SetWidth(TITLE_ICON_SIZE); @@ -208,13 +157,12 @@ RefPtr ContainerModalComponent::BuildControlButton(InternalResource:: button->SetHeight(TITLE_BUTTON_SIZE); button->SetType(ButtonType::CIRCLE); button->SetBackgroundColor(TITLE_BUTTON_BACKGROUND_COLOR); - button->SetClickedColor(TITLE_BUTTON_CLICKED_COLOR); button->SetClickFunction(std::move(clickCallback)); return button; } -RefPtr ContainerModalComponent::SetPadding(const RefPtr& component, const Dimension& leftPadding, - const Dimension& rightPadding) +RefPtr ContainerModalComponent::SetPadding( + const RefPtr& component, const Dimension& leftPadding, const Dimension& rightPadding) { auto paddingComponent = AceType::MakeRefPtr(); paddingComponent->SetPaddingLeft(leftPadding); @@ -236,12 +184,15 @@ void ContainerModalComponent::BuildInnerChild() containerDecoration->SetBackgroundColor(CONTAINER_BACKGROUND_COLOR); containerDecoration->SetBorder(outerBorder); - auto title = BuildTitle(); - auto content = BuildContent(); - auto column = AceType::MakeRefPtr(FlexAlign::FLEX_START, FlexAlign::CENTER, - std::list>()); - column->AppendChild(title); - column->AppendChild(content); + auto column = + AceType::MakeRefPtr(FlexAlign::FLEX_START, FlexAlign::CENTER, std::list>()); + column->AppendChild(BuildTitle()); + column->AppendChild(BuildContent()); + std::list> stackChildren; + stackChildren.emplace_back(column); + stackChildren.emplace_back(BuildFloatingTitle()); + auto stackComponent = AceType::MakeRefPtr( + Alignment::TOP_LEFT, StackFit::INHERIT, Overflow::OBSERVABLE, stackChildren); auto containerBox = AceType::MakeRefPtr(); containerBox->SetBackDecoration(containerDecoration); @@ -252,8 +203,76 @@ void ContainerModalComponent::BuildInnerChild() Edge padding; padding.SetBottom(CONTENT_MARGIN); containerBox->SetPadding(padding); - containerBox->SetChild(column); + containerBox->SetChild(stackComponent); SetChild(containerBox); } +std::list> ContainerModalComponent::BuildTitleChildren() +{ + // title icon + titleIcon_ = AceType::MakeRefPtr(); + titleIcon_->SetWidth(TITLE_ICON_SIZE); + titleIcon_->SetHeight(TITLE_ICON_SIZE); + + // title text + titleLabel_ = AceType::MakeRefPtr(""); + TextStyle style; + style.SetFontSize(TITLE_TEXT_FONT_SIZE); + style.SetTextColor(TITLE_TEXT_COLOR); + style.SetFontWeight(FontWeight::W500); + style.SetAllowScale(false); + titleLabel_->SetTextStyle(style); + + // title button + auto contextWptr = context_; + auto titleLeftSplitButton = + BuildControlButton(InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_SPLIT_LEFT, [contextWptr]() { + LOGI("left split button clicked"); + auto context = contextWptr.Upgrade(); + if (context) { + context->FireWindowSplitCallBack(); + } + }); + titleMaximizeRecoverButton_ = + BuildControlButton(InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_MAXIMIZE, [contextWptr]() { + auto context = contextWptr.Upgrade(); + if (context) { + auto mode = context->FireWindowGetModeCallBack(); + if (mode == WindowMode::WINDOW_MODE_FULLSCREEN) { + LOGI("recover button clicked"); + context->FireWindowRecoverCallBack(); + context->ShowContainerTitle(true); + } else { + LOGI("maximize button clicked"); + context->FireWindowMaximizeCallBack(); + context->ShowContainerTitle(false); + } + } + }); + auto titleMinimizeButton = + BuildControlButton(InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_MINIMIZE, [contextWptr]() { + auto context = contextWptr.Upgrade(); + if (context) { + LOGI("minimize button clicked"); + context->FireWindowMinimizeCallBack(); + } + }); + auto titleCloseButton = + BuildControlButton(InternalResource::ResourceId::CONTAINER_MODAL_WINDOW_CLOSE, [contextWptr]() { + auto context = contextWptr.Upgrade(); + if (context) { + LOGI("close button clicked"); + context->FireWindowCloseCallBack(); + } + }); + std::list> titleChildren; + titleChildren.emplace_back(SetPadding(titleIcon_, TITLE_PADDING_START, TITLE_ELEMENT_MARGIN_HORIZONTAL)); + titleChildren.emplace_back(AceType::MakeRefPtr(1.0, 1.0, 0.0, titleLabel_)); + titleChildren.emplace_back(SetPadding(titleLeftSplitButton, ZERO_PADDING, TITLE_ELEMENT_MARGIN_HORIZONTAL)); + titleChildren.emplace_back(SetPadding(titleMaximizeRecoverButton_, ZERO_PADDING, TITLE_ELEMENT_MARGIN_HORIZONTAL)); + titleChildren.emplace_back(SetPadding(titleMinimizeButton, ZERO_PADDING, TITLE_ELEMENT_MARGIN_HORIZONTAL)); + titleChildren.emplace_back(SetPadding(titleCloseButton, ZERO_PADDING, TITLE_PADDING_END)); + return titleChildren; +} + } // namespace OHOS::Ace \ No newline at end of file diff --git a/frameworks/core/components/container_modal/container_modal_component.h b/frameworks/core/components/container_modal/container_modal_component.h index 7e9750c592b..0a47618cd52 100644 --- a/frameworks/core/components/container_modal/container_modal_component.h +++ b/frameworks/core/components/container_modal/container_modal_component.h @@ -16,6 +16,9 @@ #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_CONTAINER_MODAL_CONTAINER_MODAL_COMPONENT_H #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_CONTAINER_MODAL_CONTAINER_MODAL_COMPONENT_H +#include "core/components/button/button_component.h" +#include "core/components/image/image_component.h" +#include "core/components/text/text_component.h" #include "core/pipeline/base/sole_child_component.h" namespace OHOS::Ace { @@ -36,27 +39,31 @@ public: void BuildInnerChild(); RefPtr GetMaximizeRecoverButtonIcon() const; - RefPtr GetTitleIcon() const + RefPtr GetTitleIcon() const { return titleIcon_; } - RefPtr GetTitleLabel() const + RefPtr GetTitleLabel() const { return titleLabel_; } private: RefPtr BuildTitle(); + RefPtr BuildFloatingTitle(); RefPtr BuildContent(); - RefPtr BuildControlButton(InternalResource::ResourceId icon, std::function&& clickCallback); - static RefPtr SetPadding(const RefPtr& component, const Dimension& leftPadding, - const Dimension& rightPadding); + RefPtr BuildControlButton( + InternalResource::ResourceId icon, std::function&& clickCallback); + std::list> BuildTitleChildren(); + static RefPtr SetPadding( + const RefPtr& component, const Dimension& leftPadding, const Dimension& rightPadding); WeakPtr context_; - RefPtr titleIcon_; - RefPtr titleLabel_; - RefPtr titleMaximizeRecoverButton_; + RefPtr titleIcon_; + RefPtr titleLabel_; + RefPtr titleMaximizeRecoverButton_; + std::list> titleChildren_; }; } // namespace OHOS::Ace diff --git a/frameworks/core/components/container_modal/container_modal_element.cpp b/frameworks/core/components/container_modal/container_modal_element.cpp index 0f851b53ac7..f5cf6d99c0a 100644 --- a/frameworks/core/components/container_modal/container_modal_element.cpp +++ b/frameworks/core/components/container_modal/container_modal_element.cpp @@ -24,6 +24,8 @@ namespace OHOS::Ace { namespace { constexpr uint32_t COLUMN_CHILD_NUM = 2; +constexpr uint32_t TITLE_POPUP_TIME = 500; // 500ms +constexpr double TITLE_POPUP_DISTANCE = 100.0; // 100px } // namespace @@ -31,29 +33,34 @@ RefPtr ContainerModalElement::GetStackElement() const { auto containerBox = AceType::DynamicCast(GetFirstChild()); if (!containerBox) { - LOGE("Get stack element failed. Container box element is null!"); + LOGE("Get stack element failed, container box element is null!"); return {}; } - auto column = AceType::DynamicCast(containerBox->GetFirstChild()); + // The first stack is not what we need. + auto stackElement = AceType::DynamicCast(containerBox->GetFirstChild()); + if (!stackElement) { + LOGE("Get stack element failed, stack element is null!"); + return {}; + } + + auto column = AceType::DynamicCast(stackElement->GetFirstChild()); if (!column || column->GetChildren().size() != COLUMN_CHILD_NUM) { // column should have 2 children, title and content. - LOGE("Get stack element failed. Column is null or child size error!"); + LOGE("Get stack element failed, column is null or child size error!"); return {}; } - // Get second child - auto secondItr = std::next(column->GetChildren().begin()); - auto contentBox = AceType::DynamicCast(*secondItr); - + // Get second child : content + auto contentBox = AceType::DynamicCast(column->GetLastChild()); if (!contentBox) { - LOGE("Get stack element failed. content box element is null!"); + LOGE("Get stack element failed, content box element is null!"); return {}; } auto stack = contentBox->GetFirstChild(); if (!stack || !AceType::InstanceOf(stack)) { - LOGE("Get stack element failed. stack is null or type error!"); + LOGE("Get stack element failed, stack is null or type error!"); return {}; } @@ -93,4 +100,121 @@ RefPtr ContainerModalElement::GetStageElement() const return {}; } +void ContainerModalElement::ShowTitle(bool isShow) +{ + auto containerBox = AceType::DynamicCast(GetFirstChild()); + if (!containerBox) { + LOGE("ContainerModalElement showTitle failed, container box element is null!"); + return; + } + + auto stackElement = AceType::DynamicCast(containerBox->GetFirstChild()); + if (!stackElement) { + LOGE("ContainerModalElement showTitle failed, stack element is null!"); + return; + } + + auto column = AceType::DynamicCast(stackElement->GetFirstChild()); + if (!column || column->GetChildren().size() != COLUMN_CHILD_NUM) { + // column should have 2 children, title and content. + LOGE("ContainerModalElement showTitle failed, column element is null or children size error!"); + return; + } + + // Get first child : title + auto display = AceType::DynamicCast(column->GetFirstChild()); + if (!display) { + LOGE("ContainerModalElement showTitle failed,, display element is null."); + return; + } + auto renderDisplay = AceType::DynamicCast(display->GetRenderNode()); + if (renderDisplay) { + renderDisplay->UpdateVisibleType(isShow ? VisibleType::VISIBLE : VisibleType::GONE); + } + + // hide floating title anyway. + if (renderDisplay_) { + renderDisplay_->UpdateVisibleType(VisibleType::GONE); + } +} + +void ContainerModalElement::PerformBuild() +{ + SoleChildElement::PerformBuild(); + if (!controller_) { + controller_ = AceType::MakeRefPtr(context_); + controller_->SetDuration(TITLE_POPUP_TIME); + controller_->SetFillMode(FillMode::FORWARDS); + auto translateY = AceType::MakeRefPtr>( + DimensionOffset(Dimension(), Dimension(-TITLE_POPUP_DISTANCE)), DimensionOffset(Dimension(), Dimension()), + Curves::FRICTION); + TweenOption option; + option.SetTranslateAnimations(AnimationType::TRANSLATE_Y, translateY); + auto containerBox = AceType::DynamicCast(GetFirstChild()); + if (!containerBox) { + LOGE("ContainerModalElement PerformBuild failed, container box element is null!"); + return; + } + + auto stackElement = AceType::DynamicCast(containerBox->GetFirstChild()); + if (!stackElement) { + LOGE("ContainerModalElement PerformBuild failed, stack element is null!"); + return; + } + + auto tween = AceType::DynamicCast(stackElement->GetLastChild()); + if (!tween) { + LOGE("ContainerModalElement PerformBuild failed, tween element is null."); + return; + } + auto display = AceType::DynamicCast(tween->GetFirstChild()); + if (display && !renderDisplay_) { + renderDisplay_ = AceType::DynamicCast(display->GetRenderNode()); + if (renderDisplay_) { + renderDisplay_->UpdateVisibleType(VisibleType::GONE); + } + } + tween->SetController(controller_); + tween->SetOption(option); + tween->ApplyKeyframes(); + } +} + +void ContainerModalElement::Update() +{ + RenderElement::Update(); + + const auto container = AceType::DynamicCast(component_); + if (!container) { + LOGE("ContainerModalElement update failed, container modal component is null."); + return; + } + auto containerBox = AceType::DynamicCast(container->GetChild()); + if (!containerBox) { + LOGE("ContainerModalElement update failed, container box component is null."); + return; + } + containerBox->SetOnTouchMoveId([week = WeakClaim(this), weakContext = context_](const TouchEventInfo& info) { + auto containerElement = week.Upgrade(); + auto context = weakContext.Upgrade(); + if (!containerElement || !context) { + return; + } + if (context->FireWindowGetModeCallBack() != WindowMode::WINDOW_MODE_FULLSCREEN) { + LOGI("Window is not full screen, can not show floating title."); + return; + } + if (containerElement->renderDisplay_ && + containerElement->renderDisplay_->GetVisibleType() == VisibleType::VISIBLE) { + LOGI("Floating tittle is visible now, no need to show again."); + return; + } + // touch top to pop-up title bar. + if (info.GetChangedTouches().begin()->GetGlobalLocation().GetY() <= TITLE_POPUP_DISTANCE) { + containerElement->renderDisplay_->UpdateVisibleType(VisibleType::VISIBLE); + containerElement->controller_->Forward(); + } + }); +} + } // namespace OHOS::Ace \ No newline at end of file diff --git a/frameworks/core/components/container_modal/container_modal_element.h b/frameworks/core/components/container_modal/container_modal_element.h index 51c46e65e26..dbbaaedb634 100644 --- a/frameworks/core/components/container_modal/container_modal_element.h +++ b/frameworks/core/components/container_modal/container_modal_element.h @@ -28,9 +28,14 @@ class ContainerModalElement : public SoleChildElement { public: RefPtr GetOverlayElement() const; RefPtr GetStageElement() const; + void ShowTitle(bool isShow); + void Update() override; + void PerformBuild() override; private: RefPtr GetStackElement() const; + RefPtr controller_; + RefPtr renderDisplay_; }; } // namespace OHOS::Ace diff --git a/frameworks/core/components/container_modal/render_container_modal.cpp b/frameworks/core/components/container_modal/render_container_modal.cpp index a517bb01381..8dd2c1bb694 100644 --- a/frameworks/core/components/container_modal/render_container_modal.cpp +++ b/frameworks/core/components/container_modal/render_container_modal.cpp @@ -52,14 +52,14 @@ void RenderContainerModal::UpdateStyle(const RefPtr& component) const return; } auto labelId = context->GetAppLabelId(); - auto appLabelComponent = AceType::DynamicCast(containerModal->GetTitleLabel()); + auto appLabelComponent = containerModal->GetTitleLabel(); if (appLabelComponent && labelId != 0) { auto appLabel = themeConstants->GetString(labelId); appLabelComponent->SetData(appLabel); } auto iconId = context->GetAppIconId(); - auto appIconComponent = AceType::DynamicCast(containerModal->GetTitleIcon()); + auto appIconComponent = containerModal->GetTitleIcon(); if (appIconComponent && iconId != 0) { auto appIconSrc = themeConstants->GetMediaPath(iconId); appIconComponent->SetSrc(appIconSrc); @@ -116,7 +116,6 @@ void RenderContainerModal::PerformLayout() ContainerBoxLayout(); } - void RenderContainerModal::ContainerBoxLayout() { auto maxSize = GetLayoutParam().GetMaxSize(); diff --git a/frameworks/core/pipeline/pipeline_context.cpp b/frameworks/core/pipeline/pipeline_context.cpp index 3b9913fc8cc..682db946b85 100644 --- a/frameworks/core/pipeline/pipeline_context.cpp +++ b/frameworks/core/pipeline/pipeline_context.cpp @@ -313,6 +313,19 @@ void PipelineContext::RefreshStageFocus() stageElement->RefreshFocus(); } + +void PipelineContext::ShowContainerTitle(bool isShow) +{ + if (windowModal_ != WindowModal::CONTAINER_MODAL) { + LOGW("Window modal is not container."); + return; + } + auto containerModal = AceType::DynamicCast(rootElement_->GetFirstChild()); + if (containerModal) { + containerModal->ShowTitle(isShow); + } +} + RefPtr PipelineContext::GetStageElement() const { CHECK_RUN_ON(UI); @@ -3243,4 +3256,4 @@ std::shared_ptr PipelineContext::GetRSUIDirector() #endif } -} // namespace OHOS::Ace +} // namespace OHOS::Ace \ No newline at end of file diff --git a/frameworks/core/pipeline/pipeline_context.h b/frameworks/core/pipeline/pipeline_context.h index 6ccbe3c0061..a5d3a948a90 100644 --- a/frameworks/core/pipeline/pipeline_context.h +++ b/frameworks/core/pipeline/pipeline_context.h @@ -455,6 +455,8 @@ public: void RefreshStageFocus(); + void ShowContainerTitle(bool isShow); + RefPtr GetStageElement() const; RefPtr GetComposedElementById(const ComposeId& id); -- Gitee