From: keonpyo.kong Date: Tue, 26 Mar 2013 04:12:11 +0000 (+0900) Subject: Support GetFoucsListN() X-Git-Tag: accepted/tizen_2.1/20130425.033138~690^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ca48623f3b71f6dcab423ab1eafe971d4860d4a;p=platform%2Fframework%2Fnative%2Fuifw.git Support GetFoucsListN() Signed-off-by: keonpyo.kong apply code review Change-Id: Ic628972154c804c2b88223fe4a6246424e18ca63 Signed-off-by: keonpyo.kong add delete code Change-Id: Ia7d84eddfacdace8eba164505c16f945add6d814 Signed-off-by: keonpyo.kong --- 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 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 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 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 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 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 index 0000000..4b7603a Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/white/00_focus.#.png differ diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 0413dad..f475585 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -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 diff --git a/src/ui/FUi_Control.cpp b/src/ui/FUi_Control.cpp index 8fc1cfa..890dd2f 100644 --- a/src/ui/FUi_Control.cpp +++ b/src/ui/FUi_Control.cpp @@ -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 > 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 > 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 > 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 > 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 > 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 diff --git a/src/ui/controls/FUiCtrl_Form.cpp b/src/ui/controls/FUiCtrl_Form.cpp index b066e9b..9300c35 100644 --- a/src/ui/controls/FUiCtrl_Form.cpp +++ b/src/ui/controls/FUiCtrl_Form.cpp @@ -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 > 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 > 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 > 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 > 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(); } diff --git a/src/ui/inc/FUiCtrl_Form.h b/src/ui/inc/FUiCtrl_Form.h index a64d9ad..31559c9 100644 --- a/src/ui/inc/FUiCtrl_Form.h +++ b/src/ui/inc/FUiCtrl_Form.h @@ -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: diff --git a/src/ui/inc/FUi_Control.h b/src/ui/inc/FUi_Control.h index 92c7818..87d5638 100644 --- a/src/ui/inc/FUi_Control.h +++ b/src/ui/inc/FUi_Control.h @@ -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 index 0000000..aa6cccf --- /dev/null +++ b/src/ui/resource/FUi_ResourceFocusUiConfig.cpp @@ -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); +