Fix defect in SetFocusControl
authorkeonpyo.kong <keonpyo.kong@samsung.com>
Fri, 14 Jun 2013 08:28:21 +0000 (17:28 +0900)
committerkeonpyo.kong <keonpyo.kong@samsung.com>
Fri, 14 Jun 2013 09:03:00 +0000 (18:03 +0900)
Change-Id: I724dd427148cf74594f80f4c14b8c0bdd0a0a09e
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
apply code review

Change-Id: Ie4536f146b7fc6466e9d45167925fafddf8e815f
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
src/ui/FUi_Control.cpp
src/ui/FUi_Window.cpp
src/ui/controls/FUiCtrl_Frame.cpp
src/ui/inc/FUiCtrl_Frame.h
src/ui/inc/FUi_Window.h

index 045e282..733cefc 100644 (file)
@@ -1542,7 +1542,7 @@ _Control::CallOnDetachingFromMainTree(_Control& control)
                _Control* pControl = pTop->GetFocusControl(this);
                if ((&control) == pControl)
                {
-                       pTop->SetFocusControl(null);
+                       pTop->SetFocusControl(&control, false);
                }
        }
        
@@ -2574,17 +2574,15 @@ _Control::SetFocused(bool on)
                                IsFocusable(), E_INVALID_OPERATION,
                                E_INVALID_OPERATION, "[E_INVALID_OPERATION] This Control isn't focusable control.");
 
+       _Window* pTop = GetRootWindow();
+       SysAssert(pTop);
        if (on)
        {
-               _Window* pTop = GetRootWindow();
-               SysAssert(pTop);
-               pTop->SetFocusControl(this);
+               pTop->SetFocusControl(this, true);
        }
        else
        {
-               _Window* pTop = GetRootWindow();
-               SysAssert(pTop);
-               pTop->SetFocusControl(null);
+               pTop->SetFocusControl(this, false);
        }
 
        return E_SUCCESS;
index 204d7ef..8df262f 100644 (file)
@@ -942,14 +942,16 @@ _Window::SetFocusTraversalControl(_Control* pControl)
 }
 
 void
-_Window::SetFocusControl(const _Control* pControl)
+_Window:: SetFocusControl(const _Control* pControl, bool on)
 {
+       SysTryReturnVoidResult(NID_UI, pControl, E_SYSTEM, "[E_SYSTEM] The pControl cannot be NULL.");
+
        __pFocusControl = const_cast<_Control*>(pControl);
 
        _ControlManager* pControlMgr = _ControlManager::GetInstance();
        SysAssert(pControlMgr);
 
-       if (pControl)
+       if (on)
        {
                if (IsActivated())
                {
index 42aa75a..f099471 100644 (file)
@@ -823,8 +823,9 @@ _Frame::GetCurrentFocusControl(void) const
        return null;    
 }
 void 
-_Frame::SetFocusControl(const _Control* pControl)
+_Frame::SetFocusControl(const _Control* pControl , bool on)
 {
+       SysTryReturnVoidResult(NID_UI, pControl, E_SYSTEM, "[E_SYSTEM] The pControl cannot be NULL.");
        _ControlManager* pControlMgr = _ControlManager::GetInstance();
        SysAssert(pControlMgr);
        _Form* pForm = null;
@@ -850,23 +851,23 @@ _Frame::SetFocusControl(const _Control* pControl)
        {
                isCurrentForm = true;
        }
-       
-       if (pControl)
-       {
-               if (pForm)
+
+       if (pForm)
+       {       
+               if (on)
                {
                        pForm->SetFocusControl(pControl);
+                       if (isCurrentForm)
+                       {
+                               pControlMgr->SetFocusControl(*pControl);
+                       }
                }
-               if (isCurrentForm)
+               else
                {
-                       pControlMgr->SetFocusControl(*pControl);
+                       pControlMgr->SetFocusControl(*this, false);
+                       pForm->SetFocused();
                }
        }
-       else
-       {
-               pControlMgr->SetFocusControl(*this, false);
-               pForm->SetFocused();
-       }
 }
 
 void
index 9101f50..06598da 100644 (file)
@@ -94,7 +94,7 @@ public:
 // Focus
        virtual _Control* GetFocusControl(const _Control* pControl) const;
        virtual _Control* GetCurrentFocusControl(void) const;
-       virtual void SetFocusControl(const _Control* pControl);
+       virtual void SetFocusControl(const _Control* pControl, bool on);
 
 // Internal
        void SetChangingBoundsEnabled(bool enable);
index 2839424..0f6afbb 100644 (file)
@@ -87,7 +87,7 @@ public:
 // Focus
        virtual _Control* GetFocusControl(const _Control* pControl) const;
        virtual _Control* GetCurrentFocusControl(void) const;
-       virtual void SetFocusControl(const _Control* pControl);
+       virtual void SetFocusControl(const _Control* pControl, bool on);
 // Callbacks
        virtual void OnActivated(void);
        virtual void OnNativeWindowActivated(void);