Fixed Coding Idioms Violations
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_Tab.cpp
index c8d4859..5997edf 100644 (file)
@@ -224,7 +224,7 @@ _Tab::AddItem(const Bitmap& icon, const String& text, int actionId)
 
        SysTryReturnResult(NID_UI_CTRL, itemCount < _TAB_ITEM_MAXCOUNT, E_SYSTEM, "A system error has occurred. The tab has maximum number of items.");
 
-       _TabItem *pItem = new (std::nothrow) _TabItem;
+       _TabItempItem = new (std::nothrow) _TabItem;
        SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        pItem->SetIcon(icon);
@@ -275,7 +275,7 @@ _Tab::AddItem(const Bitmap& icon, int actionId)
 
        SysTryReturnResult(NID_UI_CTRL, itemCount < _TAB_ITEM_MAXCOUNT, E_SYSTEM, "A system error has occurred. The tab has maximum number of items.");
 
-       _TabItem *pItem = new (std::nothrow) _TabItem;
+       _TabItempItem = new (std::nothrow) _TabItem;
        SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        pItem->SetIcon(icon);
@@ -325,7 +325,7 @@ _Tab::AddItem(const String& text, int actionId)
 
        SysTryReturnResult(NID_UI_CTRL, itemCount < _TAB_ITEM_MAXCOUNT, E_SYSTEM, "A system error has occurred. The tab has maximum number of items.");
 
-       _TabItem *pItem = new (std::nothrow) _TabItem;
+       _TabItempItem = new (std::nothrow) _TabItem;
        SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        pItem->SetText(text);
@@ -380,7 +380,7 @@ _Tab::InsertItemAt(int index, const Bitmap& icon, const String& text, int action
 
        SysTryReturnResult(NID_UI_CTRL, itemCount < _TAB_ITEM_MAXCOUNT, E_SYSTEM, "A system error has occurred. The tab has maximum number of items.");
 
-       _TabItem *pItem = new (std::nothrow) _TabItem;
+       _TabItempItem = new (std::nothrow) _TabItem;
        SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        pItem->SetIcon(icon);
@@ -392,7 +392,7 @@ _Tab::InsertItemAt(int index, const Bitmap& icon, const String& text, int action
 
        if (selectedIndex >= index)
        {
-               _TabItem *pSelectedItem = null;
+               _TabItempSelectedItem = null;
                pSelectedItem = GetItemAt(selectedIndex);
                if (pSelectedItem != null)
                {
@@ -449,7 +449,7 @@ _Tab::InsertItemAt(int index, const Bitmap& icon, int actionId)
 
        SysTryReturnResult(NID_UI_CTRL, itemCount < _TAB_ITEM_MAXCOUNT, E_SYSTEM, "A system error has occurred. The tab has maximum number of items.");
 
-       _TabItem *pItem = new (std::nothrow) _TabItem;
+       _TabItempItem = new (std::nothrow) _TabItem;
        SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        pItem->SetIcon(icon);
@@ -459,7 +459,7 @@ _Tab::InsertItemAt(int index, const Bitmap& icon, int actionId)
 
        if (selectedIndex >= index)
        {
-               _TabItem *pSelectedItem = null;
+               _TabItempSelectedItem = null;
                pSelectedItem = GetItemAt(selectedIndex);
                if (pSelectedItem != null)
                {
@@ -516,7 +516,7 @@ _Tab::InsertItemAt(int index, const String& text, int actionId)
 
        SysTryReturnResult(NID_UI_CTRL, itemCount < _TAB_ITEM_MAXCOUNT, E_SYSTEM, "A system error has occurred. The tab has maximum number of items.");
 
-       _TabItem *pItem = new (std::nothrow) _TabItem;
+       _TabItempItem = new (std::nothrow) _TabItem;
        SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        pItem->SetText(text);
@@ -526,7 +526,7 @@ _Tab::InsertItemAt(int index, const String& text, int actionId)
 
        if (selectedIndex >= index)
        {
-               _TabItem *pSelectedItem = null;
+               _TabItempSelectedItem = null;
                pSelectedItem = GetItemAt(selectedIndex);
                if (pSelectedItem != null)
                {
@@ -589,7 +589,7 @@ _Tab::SetItemAt(int index, const Bitmap& icon, const String& text, int actionId)
                return E_SYSTEM;
        }
 
-       _TabItem *pItem = static_cast<_TabItem*>(__tabItems.GetAt(index));
+       _TabItempItem = static_cast<_TabItem*>(__tabItems.GetAt(index));
        result r = GetLastResult();
        SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -631,7 +631,7 @@ _Tab::SetItemAt(int index, const Bitmap& icon, int actionId)
                return E_SYSTEM;
        }
 
-       _TabItem *pItem = static_cast<_TabItem*>(__tabItems.GetAt(index));
+       _TabItempItem = static_cast<_TabItem*>(__tabItems.GetAt(index));
        result r = GetLastResult();
        SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -670,7 +670,7 @@ _Tab::SetItemAt(int index, const String& text, int actionId)
                return E_SYSTEM;
        }
 
-       _TabItem *pItem = static_cast<_TabItem*>(__tabItems.GetAt(index));
+       _TabItempItem = static_cast<_TabItem*>(__tabItems.GetAt(index));
        result r = GetLastResult();
        SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -691,7 +691,7 @@ _Tab::RemoveItemAt(int index)
 
        if (selectedIndex >= index)
        {
-               _TabItem *pSelectedItem = null;
+               _TabItempSelectedItem = null;
                pSelectedItem = GetItemAt(selectedIndex);
                if (pSelectedItem != null)
                {
@@ -799,80 +799,29 @@ result
 _Tab::LoadBitmap(void)
 {
        result r = E_SUCCESS;
-       Bitmap* pPressedItemBackgroundBitmap = null;
-       Bitmap* pItemBackgroundBitmap = null;
-       Bitmap* pDisabledBackgroundBitmap = null;
-       Bitmap* pSelectedItemBackgroundBitmap = null;
-       Bitmap* pPressedItemBackgroundEffectBitmap = null;
-       Bitmap* pHighlightedItemBackgroundBitmap = null;
        Color pressedEffectColor;
        GET_COLOR_CONFIG(TAB::ITEM_BG_EFFECT_PRESSED, pressedEffectColor);
 
-       r = GET_BITMAP_CONFIG_N(TAB::ITEM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pDisabledBackgroundBitmap);
+       r = GET_REPLACED_BITMAP_CONFIG_N(TAB::ITEM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, GetDisabledItemBackgroundColor(), __pDisabledBackgroundBitmap);
        SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "Failed to locate disabled item background bitmap.");
 
-       if (pDisabledBackgroundBitmap != null)
-       {
-               __pDisabledBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pDisabledBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), GetDisabledItemBackgroundColor());
-               SysTryLog(NID_UI_CTRL, (__pDisabledBackgroundBitmap != null), "Failed to locate disabled item background bitmap.");
-
-               delete pDisabledBackgroundBitmap;
-       }
 
-       r = GET_BITMAP_CONFIG_N(TAB::ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pItemBackgroundBitmap);
+       r = GET_REPLACED_BITMAP_CONFIG_N(TAB::ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, GetItemBackgroundColor(), __pBackgroundBitmap);
        SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "Failed to locate item background bitmap.");
 
-       if (pItemBackgroundBitmap != null)
-       {
-               __pBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pItemBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), GetItemBackgroundColor());
-               SysTryLog(NID_UI_CTRL, (__pBackgroundBitmap != null), "Failed to locate item background bitmap.");
-
-               delete pItemBackgroundBitmap;
-       }
 
-       r = GET_BITMAP_CONFIG_N(TAB::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pPressedItemBackgroundBitmap);
+       r = GET_REPLACED_BITMAP_CONFIG_N(TAB::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, GetPressedItemBackgroundColor(), __pPressedItemBackgroundBitmap);
        SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "Failed to locate pressed item background bitmap.");
 
-       if (pPressedItemBackgroundBitmap != null)
-       {
-               __pPressedItemBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pPressedItemBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), GetPressedItemBackgroundColor());
-               SysTryLog(NID_UI_CTRL, (__pPressedItemBackgroundBitmap != null), "Failed to locate pressed item background bitmap.");
-
-               delete pPressedItemBackgroundBitmap;
-       }
-
-       r = GET_BITMAP_CONFIG_N(TAB::ITEM_BG_SELECTED, BITMAP_PIXEL_FORMAT_ARGB8888, pSelectedItemBackgroundBitmap);
+       r = GET_REPLACED_BITMAP_CONFIG_N(TAB::ITEM_BG_SELECTED, BITMAP_PIXEL_FORMAT_ARGB8888, GetSelectedItemBackgroundColor(), __pSelectedItemBackgroundBitmap);
        SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "Failed to locate selected item background bitmap.");
 
-       if (pSelectedItemBackgroundBitmap != null)
-       {
-               __pSelectedItemBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pSelectedItemBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), GetSelectedItemBackgroundColor());
-               SysTryLog(NID_UI_CTRL, (__pSelectedItemBackgroundBitmap != null), "Failed to locate selected item background bitmap.");
-
-               delete pSelectedItemBackgroundBitmap;
-       }
-
-       r = GET_BITMAP_CONFIG_N(TAB::ITEM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pPressedItemBackgroundEffectBitmap);
+       r = GET_REPLACED_BITMAP_CONFIG_N(TAB::ITEM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pressedEffectColor, __pPressedItemBackgroundEffectBitmap);
        SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "Failed to locate selected item background bitmap.");
 
-       if (pPressedItemBackgroundEffectBitmap != null)
-       {
-               __pPressedItemBackgroundEffectBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pPressedItemBackgroundEffectBitmap, Color::GetColor(COLOR_ID_MAGENTA), pressedEffectColor);
-               SysTryLog(NID_UI_CTRL, (__pPressedItemBackgroundEffectBitmap != null), "Failed to locate selected item background bitmap.");
-
-               delete pPressedItemBackgroundEffectBitmap;
-       }
-
-       r = GET_BITMAP_CONFIG_N(TAB::ITEM_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pHighlightedItemBackgroundBitmap);
+       r = GET_REPLACED_BITMAP_CONFIG_N(TAB::ITEM_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, GetHighlightedItemBackgroundColor(), __pHighlightedItemBackgroundBitmap);
        SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "Failed to locate highlighted item background bitmap.");
 
-       if (pHighlightedItemBackgroundBitmap != null)
-       {
-               __pHighlightedItemBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pHighlightedItemBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), GetHighlightedItemBackgroundColor());
-               SysTryLog(NID_UI_CTRL, (__pHighlightedItemBackgroundBitmap != null), "Failed to locate highlighted item background bitmap.");
-
-               delete pHighlightedItemBackgroundBitmap;
-       }
        return r;
 }
 
@@ -889,7 +838,7 @@ _Tab::SetBadgeIcon(int actionId, const Bitmap* pBadgeIcon)
 
        int itemIndex = GetItemIndexFromActionId(actionId);
 
-       _TabItem *pItem = null;
+       _TabItempItem = null;
 
        if (itemIndex < 0)
        {
@@ -929,7 +878,7 @@ _Tab::GetItemIndexFromActionId(int actionId) const
 
        for (index = 0; index < itemCount; index++)
        {
-               const _TabItem *pItem = dynamic_cast<const _TabItem*>(__tabItems.GetAt(index));
+               const _TabItempItem = dynamic_cast<const _TabItem*>(__tabItems.GetAt(index));
 
                if (pItem != null)
                {
@@ -946,12 +895,12 @@ _Tab::GetItemIndexFromActionId(int actionId) const
 int
 _Tab::GetItemActionIdAt(int index) const
 {
-       if (__tabItems.GetAt(index) == null )
+       if (__tabItems.GetAt(index) == null)
        {
                return -1;
        }
 
-       const _TabItem *pItem = dynamic_cast<const _TabItem*>(__tabItems.GetAt(index));
+       const _TabItempItem = dynamic_cast<const _TabItem*>(__tabItems.GetAt(index));
        SysTryReturn(NID_UI_CTRL, pItem != null, E_SYSTEM, E_SYSTEM,"[E_SYSTEM] A system error has occurred. Failed to get an item at index (%d).", index);
 
        return pItem->GetActionId();
@@ -960,12 +909,12 @@ _Tab::GetItemActionIdAt(int index) const
 _TabItem*
 _Tab::GetItemAt(int index)
 {
-       if (__tabItems.GetAt(index) == null )
+       if (__tabItems.GetAt(index) == null)
        {
                return null;
        }
 
-       _TabItem *pItem = static_cast<_TabItem*>(__tabItems.GetAt(index));
+       _TabItempItem = static_cast<_TabItem*>(__tabItems.GetAt(index));
        result r = GetLastResult();
        SysTryReturn(NID_UI_CTRL, pItem != null, null, r, "[%s] Propagating.", GetErrorMessage(r));