+void
+_Control::PrintBacktrace(bool printChildren, bool newBacktrace)
+{
+ int count = PrintBacktrace(printChildren, 0, newBacktrace);
+
+ SysSecureLog(NID_UI, "%d controls were printed.", count);
+}
+
+int
+_Control::PrintBacktrace(bool printChildren, int depth, bool newBacktrace)
+{
+ String indent(L"");
+ String format(L"");
+
+ format.Format(LOG_LEN_MAX, L"%d", depth);
+
+ for (int i = 0; i < depth; i++)
+ {
+ indent.Append(L" ");
+ }
+
+ indent.Append(format);
+
+ String delimiter(L"-------------------------------------------------------------------------------------------");
+ SysSecureLog(NID_UI, "%ls", delimiter.GetPointer());
+
+ SysSecureLog(NID_UI, "%ls 0x%x(%d %ls)", indent.GetPointer(), this, __controlHandle.ToInt(), GetName().GetPointer());
+
+ Tizen::Base::Collection::ArrayListT<void*>* pBacktraceList = null;
+
+ if (newBacktrace)
+ {
+ pBacktraceList = __pNewBacktrace.get();
+ }
+ else
+ {
+ pBacktraceList = __pDeleteBacktrace.get();
+ }
+
+ SysTryReturn(NID_UI, pBacktraceList, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ int backtraceCount = pBacktraceList->GetCount();
+ SysTryReturn(NID_UI, backtraceCount > 0, 0, E_INVALID_ARG, "[E_INVALID_ARG].");
+
+ void** pBacktrace = new (std::nothrow) void*[backtraceCount];
+ SysTryReturn(NID_UI, pBacktrace, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ unique_ptr<IEnumeratorT<void*> > pEnumerator(pBacktraceList->GetEnumeratorN());
+ SysTryReturn(NID_UI, pEnumerator, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ int i = 0;
+ while (pEnumerator->MoveNext() == E_SUCCESS)
+ {
+ void* pAddr = null;
+ pEnumerator->GetCurrent(pAddr);
+
+ pBacktrace[i++] = pAddr;
+ }
+
+ char** pSymbols = backtrace_symbols(pBacktrace, backtraceCount);
+ SysTryReturn(NID_UI, pSymbols, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ for (int j = 0; j < backtraceCount; j++)
+ {
+ SysSecureLog(NID_UI, "%ls [%s]", indent.GetPointer(), pSymbols[j]);
+ }
+
+ free(pSymbols);
+ delete [] pBacktrace;
+
+ static int totalCount = 0;
+
+ if (depth == 0)
+ {
+ totalCount = 0;
+ }
+
+ if (printChildren)
+ {
+ depth ++;
+
+ int count = GetChildCount();
+ totalCount += count;
+
+ for (int i = count - 1; i >= 0; --i)
+ {
+ _Control* pChild = GetChild(i);
+ if (pChild)
+ {
+ pChild->PrintBacktrace(printChildren, depth, newBacktrace);
+ }
+ }
+ }
+
+ return totalCount;
+}
+
+void
+_Control::DragAndDropBegin(const _DragAndDropItem& dragAndDropItem)
+{
+ _Window* pRootWindow = GetRootWindow();
+ if (!pRootWindow)
+ {
+ return;
+ }
+
+ __isDragAndDropSource = true;
+
+ _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
+ if (!pEcoreEvas)
+ {
+ return;
+ }
+
+ pEcoreEvas->SetDragAndDropState(true);
+ pEcoreEvas->DragAndDropBegin(*pRootWindow, dragAndDropItem.GetData());
+
+ __pDragWindow = GetControlDelegate().OnDragAndDropBeginning();
+}
+
+void
+_Control::DragAndDropDrop(void)
+{
+ _Window* pRootWindow = GetRootWindow();
+ if (!pRootWindow)
+ {
+ return;
+ }
+
+ _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
+ pEcoreEvas->DragAndDropDrop(*pRootWindow);
+
+ GetControlDelegate().OnDragAndDropDropping();
+
+ // Check self drop.
+ Point dropPosition = pEcoreEvas->GetDropPosition();
+ Rectangle bounds = GetRootWindow()->GetBounds();
+ if (bounds.Contains(dropPosition))
+ {
+ _Control* pDropControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(dropPosition, true);
+ if (pDropControl)
+ {
+// Send dnd events to Source.
+#if 0
+ if (pDropControl->IsDragAndDropSource() == false)
+#endif
+ {
+ int pid = pEcoreEvas->GetProcessId(pRootWindow->GetNativeHandle());
+ String dropData = pEcoreEvas->GetDropData();
+ SysLog(NID_UI, "[DND][S:%d] Call OnDragAndDropDropped(%ls) => %ls.", pid, dropData.GetPointer(), pDropControl->GetName().GetPointer());
+ _DragAndDropItem* pDragAndDropItem = _DragAndDropItem::CreateInstanceN(_DRAG_AND_DROP_TYPE_TEXT, dropData);
+ pDropControl->GetControlDelegate().OnDragAndDropDropped(*pDragAndDropItem);
+ delete pDragAndDropItem;
+ }
+ }
+ }
+
+ __isDragAndDropSource = false;
+}
+
+_Window*
+_Control::GetDragWindow(void) const
+{
+ return __pDragWindow;
+}
+
+bool
+_Control::IsDragAndDropSource(void) const
+{
+ return __isDragAndDropSource;
+}
+
+_Window*
+_Control::OnDragAndDropBeginning(void)
+{
+ return null;
+}
+
+void
+_Control::OnDragAndDropDropping(void)
+{
+}
+
+void
+_Control::OnDragAndDropEntered(void)
+{
+}
+
+void
+_Control::OnDragAndDropMoved(const FloatPoint& position)
+{
+}
+
+void
+_Control::OnDragAndDropLeft(void)
+{
+}
+
+void
+_Control::OnDragAndDropDropped(const _DragAndDropItem& dragAndDropItem)
+{
+}
+