#include <FBase_Log.h>
#include <FGrp_BitmapImpl.h>
#include <FSys_SystemInfoImpl.h>
+#include "FUi_Math.h"
#include "FUi_Control.h"
#include "FUi_ControlManager.h"
#include "FUi_FocusManagerImpl.h"
#include "FUiCtrl_Form.h"
#include "FUiCtrl_Frame.h"
#include "FUi_ContainerImpl.h"
+#include "FUi_DragAndDropItem.h"
+#include "FUi_UiEventManager.h"
using namespace std;
using namespace Tizen::Base;
FloatDimension GetItemContentSize(bool horizontalMode, bool verticalMode) const
{
- return __pControl->GetControlDelegate().GetContentSizeF(horizontalMode, verticalMode);
+ FloatRectangle rect = __pControl->GetContentAreaBoundsF();
+ if (rect == FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
+ {
+ return __pControl->GetControlDelegate().GetContentSizeF(horizontalMode, verticalMode);
+ }
+ else
+ {
+ return FloatDimension(rect.width, rect.height);
+ }
}
FloatDimension GetItemMinimumSize(void) const
{
SysLog(NID_UI, "VisibleState changed false, Call SetTouchCanceled");
pTouchManager->SetTouchCanceled(null);
+
+ _UiEventManager* pUiEventManager = _UiEventManager::GetInstance();
+ if (pUiEventManager)
+ {
+ pUiEventManager->ClearEventQueue();
+ }
}
}
}
}
void
-_Control::ChangeLayout(_ControlOrientation orientation, bool callRotation)
+_Control::ChangeLayout(_Control& control, _ControlOrientation orientation)
{
- ClearLastResult();
-
- struct _Visitor
- : public Visitor
+ if (control.__orientation != orientation)
{
- _Visitor(_ControlOrientation orientation)
- : __orientation(orientation){}
+ control.__orientation = orientation;
+ control.GetControlDelegate().OnChangeLayout(orientation);
+ }
- virtual VisitType Visit(_Control& control)
+ for (int i = 0; i < control.GetChildCount(); ++i)
+ {
+ _Control* pChild = control.GetChild(i);
+ if (pChild)
{
- if (control.__orientation != __orientation)
- {
- control.__orientation = __orientation;
- control.GetControlDelegate().OnChangeLayout(__orientation);
- ClearLastResult();
- }
-
- return VISIT_DOWNWARD;
+ ChangeLayout(*pChild, orientation);
}
+ }
+}
-private:
- _ControlOrientation __orientation;
- };
-
- _Visitor visitor(orientation);
- Accept(visitor);
-
- SysAssert(GetLastResult() == E_SUCCESS);
+void
+_Control::ChangeLayout(_ControlOrientation orientation, bool callRotation)
+{
+ ClearLastResult();
+ ChangeLayout(*this, orientation);
if (callRotation == true)
{
}
void
-_Control::ChangeLayout(_ControlRotation rotation)
+_Control::ChangeLayout(_Control& control, _ControlRotation rotation)
{
- ClearLastResult();
-
- struct _Visitor
- : public Visitor
+ if (control.__rotation != rotation)
{
- _Visitor(_ControlRotation rotation)
- : __rotation(rotation){}
+ control.__rotation = rotation;
+ control.GetControlDelegate().OnChangeLayout(rotation);
+ ClearLastResult();
+ }
- virtual VisitType Visit(_Control& control)
+ for (int i = 0; i < control.GetChildCount(); ++i)
+ {
+ _Control* pChild = control.GetChild(i);
+ if (pChild)
{
- if (control.__rotation != __rotation)
- {
- control.__rotation = __rotation;
- control.GetControlDelegate().OnChangeLayout(__rotation);
- ClearLastResult();
- }
-
- return VISIT_DOWNWARD;
+ ChangeLayout(*pChild, rotation);
}
+ }
+}
-private:
- _ControlRotation __rotation;
- };
-
- _Visitor visitor(rotation);
- Accept(visitor);
-
- SysAssert(GetLastResult() == E_SUCCESS);
+void
+_Control::ChangeLayout(_ControlRotation rotation)
+{
+ ClearLastResult();
+ ChangeLayout(*this, rotation);
}
bool
SysAssert(r == E_SUCCESS); // [ToDo] Exception check and rollback.
r = EndAttaching(child);
- if (IsFailed(r))
- {
- result listResult = children.Remove(&child);
- if (IsFailed(listResult))
- {
- SysLogException(NID_UI, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Unable to find the specified child.");
- }
- return r;
- }
+ SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] propagated.", GetErrorMessage(r));
SysAssert(GetLastResult() == E_SUCCESS);
}
void
-_Control::CallOnAncestorVisibleStateChanged(void)
+_Control::CallOnAncestorVisibleStateChanged(_Control& control)
{
- struct _Visitor
- : public Visitor
- {
- _Visitor(_Control& parent)
- : __parent(parent){}
+ control.GetControlDelegate().OnAncestorVisibleStateChanged(*this);
- virtual VisitType Visit(_Control& control)
+ for (int i = 0; i < control.GetChildCount(); ++i)
+ {
+ _Control* pChild = control.GetChild(i);
+ if (pChild)
{
- control.GetControlDelegate().OnAncestorVisibleStateChanged(__parent);
- return VISIT_DOWNWARD;
+ CallOnAncestorVisibleStateChanged(*pChild);
}
-
- _Control& __parent;
- };
-
- _Visitor visitor(*this);
- Accept(visitor);
+ }
}
void
-_Control::CallOnAncestorEnableStateChanged(void)
+_Control::CallOnAncestorEnableStateChanged(_Control& control)
{
- struct _Visitor
- : public Visitor
- {
- _Visitor(_Control& parent)
- : __parent(parent){}
+ control.GetControlDelegate().OnAncestorEnableStateChanged(*this);
- virtual VisitType Visit(_Control& control)
+ for (int i = 0; i < control.GetChildCount(); ++i)
+ {
+ _Control* pChild = control.GetChild(i);
+ if (pChild)
{
- control.GetControlDelegate().OnAncestorEnableStateChanged(__parent);
- return VISIT_DOWNWARD;
+ CallOnAncestorEnableStateChanged(*pChild);
}
-
- _Control& __parent;
- };
-
- _Visitor visitor(*this);
- Accept(visitor);
+ }
}
void
-_Control::CallOnAncestorInputEnableStateChanged(void)
+_Control::CallOnAncestorInputEnableStateChanged(_Control& control)
{
- struct _Visitor
- : public Visitor
- {
- _Visitor(_Control& parent)
- : __parent(parent){}
+ control.GetControlDelegate().OnAncestorInputEnableStateChanged(*this);
- virtual VisitType Visit(_Control& control)
+ for (int i = 0; i < control.GetChildCount(); ++i)
+ {
+ _Control* pChild = control.GetChild(i);
+ if (pChild)
{
- control.GetControlDelegate().OnAncestorInputEnableStateChanged(__parent);
- return VISIT_DOWNWARD;
+ CallOnAncestorInputEnableStateChanged(*pChild);
}
-
- _Control& __parent;
- };
-
- _Visitor visitor(*this);
- Accept(visitor);
+ }
}
// E_INVALID_ARG
_Control::EndAttaching(_Control& child)
{
child.SetParent(this);
- child.InvalidateHierarchyRootWindow(*this);
- child.InvalidateHierarchyAbsoluteBounds(*this);
+ InvalidateHierarchyRootWindow(child);
+ InvalidateHierarchyAbsoluteBounds(child);
FloatRectangle floatBounds(child.GetBoundsF().x, child.GetBoundsF().y, child.GetBoundsF().width, child.GetBoundsF().height);
r = GetVisualElement()->AttachChild(*child.GetVisualElement());
r = EndAttaching(child);
- if (IsFailed(r))
- {
- result listResult = children.Remove(&child);
- if (IsFailed(listResult))
- {
- SysLogException(NID_UI, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Unable to find the specified child.");
- }
- return r;
- }
+ SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] propagated.", GetErrorMessage(r));
SysAssert(GetLastResult() == E_SUCCESS);
UpdateFocusList();
void
_Control::SetFocusNavigateEnabled(bool enable)
{
- __isNavigatable = enable;
+ __isNavigatable = enable;
}
bool
SysAssert(r == E_SUCCESS); // [ToDo] Exception check and rollback.
r = EndAttaching(child);
- if (IsFailed(r))
- {
- result listResult = children.Remove(&child);
- if (IsFailed(listResult))
- {
- SysLogException(NID_UI, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Unable to find the specified child.");
- }
- return r;
- }
+ SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] propagated.", GetErrorMessage(r));
SysAssert(GetLastResult() == E_SUCCESS);
return E_SUCCESS;
SysAssert(r == E_SUCCESS); // [ToDo] Exception check and rollback.
r = EndAttaching(child);
- if (IsFailed(r))
- {
- result listResult = children.Remove(&child);
- if (IsFailed(listResult))
- {
- SysLogException(NID_UI, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Unable to find the specified child.");
- }
- return r;
- }
+ SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] propagated.", GetErrorMessage(r));
SysAssert(GetLastResult() == E_SUCCESS);
return E_SUCCESS;
SysAssert(r == E_SUCCESS); // [ToDo] Exception check and rollback.
r = EndAttaching(child);
- if (IsFailed(r))
- {
- result listResult = children.Remove(&child);
- if (IsFailed(listResult))
- {
- SysLogException(NID_UI, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Unable to find the specified child.");
- }
- return r;
- }
+ SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] propagated.", GetErrorMessage(r));
SysAssert(GetLastResult() == E_SUCCESS);
return E_SUCCESS;
SysAssert(GetLastResult() == E_SUCCESS);
UpdateFocusList();
- child.InvalidateHierarchyRootWindow(*this);
+ InvalidateHierarchyRootWindow(child);
return E_SUCCESS;
}
_Control::IsAncestorOf(const _Control& control) const
{
ClearLastResult();
+ return IsAncestorOf(control, *this);
+}
+bool
+_Control::IsAncestorOf(const _Control& control, const _Control& ancestor) const
+{
const _Control* pParent = control.GetParent();
- if (!pParent)
- {
- return false;
- }
-
- struct _Visitor
- : public Visitor
+ if (pParent)
{
-private:
- const _Control& __ancestor;
-
-public:
- bool yes;
-
- _Visitor(const _Control& ancestor)
- : __ancestor(ancestor)
- , yes(false){}
-
- virtual VisitType Visit(_Control& control)
+ if (pParent == &ancestor)
{
- if (&__ancestor == &control)
- {
- yes = true;
- return VISIT_STOP;
- }
- else
- {
- return VISIT_UPWARD;
- }
+ return true;
}
- };
-
- _Visitor visitor(*this);
- pParent->Accept(visitor);
+ return IsAncestorOf(*pParent, ancestor);
+ }
- SysAssert(GetLastResult() == E_SUCCESS);
- return visitor.yes;
+ return false;
}
_Window*
return __pRootWindow;
}
- struct _Visitor
- : public Visitor
- {
- _Window* pRoot;
-
- _Visitor(void)
- : pRoot(null){}
+ _Window* pRoot = null;
+ _Control* pControl = const_cast<_Control*>(this);
- virtual VisitType Visit(_Control& control)
+ while (pControl)
+ {
+ pRoot = dynamic_cast <_Window*>(pControl);
+ if (pRoot)
{
- pRoot = dynamic_cast <_Window*>(&control);
- if (pRoot != null)
- {
- return VISIT_STOP;
- }
-
- return VISIT_UPWARD;
+ break;
}
- };
-
- _Visitor visitor;
- Accept(visitor);
-
- SysAssert(GetLastResult() == E_SUCCESS);
+ pControl = pControl->GetParent();
+ }
- const_cast<_Control*>(this)->__pRootWindow = visitor.pRoot;
+ const_cast<_Control*>(this)->__pRootWindow = pRoot;
const_cast<_Control*>(this)->__needRecalcRootWindow = false;
- return visitor.pRoot;
+ return pRoot;
}
bool
{
ClearLastResult();
- struct _Visitor
- : public Visitor
- {
- bool enabled;
-
- _Visitor(void)
- : enabled(true){}
+ bool enabled = true;
+ const _Control* pControl = this;
- virtual VisitType Visit(_Control& control)
+ while (pControl)
+ {
+ if (!pControl->GetEnableState())
{
- if (!control.GetEnableState())
- {
- enabled = false;
- return VISIT_STOP;
- }
-
- return VISIT_UPWARD;
+ enabled = false;
+ break;
}
- };
+ pControl = pControl->GetParent();
+ }
- _Visitor visitor;
- Accept(visitor);
- return visitor.enabled;
+ return enabled;
}
bool
if (changed)
{
__enabledState = enabledState;
- CallOnAncestorEnableStateChanged();
+ CallOnAncestorEnableStateChanged(*this);
}
__pAccessibilityContainer->SetEnableState(enabledState);
}
{
ClearLastResult();
- struct _Visitor
- : public Visitor
- {
- bool inputEnabled;
-
- _Visitor(void)
- : inputEnabled(true){}
+ bool inputEnabled = true;
+ const _Control* pControl = this;
- virtual VisitType Visit(_Control& control)
+ while (pControl)
+ {
+ if (!pControl->GetInputEnableState())
{
- if (!control.GetInputEnableState())
- {
- inputEnabled = false;
- return VISIT_STOP;
- }
-
- return VISIT_UPWARD;
+ inputEnabled = false;
+ break;
}
- };
+ pControl = pControl->GetParent();
+ }
- _Visitor visitor;
- Accept(visitor);
- return visitor.inputEnabled;
+ return inputEnabled;
}
bool
_Control::LockInputEvent(void)
{
__inputLockRefCount++;
- CallOnAncestorInputEnableStateChanged();
+ CallOnAncestorInputEnableStateChanged(*this);
}
void
return false;
}
- struct _Visitor
- : public Visitor
- {
- bool visible;
-
- _Visitor(void)
- : visible(true){}
+ bool visible = true;
+ const _Control* pControl = this;
- virtual VisitType Visit(_Control& control)
+ while (pControl)
+ {
+ if (!pControl->GetVisibleState())
{
- if (!control.GetVisibleState())
- {
- visible = false;
- return VISIT_STOP;
- }
-
- return VISIT_UPWARD;
+ visible = false;
+ break;
}
- };
-
- _Visitor visitor;
- Accept(visitor);
+ pControl = pControl->GetParent();
+ }
- SysAssert(GetLastResult() == E_SUCCESS);
- return visitor.visible;
+ return visible;
}
bool
if (changed)
{
GetControlDelegate().OnVisibleStateChanged();
- CallOnAncestorVisibleStateChanged();
+ CallOnAncestorVisibleStateChanged(*this);
_Control* pParent = GetParent();
if (pParent)
{
}
result
-_Control::AdjustAbsoluteBounds(void)
+_Control::AdjustAbsoluteBounds(_Control& control, bool update)
{
- struct _Visitor
- : public Visitor
+ result r = E_SUCCESS;
+
+ if (update)
{
- _Visitor(_Control* pControl)
- : __pControl(pControl){}
+ FloatRectangle fbounds = control.GetBoundsF();
+
+ if (control.IsLayoutChangable() == false)
+ {
+ r = control.UpdateBoundsOfVisualElement(FloatRectangle(0.0f, 0.0f, fbounds.width, fbounds.height));
+ }
+ else
+ {
+ r = control.UpdateBoundsOfVisualElement(fbounds);
+ }
+ }
- virtual VisitType Visit(_Control& control)
+ for (int i = 0; i < control.GetChildCount(); ++i)
+ {
+ _Control* pChild = control.GetChild(i);
+ if (pChild)
{
- result r = E_SUCCESS;
- if (__pControl == &control)
+ if (pChild == this)
{
- return VISIT_DOWNWARD;
- }
- FloatRectangle fbounds = control.GetBoundsF();
- if (control.IsLayoutChangable() == false)
- {
- r = control.UpdateBoundsOfVisualElement(FloatRectangle(0.0f, 0.0f, fbounds.width, fbounds.height));
+ r = AdjustAbsoluteBounds(*pChild, false);
}
else
{
- r = control.UpdateBoundsOfVisualElement(fbounds);
+ r = AdjustAbsoluteBounds(*pChild);
}
-
- ControlList& children = control.GetChildList();
-
- int childrenCount = children.GetCount();
- if (childrenCount <= 0)
- {
- return VISIT_STOP;
- }
- else
+ if (IsFailed(r))
{
- return VISIT_DOWNWARD;
+ SysLog(NID_UI_CTRL, "[%s] Propagated", GetErrorMessage(GetLastResult()));
}
}
- private :
- _Control* __pControl;
- };
-
- _Visitor visitor(this);
- Accept(visitor);
+ }
- return E_SUCCESS;
+ return r;
}
bool
bool
_Control::IsInSizeRange(const FloatDimension& size) const
{
- return (__minSize.width <= size.width) && (size.width <= __maxSize.width) &&
- (__minSize.height <= size.height) && (size.height <= __maxSize.height);
+ return (_FloatCompareLE(__minSize.width, size.width)) && (_FloatCompareLE(size.width, __maxSize.width)) &&
+ (_FloatCompareLE(__minSize.height, size.height)) && (_FloatCompareLE(size.height, __maxSize.height));
}
// Custom Exception: ex) Location::Map
_Control::SetBoundsInternal(const FloatRectangle& bounds, bool callBoundsChangeCallbacks)
{
SysTryReturn(NID_UI,
- IsInSizeRange(Dimension(bounds.width, bounds.height)), E_INVALID_ARG,
+ IsInSizeRange(FloatDimension(bounds.width, bounds.height)), E_INVALID_ARG,
E_INVALID_ARG,
- "[E_INVALID_ARG] The specified size(%f, %f) is out of range from min size(%d, %d) to max size(%d, %d).",
+ "[E_INVALID_ARG] The specified size(%f, %f) is out of range from min size(%f, %f) to max size(%f, %f).",
bounds.width, bounds.height, __minSize.width, __minSize.height, __maxSize.width, __maxSize.height);
SetUpdateLayoutState(true);
{
ClearLastResult();
+ __isChangedPositionByUser = true;
+
if (callBoundsChangeCallbacks)
{
SysTryReturn(NID_UI,
{
ClearLastResult();
+ __isChangedPositionByUser = true;
+
if (callBoundsChangeCallbacks)
{
SysTryReturn(NID_UI,
{
ClearLastResult();
+ __isChangedPositionByUser = true;
+
SysTryReturn(NID_UI,
IsMovable(), E_UNSUPPORTED_OPERATION,
E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] Not movable.");
{
ClearLastResult();
+ __isChangedPositionByUser = true;
+
SysTryReturn(NID_UI,
IsMovable(), E_UNSUPPORTED_OPERATION,
E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] Not movable.");
return SetBoundsInternal(FloatRectangle(__bounds.x, __bounds.y, size.width, size.height), true);
}
+bool
+_Control::IsChangedPositionByUser(void) const
+{
+ return __isChangedPositionByUser;
+}
+
+void
+_Control::SetChangedPositionByUser(bool change)
+{
+ __isChangedPositionByUser = change;
+}
+
Dimension
_Control::GetMinimumSize(void) const
{
if (!recalcAlways && !__needRecalcAbsBoundsF)
{
return __absoluteBoundsF;
- }
+ }
FloatPoint accumPoint;
FloatRectangle absoluteBounds;
if (moved || resized)
{
- result r = AdjustAbsoluteBounds();
+ result r = AdjustAbsoluteBounds(*this);
SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
SetUpdateLayoutState(true);
if (moved || resized)
{
- result r = AdjustAbsoluteBounds();
+ result r = AdjustAbsoluteBounds(*this);
SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
SetUpdateLayoutState(true);
, __isFocusMode(false)
, __isNavigatable(true)
, __isFocusWindowActivationChecked(false)
+ , __isChangedPositionByUser(false)
, __pVisualElementContentProvider(null)
, __pVisualElement(null)
, __pVisualElementEventListener(null)
, __fontFileName(L"")
, __pPreviousFocus(null)
, __pNextFocus(null)
+ , __pDragWindow(null)
+ , __isDragAndDropSource(false)
{
ClearLastResult();
void* pBuffer[ADDR_SIZE];
retSize = backtrace(pBuffer, ADDR_SIZE);
- SysSecureLog(NID_SHELL, " %d addresses", retSize);
-
for (int i = 0; i < retSize; i++)
{
if (pBuffer[i])
FloatRectangle
_Control::GetContentAreaBoundsF(void) const
{
- return __contentAreaBounds;
+ if (__contentAreaBounds != FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
+ {
+ return __contentAreaBounds;
+ }
+ else
+ {
+ _Layout::Layout* pLayout = GetLayout();
+ if (pLayout)
+ {
+ _Layout::LayoutMatchMode widthMatchMode = _Layout::NONE_MODE;
+ _Layout::LayoutMatchMode heightMatchMode = _Layout::NONE_MODE;
+
+ _Layout::LayoutItem& layoutItem = GetLayoutContainer();
+
+ pLayout->GetItemWidthMatchMode(layoutItem, widthMatchMode);
+ pLayout->GetItemHeightMatchMode(layoutItem, heightMatchMode);
+
+ bool widthWrapContent = widthMatchMode == _Layout::WRAP_CONTENT;
+ bool heightWrapContent = heightMatchMode == _Layout::WRAP_CONTENT;
+
+ if (widthWrapContent || heightWrapContent)
+ {
+ FloatDimension contentSize = GetContentSizeF(widthWrapContent, heightWrapContent);
+ return FloatRectangle(__bounds.x, __bounds.y, contentSize.width, contentSize.height);
+ }
+ else
+ {
+ return __contentAreaBounds;
+ }
+ }
+ }
}
Bitmap*
ClearLastResult();
bool exist = __pCoreGestureDetectors->Contains(const_cast<_TouchGestureDetector*>(&gestureDetector));
- SysTryReturnResult(NID_UI, exist == false, E_OBJ_ALREADY_EXIST, "[E_OBJ_ALREADY_EXIST]__pCoreGestureDetectors has gesture already");
+ SysTryReturnResult(NID_UI, exist == false, E_OBJ_ALREADY_EXIST, "__pCoreGestureDetectors has gesture already");
result r = __pCoreGestureDetectors->Add(const_cast<_TouchGestureDetector*>(&gestureDetector));
SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
return totalCount;
}
+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)
+{
+}
+
_ITouchEventPreviewer*
_Control::GetEventPreviewer(_IntToType<_UI_EVENT_TOUCH>) const
{
_Control::GetFocusListN(void) const
{
unique_ptr<IListT<_Control*> > pControlFocusList (new (std::nothrow) ArrayListT<_Control*>);
- SysTryReturn(NID_UI_CTRL, pControlFocusList, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ SysTryReturn(NID_UI_CTRL, pControlFocusList, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
MakeFocusList(this, pControlFocusList.get());
unique_ptr<IEnumeratorT<_Control*> > pEnum(pControlFocusList->GetEnumeratorN());
- SysTryReturn(NID_UI_CTRL, pEnum, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ SysTryReturn(NID_UI_CTRL, pEnum, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
int i =0;
int nextContainerIndex = -1;
while (pEnum->MoveNext() == E_SUCCESS)
}
}} // Tizen::Ui
-