add isDecorEnable to prop

Signed-off-by: leafly2021 <figo.yefei@huawei.com>
Change-Id: I301c36b4d986c57d68c441e10e2916d893253646
This commit is contained in:
leafly2021
2022-01-21 13:05:54 +08:00
parent 4fab00f438
commit 39c5cecb5a
5 changed files with 25 additions and 7 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ public:
NativeValue* storage, bool isdistributed = false) = 0;
virtual const std::string& GetContentInfo() = 0;
virtual bool IsDecorEnable() = 0;
virtual bool IsDecorEnable() const = 0;
virtual WMError Maximize() = 0;
virtual WMError Minimize() = 0;
virtual WMError Recover() = 0;
+3
View File
@@ -44,6 +44,7 @@ public:
void SetParentId(uint32_t parentId);
void SetWindowFlags(uint32_t flags);
void SetSystemBarProperty(WindowType type, const SystemBarProperty& state);
void SetDecorEnable(bool decorEnable);
Rect GetWindowRect() const;
WindowType GetWindowType() const;
@@ -59,6 +60,7 @@ public:
uint32_t GetParentId() const;
uint32_t GetWindowFlags() const;
const std::unordered_map<WindowType, SystemBarProperty>& GetSystemBarProperty() const;
bool GetDecorEnable() const;
virtual bool Marshalling(Parcel& parcel) const override;
static sptr<WindowProperty> Unmarshalling(Parcel& parcel);
@@ -81,6 +83,7 @@ private:
{ WindowType::WINDOW_TYPE_STATUS_BAR, SystemBarProperty() },
{ WindowType::WINDOW_TYPE_NAVIGATION_BAR, SystemBarProperty() },
};
bool isDecorEnable_ { false };
bool MapMarshalling(Parcel& parcel) const;
static void MapUnmarshalling(Parcel& parcel, sptr<WindowProperty>& property);
};
+16
View File
@@ -86,6 +86,11 @@ void WindowProperty::SetSystemBarProperty(WindowType type, const SystemBarProper
}
}
void WindowProperty::SetDecorEnable(bool decorEnable)
{
isDecorEnable_ = decorEnable;
}
void WindowProperty::ResumeLastWindowMode()
{
mode_ = lastMode_;
@@ -151,6 +156,11 @@ const std::unordered_map<WindowType, SystemBarProperty>& WindowProperty::GetSyst
return sysBarPropMap_;
}
bool WindowProperty::GetDecorEnable() const
{
return isDecorEnable_;
}
// TODO
void WindowProperty::SetWindowId(uint32_t windowId)
{
@@ -272,6 +282,11 @@ bool WindowProperty::Marshalling(Parcel& parcel) const
if (!MapMarshalling(parcel)) {
return false;
}
// write isDecorEnable_
if (!parcel.WriteBool(isDecorEnable_)) {
return false;
}
return true;
}
@@ -293,6 +308,7 @@ sptr<WindowProperty> WindowProperty::Unmarshalling(Parcel& parcel)
property->SetWindowId(parcel.ReadUint32());
property->SetParentId(parcel.ReadUint32());
MapUnmarshalling(parcel, property);
property->SetDecorEnable(parcel.ReadBool());
return property;
}
}
+1 -2
View File
@@ -69,7 +69,7 @@ public:
virtual WMError MoveTo(int32_t x, int32_t y) override;
virtual WMError Resize(uint32_t width, uint32_t height) override;
virtual bool IsDecorEnable() override;
virtual bool IsDecorEnable() const override;
virtual WMError Maximize() override;
virtual WMError Minimize() override;
virtual WMError Recover() override;
@@ -147,7 +147,6 @@ private:
std::unique_ptr<Ace::UIContent> uiContent_;
std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext_; // give up when context offer getToken
std::shared_ptr<AbilityRuntime::Context> context_;
bool isDecorEnable_ = false;
const float STATUS_BAR_RATIO = 0.07;
const float NAVIGATION_BAR_RATIO = 0.07;
const float SYSTEM_ALARM_WINDOW_WIDTH_RATIO = 0.8;
+4 -4
View File
@@ -218,9 +218,9 @@ WMError WindowImpl::SetUIContent(const std::string& contentInfo,
return WMError::WM_ERROR_NULLPTR;
}
if (WindowHelper::IsMainWindow(property_->GetWindowType())) {
isDecorEnable_ = true;
property_->SetDecorEnable(true);
} else {
isDecorEnable_ = false;
property_->SetDecorEnable(false);
}
if (isdistributed) {
uiContent_->Restore(this, contentInfo, storage);
@@ -426,9 +426,9 @@ WMError WindowImpl::Resize(uint32_t width, uint32_t height)
return SingletonContainer::Get<WindowAdapter>().Resize(property_->GetWindowId(), width, height);
}
bool WindowImpl::IsDecorEnable()
bool WindowImpl::IsDecorEnable() const
{
return isDecorEnable_;
return property_->GetDecorEnable();
}
WMError WindowImpl::Maximize()