#include "FUi_UiEventManager.h"
#include "FUi_ResourceManager.h"
#include "FUi_UiKeyEvent.h"
+#include "FUi_Window.h"
+#include "FUiCtrl_Frame.h"
using namespace std;
using namespace Tizen::Base::Collection;
}
}
- _Form* pForm = null;
- _Control* pParentControl = pControl;
-
- while(pControl)
+ IListT<_Control*>* pFocusControlList = null;
+ _Window* pTop = pControl->GetRootWindow();
+ if (pTop)
{
- pForm = dynamic_cast<_Form*>(pParentControl);
-
- if (pForm != null)
+ _Frame* pFrame = dynamic_cast<_Frame*>(pTop);
+ if (pFrame)
{
- break;
+ _Form* pForm = pFrame->GetCurrentForm();
+ pFocusControlList = pForm->GetFocusList();
}
else
{
- pParentControl = pParentControl->GetParent();
+ pFocusControlList = pTop->GetFocusList();
}
- }
+ }
- IListT<_Control*>* pFocusControlList = pForm->GetFocusList();
- unique_ptr<IEnumeratorT<_Control*> > pEnum (pFocusControlList->GetEnumeratorN());
-
- int index = 0;
- bool findNextFocusControl = false;
- _Control* pFocusControl = null;
- while (pEnum->MoveNext() == E_SUCCESS)
+ if (pFocusControlList)
{
- _Control* pEnumeratorControl = null;
- pEnum->GetCurrent(pEnumeratorControl);
-
- //Find current focused control
- if (pControl == pEnumeratorControl)
- {
- //Find next focusable control.
- index = GetNextIndex(index, focusDirection, pFocusControlList);
- while (pFocusControlList->GetAt(index, pFocusControl) == E_SUCCESS)
+ unique_ptr<IEnumeratorT<_Control*> > pEnum (pFocusControlList->GetEnumeratorN());
+ SysTryReturnVoidResult(NID_UI_CTRL, pEnum, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+ int index = 0;
+ bool findNextFocusControl = false;
+ _Control* pFocusControl = null;
+ while (pEnum->MoveNext() == E_SUCCESS)
{
- bool isFocusalbe = pFocusControl->IsFocusable();
- bool enableState = pFocusControl->GetEnableState();
- bool visibleState = pFocusControl->GetVisibleState();
- if (enableState == true && visibleState == true && isFocusalbe == true)
+ _Control* pEnumeratorControl = null;
+ pEnum->GetCurrent(pEnumeratorControl);
+
+ //Find current focused control
+ if (pControl == pEnumeratorControl)
{
- pFocusControl->SetFocused();
- findNextFocusControl = true;
- break;
+ //Find next focusable control.
+ index = GetNextIndex(index, focusDirection, pFocusControlList);
+ while (pFocusControlList->GetAt(index, pFocusControl) == E_SUCCESS)
+ {
+ bool isFocusalbe = pFocusControl->IsFocusable();
+ bool enableState = pFocusControl->GetEnableState();
+ bool visibleState = pFocusControl->GetVisibleState();
+ if (enableState == true && visibleState == true && isFocusalbe == true)
+ {
+ pFocusControl->SetFocused();
+ findNextFocusControl = true;
+ break;
+ }
+ else
+ {
+ index = GetNextIndex(index, focusDirection, pFocusControlList);
+ }
}
- else
+ }
+
+ if (findNextFocusControl == true)
{
- index = GetNextIndex(index, focusDirection, pFocusControlList);
+ break;
}
- }
- }
- if (findNextFocusControl == true)
- {
- break;
+ index ++;
}
- index ++;
- }
-
- if (pFocusControl && findNextFocusControl == true)
- {
- _Control* pParentControl = pFocusControl->GetParent();
- if (pParentControl)
+ if (pFocusControl && findNextFocusControl == true)
{
- pParentControl->OnChildControlFocusMoved(*pFocusControl);
+ _Control* pParentControl = pFocusControl->GetParent();
+ if (pParentControl)
+ {
+ pParentControl->OnChildControlFocusMoved(*pFocusControl);
+ }
+ pFocusControl->DrawFocus();
}
- pFocusControl->DrawFocus();
}
}