/*
- * 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.
#include <sstream>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
using namespace Dali;
// 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::LogMessage(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)
self.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
SetAsKeyboardFocusGroup(true);
- DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
- return std::unique_ptr<Dali::Accessibility::Accessible>(
- new Control::Impl::AccessibleImpl(actor, Dali::Accessibility::Role::TABLE));
- });
+ self.SetProperty(DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::TABLE);
}
void TableView::ResizeContainers(unsigned int rows, unsigned int columns)
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<Toolkit::TableView::LayoutPolicy>(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<Toolkit::TableView::LayoutPolicy>(policyValue.c_str(),
+ LAYOUT_POLICY_STRING_TABLE,
+ LAYOUT_POLICY_STRING_TABLE_COUNT,
+ policy))
{
- (tableViewImpl.*funcFixed)(index, childMapValue->Get<float>());
- }
- else if(policy == Toolkit::TableView::RELATIVE)
- {
- (tableViewImpl.*funcRelative)(index, childMapValue->Get<float>());
- }
- 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
}
}
}