Support GetFoucsListN()
authorkeonpyo.kong <keonpyo.kong@samsung.com>
Tue, 26 Mar 2013 04:12:11 +0000 (13:12 +0900)
committerkeonpyo.kong <keonpyo.kong@samsung.com>
Tue, 26 Mar 2013 06:19:50 +0000 (15:19 +0900)
Change-Id: Ib5ce0afb01dc6a2fba5c79b311da835b1b4803cd
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
apply code review

Change-Id: Ic628972154c804c2b88223fe4a6246424e18ca63
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
add delete code

Change-Id: Ia7d84eddfacdace8eba164505c16f945add6d814
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
12 files changed:
res/common/usr/share/osp/bitmaps/480x800/00_focus.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/480x800/black/00_focus.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/480x800/white/00_focus.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/00_focus.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/black/00_focus.#.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/white/00_focus.#.png [new file with mode: 0644]
src/ui/CMakeLists.txt
src/ui/FUi_Control.cpp
src/ui/controls/FUiCtrl_Form.cpp
src/ui/inc/FUiCtrl_Form.h
src/ui/inc/FUi_Control.h
src/ui/resource/FUi_ResourceFocusUiConfig.cpp [new file with mode: 0644]

diff --git a/res/common/usr/share/osp/bitmaps/480x800/00_focus.#.png b/res/common/usr/share/osp/bitmaps/480x800/00_focus.#.png
new file mode 100644 (file)
index 0000000..6327ca2
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/00_focus.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/480x800/black/00_focus.#.png b/res/common/usr/share/osp/bitmaps/480x800/black/00_focus.#.png
new file mode 100644 (file)
index 0000000..6327ca2
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/black/00_focus.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/480x800/white/00_focus.#.png b/res/common/usr/share/osp/bitmaps/480x800/white/00_focus.#.png
new file mode 100644 (file)
index 0000000..6327ca2
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/white/00_focus.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/00_focus.#.png b/res/common/usr/share/osp/bitmaps/720x1280/00_focus.#.png
new file mode 100644 (file)
index 0000000..4b7603a
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/00_focus.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/black/00_focus.#.png b/res/common/usr/share/osp/bitmaps/720x1280/black/00_focus.#.png
new file mode 100644 (file)
index 0000000..4b7603a
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/black/00_focus.#.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/white/00_focus.#.png b/res/common/usr/share/osp/bitmaps/720x1280/white/00_focus.#.png
new file mode 100644 (file)
index 0000000..4b7603a
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/white/00_focus.#.png differ
index 0413dad..f475585 100644 (file)
@@ -649,6 +649,7 @@ SET (${this_target}_SOURCE_FILES
        resource/FUi_ResourceStringLoader.cpp
        resource/FUi_ResourceConfigLoader.cpp
        resource/FUi_ResourceConfigParser.cpp
+       resource/FUi_ResourceFocusUiConfig.cpp
        ## EFFECTS
        effects/FUiEffects_EffectErrorMessages.cpp
        effects/FUiEffects_EffectManagerImpl.cpp
index 8fc1cfa..890dd2f 100644 (file)
@@ -52,6 +52,7 @@
 #include "FUiAnim_VisualElementImpl.h"
 #include "FUiCtrl_Form.h"
 #include "FUiCtrl_Frame.h"
+#include "FUi_ContainerImpl.h"
 
 using namespace std;
 using namespace Tizen::Base;
@@ -3665,6 +3666,11 @@ _Control::DisposeControl(void)
 
        delete __pAccessibilityContainer;
        __pAccessibilityContainer = null;
+
+       if (__pFocusVisualElement)
+       {
+               __pFocusVisualElement.release();
+       }
 }
 
 // E_OUT_OF_MEMORY
@@ -4918,7 +4924,7 @@ _Control::OnDrawFocus(void)
                pCanvas->SetBackgroundColor(0x55555555);
                pCanvas->Clear();
                Bitmap* pBitmap = null;
-        result r = GET_BITMAP_CONFIG_N(ACCESSIBILITY::POPUP_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
+               result r = GET_BITMAP_CONFIG_N(FOCUSUI::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
 
                if (r == E_SUCCESS)
                {
@@ -4981,4 +4987,90 @@ _Control::DrawFocus(void)
        _IControlDelegate& delegate = GetControlDelegate();
        delegate.OnDrawFocus();
 }
+
+void
+_Control::MakeFocusList(const _Control* pControl, IListT<_Control*>*  pFocusControlList) const
+{
+       int childCount = pControl->GetChildCount();
+       for(int i = 0; i < childCount; i++)
+       {
+               _Control* pChildControl = pControl->GetChild(i);
+               Rectangle rect = pChildControl->GetAbsoluteBounds();
+               unique_ptr<IEnumeratorT<_Control*> > pEnum (pFocusControlList->GetEnumeratorN());
+               int index = 0;
+               while (pEnum->MoveNext() == E_SUCCESS)
+               {
+                       _Control* pEnumeratorControl = null;
+                       pEnum->GetCurrent(pEnumeratorControl);
+                       if (pEnumeratorControl != null)
+                       {
+                               Rectangle enumeratorRect = pEnumeratorControl->GetAbsoluteBounds();
+                               if(enumeratorRect.y > rect.y)
+                               {
+                                       break;
+                               }
+                               else if (enumeratorRect.y == rect.y)
+                               {
+                                       if(enumeratorRect.x > rect.x)
+                                       {
+                                               break;
+                                       }
+                               }
+
+                               index ++;
+                       }
+               }
+               pFocusControlList->InsertAt(pChildControl, index);
+       }
+}
+
+void
+_Control::MakeChildContainerFocusList(const _Control* pControl, int startIndex , IListT<_Control*>*  pFocusControlList) const
+{
+       unique_ptr<IListT<_Control*> > pTempList (new (std::nothrow) ArrayListT<_Control*>);
+       SysTryReturnVoidResult(NID_UI_CTRL, pTempList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+       MakeFocusList(pControl, pTempList.get());
+
+       unique_ptr<IEnumeratorT<_Control*> > pTempEnum(pTempList->GetEnumeratorN());
+       int index = ++startIndex;
+       while (pTempEnum->MoveNext() == E_SUCCESS)
+       {
+               _Control* pEnumeratorControl = null;
+               pTempEnum->GetCurrent(pEnumeratorControl);
+               pFocusControlList->InsertAt(pEnumeratorControl, index);
+               index ++;
+       }
+}
+
+Tizen::Base::Collection::IListT<_Control*>*
+_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.");
+       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.");
+       int i =0;
+       int nextContainerIndex = -1;
+       while (pEnum->MoveNext() == E_SUCCESS)
+       {
+               _Control* pEnumeratorControl = null;
+               pEnum->GetCurrent(pEnumeratorControl);
+               _ContainerImpl* pTempContainerImpl = dynamic_cast<_ContainerImpl*>(static_cast <_ControlImpl* >(pEnumeratorControl->GetUserData()));
+
+               if (pTempContainerImpl != null && (nextContainerIndex < i))
+               {
+                       if (pEnumeratorControl->IsChildControlFocusManage() == false)
+                       {
+                               MakeChildContainerFocusList(pEnumeratorControl, i, pControlFocusList.get());
+                               nextContainerIndex = i;
+                               pEnum.reset(pControlFocusList->GetEnumeratorN());
+                               i = -1;
+                       }
+               }
+               i++;
+       }
+       return pControlFocusList.release();
+}
 }} // Tizen::Ui
index b066e9b..9300c35 100644 (file)
@@ -2593,93 +2593,14 @@ _Form::IsNotificationTrayOpenEnabled(void) const
        return true;
 }
 
-void
-_Form::MakeFocusList(const _Control* pControl, IListT<_Control*>*  pFocusControlList) const
-{
-       int childCount = pControl->GetChildCount();
-       for(int i = 0; i < childCount; i++)
-       {
-               _Control* pChildControl = pControl->GetChild(i);
-               Rectangle rect = pChildControl->GetAbsoluteBounds();
-               unique_ptr<IEnumeratorT<_Control*> > pEnum (pFocusControlList->GetEnumeratorN());
-               int index = 0;
-               while (pEnum->MoveNext() == E_SUCCESS)
-               {
-                       _Control* pEnumeratorControl = null;
-                       pEnum->GetCurrent(pEnumeratorControl);
-                       if (pEnumeratorControl != null)
-                       {
-                               Rectangle enumeratorRect = pEnumeratorControl->GetAbsoluteBounds();
-                               if(enumeratorRect.y > rect.y)
-                               {
-                                       break;
-                               }
-                               else if (enumeratorRect.y == rect.y)
-                               {
-                                       if(enumeratorRect.x > rect.x)
-                                       {
-                                               break;
-                                       }
-                               }
-
-                               index ++;
-                       }
-               }
-               pFocusControlList->InsertAt(pChildControl, index);
-       }
-}
-
-void
-_Form::MakeChildContainerFocusList(_Control* pControl, int startIndex) const
-{
-       unique_ptr<IListT<_Control*> > pTempList (new (std::nothrow) ArrayListT<_Control*>);
-       SysTryReturnVoidResult(NID_UI_CTRL, pTempList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
-       MakeFocusList(pControl, pTempList.get());
-
-       unique_ptr<IEnumeratorT<_Control*> > pTempEnum(pTempList->GetEnumeratorN());
-       int index = ++startIndex;
-       while (pTempEnum->MoveNext() == E_SUCCESS)
-       {
-               _Control* pEnumeratorControl = null;
-               pTempEnum->GetCurrent(pEnumeratorControl);
-               __pFocusControlList->InsertAt(pEnumeratorControl, index);
-               index ++;
-       }
-}
-
 IListT<_Control*>*
 _Form::GetFocusList(void) const
 {
        if(!__pFocusControlList)
        {
-               __pFocusControlList.reset(new (std::nothrow) ArrayListT<_Control*>);
-               SysTryReturn(NID_UI, __pFocusControlList, null, E_SYSTEM, "[E_OUT_OF_MEMORY] Memory is insufficient.");
-               MakeFocusList(this, __pFocusControlList.get());
-
-               unique_ptr<IEnumeratorT<_Control*> > pEnum(__pFocusControlList->GetEnumeratorN());
-               int i =0;
-               int nextContainerIndex = -1;
-               while ( pEnum->MoveNext() == E_SUCCESS)
-               {
-                       _Control* pEnumeratorControl = null;
-                       pEnum->GetCurrent(pEnumeratorControl);
-                       _ContainerImpl* pTempContainerImpl = dynamic_cast<_ContainerImpl*>(static_cast <_ControlImpl* >(pEnumeratorControl->GetUserData()));
-
-                       if (pTempContainerImpl != null && (nextContainerIndex < i))
-                       {
-                               if (pEnumeratorControl->IsChildControlFocusManage() == false)
-                               {
-                                       MakeChildContainerFocusList(pEnumeratorControl, i);
-                                       nextContainerIndex = i;
-                                       pEnum.reset(__pFocusControlList->GetEnumeratorN());
-                                       i = -1;
-                               }
-                       }
-                       i++;
-               }
-               __pFocusControlList->InsertAt(dynamic_cast<_Control*> (const_cast<_Form*>(this)), 0);
+               __pFocusControlList.reset(GetFocusListN());
+               __pFocusControlList->InsertAt(const_cast<_Form*>(this), 0);
        }
-
        return __pFocusControlList.get();
 }
 
index a64d9ad..31559c9 100644 (file)
@@ -202,8 +202,6 @@ public:
 
 // Focus UI
    Tizen::Base::Collection::IListT<_Control*>* GetFocusList(void) const;
-   void MakeFocusList(const _Control* pControl, Tizen::Base::Collection::IListT<_Control*>*  pFocusControlList) const;
-   void MakeChildContainerFocusList(_Control* pControl, int startIndex) const;
 
 // Accessor
 protected:
index 92c7818..87d5638 100644 (file)
@@ -397,11 +397,12 @@ public:
        void SetNativeObjectFocusable(bool focusable);
 
 // Focus UI
-   void SetPreviousFocus(_Control* pPreviousFocus);
-   void SetNextFocus(_Control* pNextFocus);
-   _Control* GetPreviousFocus() const;
-   _Control* GetNextFocus() const;
-   void DrawFocus(void);
+       void SetPreviousFocus(_Control* pPreviousFocus);
+       void SetNextFocus(_Control* pNextFocus);
+       _Control* GetPreviousFocus() const;
+       _Control* GetNextFocus() const;
+       void DrawFocus(void);
+       Tizen::Base::Collection::IListT<_Control*>* GetFocusListN(void) const;
 
 // Clipping
        bool IsClipToParent(void) const;
@@ -585,6 +586,10 @@ private:
        void SetEventListener(_IntToType<_UI_EVENT_FOCUS>, _IFocusEventListener* pListener);
        void SetEventListener(_IntToType<_UI_EVENT_NOTIFICAITON>, _INotificationEventListener* pListener);
 
+// Focus Ui
+       void MakeFocusList(const _Control* pControl, Tizen::Base::Collection::IListT<_Control*>*  pFocusControlList) const;
+       void MakeChildContainerFocusList(const _Control* pControl, int startIndex, Tizen::Base::Collection::IListT<_Control*>*  pFocusControlList) const;
+
 private:
        _ControlHandle __controlHandle;
        Tizen::Base::String __name;
diff --git a/src/ui/resource/FUi_ResourceFocusUiConfig.cpp b/src/ui/resource/FUi_ResourceFocusUiConfig.cpp
new file mode 100644 (file)
index 0000000..aa6cccf
--- /dev/null
@@ -0,0 +1,25 @@
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "FUi_ResourceConfigMacro.h"
+
+START_UI_CONFIG(FOCUSUI);
+{
+       ADD_IMAGE_CONFIG(FOCUS,#00_focus.#.png);
+}
+END_UI_CONFIG(FOCUSUI);
+