mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 01:03:08 +00:00
toggle
Signed-off-by: sunfei <sunfei.sun@huawei.com> Change-Id: Ia497a9078b89bfa3207a5bbc1d2533348329e1de
This commit is contained in:
parent
b5ed05a51b
commit
798d1068bc
@ -25,8 +25,9 @@ namespace OHOS::Ace::V2 {
|
||||
namespace {
|
||||
|
||||
const std::unordered_map<std::string, std::function<std::string(const CheckboxComposedElement&)>> CREATE_JSON_MAP {
|
||||
{ "ison", [](const CheckboxComposedElement& inspector) { return inspector.GetChecked(); } },
|
||||
{ "selectedColor", [](const CheckboxComposedElement& inspector) { return inspector.GetSelectedColor(); } }
|
||||
{ "isOn", [](const CheckboxComposedElement& inspector) { return inspector.GetChecked(); } },
|
||||
{ "selectedColor", [](const CheckboxComposedElement& inspector) { return inspector.GetSelectedColor(); } },
|
||||
{ "type", [](const CheckboxComposedElement& inspector) { return inspector.GetToggleType(); } }
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@ -34,8 +35,9 @@ const std::unordered_map<std::string, std::function<std::string(const CheckboxCo
|
||||
void CheckboxComposedElement::Dump()
|
||||
{
|
||||
InspectorComposedElement::Dump();
|
||||
DumpLog::GetInstance().AddDesc(std::string("ison: ").append(GetChecked()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("isOn: ").append(GetChecked()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("selectedColor: ").append(GetSelectedColor()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("type: ").append(GetToggleType()));
|
||||
}
|
||||
|
||||
std::unique_ptr<JsonValue> CheckboxComposedElement::ToJsonObject() const
|
||||
@ -54,6 +56,11 @@ std::string CheckboxComposedElement::GetChecked() const
|
||||
return ConvertBoolToString(checked);
|
||||
}
|
||||
|
||||
std::string CheckboxComposedElement::GetToggleType() const
|
||||
{
|
||||
return std::string("ToggleType.Checkbox");
|
||||
}
|
||||
|
||||
std::string CheckboxComposedElement::GetSelectedColor() const
|
||||
{
|
||||
auto renderCheckbox = GetRenderCheckbox();
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
std::unique_ptr<JsonValue> ToJsonObject() const override;
|
||||
std::string GetChecked() const;
|
||||
std::string GetSelectedColor() const;
|
||||
std::string GetToggleType() const;
|
||||
|
||||
AceType::IdType GetTargetTypeId() const override
|
||||
{
|
||||
|
@ -25,9 +25,10 @@ namespace OHOS::Ace::V2 {
|
||||
namespace {
|
||||
|
||||
const std::unordered_map<std::string, std::function<std::string(const SwitchComposedElement&)>> CREATE_JSON_MAP {
|
||||
{ "ison", [](const SwitchComposedElement& inspector) { return inspector.GetChecked(); } },
|
||||
{ "isOn", [](const SwitchComposedElement& inspector) { return inspector.GetChecked(); } },
|
||||
{ "SelectedColor", [](const SwitchComposedElement& inspector) { return inspector.GetSelectedColor(); } },
|
||||
{ "PointColor", [](const SwitchComposedElement& inspector) { return inspector.GetPointColor(); } }
|
||||
{ "switchPointColor", [](const SwitchComposedElement& inspector) { return inspector.GetPointColor(); } },
|
||||
{ "type", [](const SwitchComposedElement& inspector) { return inspector.GetToggleType(); } }
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@ -35,9 +36,10 @@ const std::unordered_map<std::string, std::function<std::string(const SwitchComp
|
||||
void SwitchComposedElement::Dump()
|
||||
{
|
||||
InspectorComposedElement::Dump();
|
||||
DumpLog::GetInstance().AddDesc(std::string("ison: ").append(GetChecked()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("isOn: ").append(GetChecked()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("SelectedColor: ").append(GetSelectedColor()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("PointColor: ").append(GetPointColor()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("switchPointColor: ").append(GetPointColor()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("type: ").append(GetToggleType()));
|
||||
}
|
||||
|
||||
std::unique_ptr<JsonValue> SwitchComposedElement::ToJsonObject() const
|
||||
@ -56,6 +58,11 @@ std::string SwitchComposedElement::GetChecked() const
|
||||
return ConvertBoolToString(checked);
|
||||
}
|
||||
|
||||
std::string SwitchComposedElement::GetToggleType() const
|
||||
{
|
||||
return std::string("ToggleType.Switch");
|
||||
}
|
||||
|
||||
std::string SwitchComposedElement::GetSelectedColor() const
|
||||
{
|
||||
auto renderSwitch = GetRenderSwitch();
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
std::string GetChecked() const;
|
||||
std::string GetSelectedColor() const;
|
||||
std::string GetPointColor() const;
|
||||
std::string GetToggleType() const;
|
||||
|
||||
AceType::IdType GetTargetTypeId() const override
|
||||
{
|
||||
|
@ -25,8 +25,9 @@ namespace OHOS::Ace::V2 {
|
||||
namespace {
|
||||
|
||||
const std::unordered_map<std::string, std::function<std::string(const ToggleComposedElement&)>> CREATE_JSON_MAP {
|
||||
{ "ison", [](const ToggleComposedElement& inspector) { return inspector.GetChecked(); } },
|
||||
{ "selectedColor", [](const ToggleComposedElement& inspector) { return inspector.GetSelectedColor(); } }
|
||||
{ "isOn", [](const ToggleComposedElement& inspector) { return inspector.GetChecked(); } },
|
||||
{ "selectedColor", [](const ToggleComposedElement& inspector) { return inspector.GetSelectedColor(); } },
|
||||
{ "type", [](const ToggleComposedElement& inspector) { return inspector.GetToggleType(); } }
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@ -34,8 +35,9 @@ const std::unordered_map<std::string, std::function<std::string(const ToggleComp
|
||||
void ToggleComposedElement::Dump()
|
||||
{
|
||||
InspectorComposedElement::Dump();
|
||||
DumpLog::GetInstance().AddDesc(std::string("ison: ").append(GetChecked()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("isOn: ").append(GetChecked()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("selectedColor: ").append(GetSelectedColor()));
|
||||
DumpLog::GetInstance().AddDesc(std::string("type: ").append(GetToggleType()));
|
||||
}
|
||||
|
||||
std::unique_ptr<JsonValue> ToggleComposedElement::ToJsonObject() const
|
||||
@ -54,6 +56,11 @@ std::string ToggleComposedElement::GetChecked() const
|
||||
return ConvertBoolToString(checked);
|
||||
}
|
||||
|
||||
std::string ToggleComposedElement::GetToggleType() const
|
||||
{
|
||||
return std::string("ToggleType.Button");
|
||||
}
|
||||
|
||||
std::string ToggleComposedElement::GetSelectedColor() const
|
||||
{
|
||||
auto renderToggle = GetRenderToggle();
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
|
||||
std::string GetChecked() const;
|
||||
std::string GetSelectedColor() const;
|
||||
std::string GetToggleType() const;
|
||||
|
||||
AceType::IdType GetTargetTypeId() const override
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user