1 Star 0 Fork 4.6K

zhouchengchao/arkui_ace_engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
11.diff 10.30 KB
一键复制 编辑 原始数据 按行查看 历史
diff --git a/adapter/ohos/entrance/ui_content_impl.cpp b/adapter/ohos/entrance/ui_content_impl.cpp
index 5dac788b7f..e3194b728a 100644
--- a/adapter/ohos/entrance/ui_content_impl.cpp
+++ b/adapter/ohos/entrance/ui_content_impl.cpp
@@ -3854,9 +3854,9 @@ void UIContentImpl::SetContainerButtonStyle(const Rosen::DecorButtonStyle& butto
CHECK_NULL_VOID(taskExecutor);
taskExecutor->PostTask(
[container, buttonStyle]() {
- auto pipelineContext = container->GetPipelineContext();
+ auto pipelineContext = AceType::DynamicCast<NG::PipelineContext>(container->GetPipelineContext());
CHECK_NULL_VOID(pipelineContext);
- pipelineContext->SetContainerButtonStyle(buttonStyle.buttonBackgroundSize,
+ NG::ContainerModalPatternEnhance::SetContainerButtonStyle(pipelineContext, buttonStyle.buttonBackgroundSize,
buttonStyle.spacingBetweenButtons, buttonStyle.closeButtonRightMargin, buttonStyle.colorMode);
},
TaskExecutor::TaskType::UI, "SetContainerButtonStyle");
diff --git a/frameworks/core/components_ng/pattern/container_modal/container_modal_pattern.h b/frameworks/core/components_ng/pattern/container_modal/container_modal_pattern.h
index bb4d15c36c..a1ba0bc17a 100644
--- a/frameworks/core/components_ng/pattern/container_modal/container_modal_pattern.h
+++ b/frameworks/core/components_ng/pattern/container_modal/container_modal_pattern.h
@@ -164,8 +164,6 @@ public:
void UpdateGestureRowVisible();
void SetContainerModalTitleVisible(bool customTitleSettedShow, bool floatingTitleSettedShow);
virtual void SetContainerModalTitleHeight(int32_t height);
- virtual void SetContainerButtonStyle(uint32_t buttonSize, uint32_t spacingBetweenButtons,
- uint32_t closeButtonRightMargin, int32_t colorMode) {};
int32_t GetContainerModalTitleHeight();
virtual bool GetContainerModalButtonsRect(RectF& containerModal, RectF& buttons);
void SubscribeContainerModalButtonsRectChange(
diff --git a/frameworks/core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.cpp b/frameworks/core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.cpp
index 2130eafb73..8508d37471 100755
--- a/frameworks/core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.cpp
+++ b/frameworks/core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.cpp
@@ -341,17 +341,30 @@ void ContainerModalPatternEnhance::SetContainerButtonHide(
controlButtonsNode->FireCustomCallback(EVENT_NAME_CLOSE_VISIBILITY, hideClose);
}
-void ContainerModalPatternEnhance::SetContainerButtonStyle(uint32_t buttonsize, uint32_t spacingBetweenButtons,
- uint32_t closeButtonRightMargin, int32_t colorMode)
+void ContainerModalPatternEnhance::SetContainerButtonStyle(RefPtr<PipelineContext> pipeline, uint32_t buttonsize,
+ uint32_t spacingBetweenButtons, uint32_t closeButtonRightMargin, int32_t colorMode)
{
- auto controlButtonsNode = GetCustomButtonNode();
+ CHECK_NULL_VOID(pipeline);
+ if (!pipeline || pipeline->GetWindowModal() != WindowModal::CONTAINER_MODAL) {
+ return;
+ }
+ auto rootNode = pipeline->GetRootElement();
+ CHECK_NULL_VOID(rootNode);
+ auto containerNode = AceType::DynamicCast<FrameNode>(rootNode->GetChildren().front());
+ CHECK_NULL_VOID(containerNode);
+ auto containerPattern = containerNode->GetPattern<ContainerModalPatternEnhance>();
+ CHECK_NULL_VOID(containerPattern);
+ auto controlButtonsNode = containerPattern->GetCustomButtonNode();
CHECK_NULL_VOID(controlButtonsNode);
controlButtonsNode->FireCustomCallback(EVENT_NAME_BUTTON_SPACING_CHANGE, std::to_string(spacingBetweenButtons));
controlButtonsNode->FireCustomCallback(EVENT_NAME_BUTTON_SIZE_CHANGE, std::to_string(buttonsize));
controlButtonsNode->FireCustomCallback(EVENT_NAME_COLOR_CONFIGURATION_LOCKED, std::to_string(colorMode));
+ if (colorMode != static_cast<int32_t>(ColorMode::DARK) && colorMode != static_cast<int32_t>(ColorMode::LIGHT)) {
+ containerPattern->SetColorConfigurationUpdate();
+ }
controlButtonsNode->FireCustomCallback(EVENT_NAME_BUTTON_RIGHT_OFFSET_CHANGE,
std::to_string(closeButtonRightMargin));
- CallButtonsRectChange();
+ containerPattern->CallButtonsRectChange();
}
void ContainerModalPatternEnhance::UpdateTitleInTargetPos(bool isShow, int32_t height)
diff --git a/frameworks/core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.h b/frameworks/core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.h
index e5b1f1f6a2..0b0a3cbab1 100755
--- a/frameworks/core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.h
+++ b/frameworks/core/components_ng/pattern/container_modal/enhance/container_modal_pattern_enhance.h
@@ -64,8 +64,8 @@ public:
CalcLength GetControlButtonRowWidth() override;
bool GetContainerModalButtonsRect(RectF& containerModal, RectF& buttons) override;
bool GetContainerModalComponentRect(RectF& containerModal, RectF& buttons);
- void SetContainerButtonStyle(uint32_t buttonsize, uint32_t spacingBetweenButtons,
- uint32_t closeButtonRightMargin, int32_t colorMode) override;
+ static void SetContainerButtonStyle(RefPtr<PipelineContext> pipeline, uint32_t buttonsize,
+ uint32_t spacingBetweenButtons, uint32_t closeButtonRightMargin, int32_t colorMode)
void OnMaxButtonClick();
void OnMinButtonClick();
void OnCloseButtonClick();
diff --git a/frameworks/core/components_ng/pattern/container_modal/interfaces/customtitle.js b/frameworks/core/components_ng/pattern/container_modal/interfaces/customtitle.js
index 94baa9ee77..79ceb7e659 100644
--- a/frameworks/core/components_ng/pattern/container_modal/interfaces/customtitle.js
+++ b/frameworks/core/components_ng/pattern/container_modal/interfaces/customtitle.js
@@ -826,6 +826,7 @@ export class v1 extends ViewPU {
}
onMaximizeButtonClick() {
this.onCancelMenuTimer();
+ callbati
}
onMinimizeButtonClick() {
}
diff --git a/frameworks/core/pipeline/pipeline_base.h b/frameworks/core/pipeline/pipeline_base.h
index 3206f856d6..544fecc311 100644
--- a/frameworks/core/pipeline/pipeline_base.h
+++ b/frameworks/core/pipeline/pipeline_base.h
@@ -386,9 +386,6 @@ public:
virtual void SetContainerButtonHide(bool hideSplit, bool hideMaximize, bool hideMinimize, bool hideClose) {}
- virtual void SetContainerButtonStyle(uint32_t buttonsize, uint32_t spacingBetweenButtons,
- uint32_t closeButtonRightMargin, int32_t colorMode){};
-
virtual void EnableContainerModalGesture(bool isEnable) {}
virtual bool GetContainerFloatingTitleVisible()
diff --git a/frameworks/core/pipeline_ng/pipeline_context.cpp b/frameworks/core/pipeline_ng/pipeline_context.cpp
index 43ac14d4e6..e334e99164 100644
--- a/frameworks/core/pipeline_ng/pipeline_context.cpp
+++ b/frameworks/core/pipeline_ng/pipeline_context.cpp
@@ -4693,21 +4693,6 @@ void PipelineContext::SetContainerModalTitleHeight(int32_t height)
containerPattern->SetContainerModalTitleHeight(height);
}
-void PipelineContext::SetContainerButtonStyle(uint32_t buttonsize, uint32_t spacingBetweenButtons,
- uint32_t closeButtonRightMargin, int32_t isDarkMode)
-{
- if (windowModal_ != WindowModal::CONTAINER_MODAL) {
- LOGW("Set container button style failed, Window modal is not container.");
- return;
- }
- CHECK_NULL_VOID(rootNode_);
- auto containerNode = AceType::DynamicCast<FrameNode>(rootNode_->GetChildren().front());
- CHECK_NULL_VOID(containerNode);
- auto containerPattern = containerNode->GetPattern<ContainerModalPattern>();
- CHECK_NULL_VOID(containerPattern);
- containerPattern->SetContainerButtonStyle(buttonsize, spacingBetweenButtons, closeButtonRightMargin, isDarkMode);
-}
-
int32_t PipelineContext::GetContainerModalTitleHeight()
{
if (windowModal_ != WindowModal::CONTAINER_MODAL) {
diff --git a/frameworks/core/pipeline_ng/pipeline_context.h b/frameworks/core/pipeline_ng/pipeline_context.h
index 5b0f2195d7..2118423f95 100644
--- a/frameworks/core/pipeline_ng/pipeline_context.h
+++ b/frameworks/core/pipeline_ng/pipeline_context.h
@@ -789,8 +789,6 @@ public:
void SetContainerModalTitleVisible(bool customTitleSettedShow, bool floatingTitleSettedShow);
void SetContainerModalTitleHeight(int32_t height);
- virtual void SetContainerButtonStyle(uint32_t buttonsize, uint32_t spacingBetweenButtons,
- uint32_t closeButtonRightMargin, int32_t isDarkMode) override;
int32_t GetContainerModalTitleHeight();
bool GetContainerModalButtonsRect(RectF& containerModal, RectF& buttons);
void SubscribeContainerModalButtonsRectChange(
diff --git a/interfaces/inner_api/ace/ui_content.h b/interfaces/inner_api/ace/ui_content.h
index 3fa89e5efd..3a34b0e63b 100644
--- a/interfaces/inner_api/ace/ui_content.h
+++ b/interfaces/inner_api/ace/ui_content.h
@@ -307,8 +307,6 @@ public:
virtual void SetContainerModalTitleHeight(int height) {}
- virtual void SetContainerButtonStyle(const Rosen::DecorButtonStyle& decorButtonStyle) {}
-
virtual int32_t GetContainerModalTitleHeight()
{
return -1;
@@ -463,6 +461,8 @@ public:
virtual void OnContainerModalEvent(const std::string& name, const std::string& value) {}
virtual void UpdateConfigurationSyncForAll(const std::shared_ptr<OHOS::AppExecFwk::Configuration>& config) {}
+
+ virtual void SetContainerButtonStyle(const Rosen::DecorButtonStyle& decorButtonStyle) {}
};
} // namespace OHOS::Ace
diff --git a/test/mock/core/pipeline/mock_pipeline_context.cpp b/test/mock/core/pipeline/mock_pipeline_context.cpp
index f516106c09..c1a7f42947 100644
--- a/test/mock/core/pipeline/mock_pipeline_context.cpp
+++ b/test/mock/core/pipeline/mock_pipeline_context.cpp
@@ -491,9 +491,6 @@ void PipelineContext::FlushReload(const ConfigurationChange& configurationChange
void PipelineContext::SetContainerButtonHide(bool hideSplit, bool hideMaximize, bool hideMinimize, bool hideClose) {}
-void PipelineContext::SetContainerButtonStyle(uint32_t buttonsize, uint32_t spacingBetweenButtons,
- uint32_t closeButtonRightMargin, int32_t isDarkMode) {}
-
void PipelineContext::AddAnimationClosure(std::function<void()>&& animation) {}
void PipelineContext::SetCloseButtonStatus(bool isEnabled) {}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cllily/arkui_ace_engine.git
git@gitee.com:cllily/arkui_ace_engine.git
cllily
arkui_ace_engine
arkui_ace_engine
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385