X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftable-view%2Ftable-view-impl.cpp;h=686c1ca5b675b83d86f2546a2b2c8d3101251244;hb=HEAD;hp=2afc0dafdeb91caeff7976c6d6363116d84b58d2;hpb=3d401611b65960abbe496c53bdb8c952ca218b0a;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp index 2afc0da..686c1ca 100644 --- a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp +++ b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ bool FitToChild(Actor actor, Dimension::Type dimension) // currently not called from code so compiler will optimize these away, kept here for future debugging #define TABLEVIEW_TAG "DALI Toolkit::TableView " -#define TV_LOG(fmt, args, ...) Debug::LogMessageWithFunctionLine(Debug::DebugInfo, TABLEVIEW_TAG fmt, ##args) +#define TV_LOG(fmt, args, ...) Debug::LogMessageWithFunctionLine(Debug::INFO, TABLEVIEW_TAG fmt, ##args) //#define TABLEVIEW_DEBUG 1 #if defined(TABLEVIEW_DEBUG) @@ -1224,31 +1224,50 @@ void TableView::SetHeightOrWidthProperty(TableView& tableViewImpl, std::istringstream(map->GetKey(i)) >> index; if(childMap) { - Property::Value* policy = childMap->Find("policy"); - Property::Value* childMapValue = childMap->Find("value"); - if(policy && childMapValue) + Property::Value* policy = childMap->Find("policy"); + if(policy) { std::string policyValue; - policy->Get(policyValue); - Toolkit::TableView::LayoutPolicy policy; - if(Scripting::GetEnumeration(policyValue.c_str(), - LAYOUT_POLICY_STRING_TABLE, - LAYOUT_POLICY_STRING_TABLE_COUNT, - policy)) + if(DALI_LIKELY(policy->Get(policyValue))) { - if(policy == Toolkit::TableView::FIXED) + Toolkit::TableView::LayoutPolicy policy; + if(Scripting::GetEnumeration(policyValue.c_str(), + LAYOUT_POLICY_STRING_TABLE, + LAYOUT_POLICY_STRING_TABLE_COUNT, + policy)) { - (tableViewImpl.*funcFixed)(index, childMapValue->Get()); - } - else if(policy == Toolkit::TableView::RELATIVE) - { - (tableViewImpl.*funcRelative)(index, childMapValue->Get()); - } - else if(policy == Toolkit::TableView::FIT) - { - (tableViewImpl.*funcFit)(index); + switch(policy) + { + case Toolkit::TableView::FIXED: + case Toolkit::TableView::RELATIVE: + { + Property::Value* childMapValue = childMap->Find("value"); + float childValue = 0.0f; + if(DALI_LIKELY(childMapValue && childMapValue->Get(childValue))) + { + if(policy == Toolkit::TableView::FIXED) + { + (tableViewImpl.*funcFixed)(index, childValue); + } + else // if(policy == Toolkit::TableView::RELATIVE) + { + (tableViewImpl.*funcRelative)(index, childValue); + } + } + break; + } + case Toolkit::TableView::FIT: + { + (tableViewImpl.*funcFit)(index); + break; + } + default: + { + // do nothing for FILL policy + break; + } + } } - // do nothing for FILL policy } } }