From: vipul Date: Tue, 13 Aug 2013 13:05:26 +0000 (+0530) Subject: Code log correction X-Git-Tag: accepted/tizen/20131002.165803^2~194^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb2607d34f0352ceaf9013fbef426bcc2595c803;p=platform%2Fframework%2Fnative%2Fuifw.git Code log correction Signed-off-by: vipul Change-Id: Ia04772bb2f361f31f54dbe72aebff63f9e2826d7 --- diff --git a/src/ui/controls/FUiCtrlContextMenu.cpp b/src/ui/controls/FUiCtrlContextMenu.cpp index 133ebf7..3a9c9e2 100644 --- a/src/ui/controls/FUiCtrlContextMenu.cpp +++ b/src/ui/controls/FUiCtrlContextMenu.cpp @@ -30,6 +30,7 @@ using namespace Tizen::App; using namespace Tizen::Base; using namespace Tizen::Base::Runtime; using namespace Tizen::Graphics; +using namespace Tizen::Ui; namespace Tizen { namespace Ui { namespace Controls { @@ -43,7 +44,7 @@ ContextMenu::~ContextMenu(void) } result -ContextMenu::Construct(const Tizen::Graphics::Point& point, ContextMenuStyle style) +ContextMenu::Construct(const Point& point, ContextMenuStyle style) { result r = E_SUCCESS; @@ -53,7 +54,7 @@ ContextMenu::Construct(const Tizen::Graphics::Point& point, ContextMenuStyle sty } result -ContextMenu::Construct(const Tizen::Graphics::FloatPoint& point, ContextMenuStyle style) +ContextMenu::Construct(const FloatPoint& point, ContextMenuStyle style) { result r = E_SUCCESS; @@ -63,7 +64,7 @@ ContextMenu::Construct(const Tizen::Graphics::FloatPoint& point, ContextMenuStyl } result -ContextMenu::Construct(const Tizen::Graphics::Point& point, ContextMenuStyle style, ContextMenuAnchorDirection direction) +ContextMenu::Construct(const Point& point, ContextMenuStyle style, ContextMenuAnchorDirection direction) { _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl == null, @@ -75,7 +76,7 @@ ContextMenu::Construct(const Tizen::Graphics::Point& point, ContextMenuStyle sty FloatPoint floatPoint = _CoordinateSystemUtils::ConvertToFloat(point); pImpl = _ContextMenuImpl::CreateContextMenuImplN(this, floatPoint, style, direction); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); _pControlImpl = pImpl; @@ -83,7 +84,7 @@ ContextMenu::Construct(const Tizen::Graphics::Point& point, ContextMenuStyle sty } result -ContextMenu::Construct(const Tizen::Graphics::FloatPoint& point, ContextMenuStyle style, ContextMenuAnchorDirection direction) +ContextMenu::Construct(const FloatPoint& point, ContextMenuStyle style, ContextMenuAnchorDirection direction) { _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl == null, @@ -94,7 +95,7 @@ ContextMenu::Construct(const Tizen::Graphics::FloatPoint& point, ContextMenuStyl // Create a ContextMenu Impl pImpl = _ContextMenuImpl::CreateContextMenuImplN(this, point, style, direction); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); _pControlImpl = pImpl; @@ -102,7 +103,7 @@ ContextMenu::Construct(const Tizen::Graphics::FloatPoint& point, ContextMenuStyl } void -ContextMenu::AddActionEventListener(Tizen::Ui::IActionEventListener& listener) +ContextMenu::AddActionEventListener(IActionEventListener& listener) { _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -114,7 +115,7 @@ ContextMenu::AddActionEventListener(Tizen::Ui::IActionEventListener& listener) } void -ContextMenu::RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener) +ContextMenu::RemoveActionEventListener(IActionEventListener& listener) { _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -126,7 +127,7 @@ ContextMenu::RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener } result -ContextMenu::AddItem(const Tizen::Base::String& text, int actionId) +ContextMenu::AddItem(const String& text, int actionId) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -134,15 +135,15 @@ ContextMenu::AddItem(const Tizen::Base::String& text, int actionId) result r = E_SUCCESS; r = pImpl->AddItem(text, actionId, null, null, null); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::AddItem(const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap& normalBitmap, - const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +ContextMenu::AddItem(const String& text, int actionId, const Bitmap& normalBitmap, + const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -151,20 +152,16 @@ ContextMenu::AddItem(const Tizen::Base::String& text, int actionId, const Tizen: result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style != CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument at style."); - return E_INVALID_ARG; - } + SysTryReturnResult(NID_UI_CTRL, style == CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style is not of type CONTEXT_MENU_STYLE_LIST."); r = pImpl->AddItem(text, actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, int actionId) +ContextMenu::AddItem(const Bitmap& normalBitmap, const Bitmap* pPressedBitmap, int actionId) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -173,21 +170,17 @@ ContextMenu::AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::G result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style == CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] Invalid argument at style."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, style != CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style cannot be of type CONTEXT_MENU_STYLE_LIST."); - r = pImpl->AddItem(Tizen::Base::String(""), actionId, &normalBitmap, pPressedBitmap, null); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + r = pImpl->AddItem(String(""), actionId, &normalBitmap, pPressedBitmap, null); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap, +ContextMenu::AddItem(const Bitmap& normalBitmap, const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap, int actionId) { // check whether the ContextMenu was created. @@ -197,20 +190,16 @@ ContextMenu::AddItem(const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::G result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style == CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] Invalid argument at style."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, style != CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style cannot be of type CONTEXT_MENU_STYLE_LIST."); - r = pImpl->AddItem(Tizen::Base::String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + r = pImpl->AddItem(String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::InsertItemAt(int index, const Tizen::Base::String& text, int actionId) +ContextMenu::InsertItemAt(int index, const String& text, int actionId) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -218,22 +207,18 @@ ContextMenu::InsertItemAt(int index, const Tizen::Base::String& text, int action result r = E_SUCCESS; - if (index > GetItemCount() || index < 0) - { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - return E_OUT_OF_RANGE; - } + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index <= GetItemCount(), E_OUT_OF_RANGE, "The specified index is not valid(index = %d).", index); r = pImpl->InsertItem(index, text, actionId, null, null, null); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::InsertItemAt(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap& normalBitmap, - const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +ContextMenu::InsertItemAt(int index, const String& text, int actionId, const Bitmap& normalBitmap, + const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -242,26 +227,18 @@ ContextMenu::InsertItemAt(int index, const Tizen::Base::String& text, int action result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style != CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] Invalid argument at style."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, style == CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style is not of type CONTEXT_MENU_STYLE_LIST."); - if (index > GetItemCount() || index < 0) - { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - return E_OUT_OF_RANGE; - } + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index <= GetItemCount(), E_OUT_OF_RANGE, "The specified index (%d) is out of range.", index); r = pImpl->InsertItem(index, text, actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::InsertItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, +ContextMenu::InsertItemAt(int index, const Bitmap& normalBitmap, const Bitmap* pPressedBitmap, int actionId) { // check whether the ContextMenu was created. @@ -271,27 +248,19 @@ ContextMenu::InsertItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style == CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] Invalid argument at style."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, style != CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style cannot be of type CONTEXT_MENU_STYLE_LIST."); - if (index > GetItemCount() || index < 0) - { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - return E_OUT_OF_RANGE; - } + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index <= GetItemCount(), E_OUT_OF_RANGE, "The specified index (%d) is out of range.", index); - r = pImpl->InsertItem(index, Tizen::Base::String(""), actionId, &normalBitmap, pPressedBitmap, null); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + r = pImpl->InsertItem(index, String(""), actionId, &normalBitmap, pPressedBitmap, null); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::InsertItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap, +ContextMenu::InsertItemAt(int index, const Bitmap& normalBitmap, const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap, int actionId) { // check whether the ContextMenu was created. @@ -301,26 +270,18 @@ ContextMenu::InsertItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style == CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] Invalid argument at style."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, style != CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style cannot be of type CONTEXT_MENU_STYLE_LIST."); - if (index > GetItemCount() || index < 0) - { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - return E_OUT_OF_RANGE; - } + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index <= GetItemCount(), E_OUT_OF_RANGE, "The specified index (%d) is out of range.", index); - r = pImpl->InsertItem(index, Tizen::Base::String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + r = pImpl->InsertItem(index, String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::SetItemAt(int index, const Tizen::Base::String& text, int actionId) +ContextMenu::SetItemAt(int index, const String& text, int actionId) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -328,22 +289,18 @@ ContextMenu::SetItemAt(int index, const Tizen::Base::String& text, int actionId) result r = E_SUCCESS; - if (index >= GetItemCount() || index < 0) - { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - return E_OUT_OF_RANGE; - } + SysTryReturnResult(NID_UI_CTRL, index < GetItemCount() && index >= 0, E_OUT_OF_RANGE, "The specified index (%d) is out of range.", index); r = pImpl->SetItem(index, text, actionId, null, null, null); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::SetItemAt(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap& normalBitmap, - const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +ContextMenu::SetItemAt(int index, const String& text, int actionId, const Bitmap& normalBitmap, + const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -352,26 +309,18 @@ ContextMenu::SetItemAt(int index, const Tizen::Base::String& text, int actionId, result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style != CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] Invalid argument at style."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, style == CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style is not of type CONTEXT_MENU_STYLE_LIST."); - if (index >= GetItemCount() || index < 0) - { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - return E_OUT_OF_RANGE; - } + SysTryReturnResult(NID_UI_CTRL, index < GetItemCount() && index >= 0, E_OUT_OF_RANGE, "The specified index (%d) is out of range.", index); r = pImpl->SetItem(index, text, actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::SetItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, +ContextMenu::SetItemAt(int index, const Bitmap& normalBitmap, const Bitmap* pPressedBitmap, int actionId) { // check whether the ContextMenu was created. @@ -381,27 +330,19 @@ ContextMenu::SetItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, c result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style == CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] Invalid argument at style."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, style != CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style cannot be of type CONTEXT_MENU_STYLE_LIST."); - if (index >= GetItemCount() || index < 0) - { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - return E_OUT_OF_RANGE; - } + SysTryReturnResult(NID_UI_CTRL, index < GetItemCount() && index >= 0, E_OUT_OF_RANGE, "The specified index (%d) is out of range.", index); - r = pImpl->SetItem(index, Tizen::Base::String(""), actionId, &normalBitmap, pPressedBitmap, null); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + r = pImpl->SetItem(index, String(""), actionId, &normalBitmap, pPressedBitmap, null); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::SetItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap, +ContextMenu::SetItemAt(int index, const Bitmap& normalBitmap, const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap, int actionId) { // check whether the ContextMenu was created. @@ -411,21 +352,12 @@ ContextMenu::SetItemAt(int index, const Tizen::Graphics::Bitmap& normalBitmap, c result r = E_SUCCESS; ContextMenuStyle style = pImpl->GetPublicStyle(); - if (style == CONTEXT_MENU_STYLE_LIST) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] Invalid argument at style."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, style != CONTEXT_MENU_STYLE_LIST, E_INVALID_ARG, "Invalid argument is used. The style cannot be of type CONTEXT_MENU_STYLE_LIST."); -// if (index >= MAX_ITEM_COUNT || index < 0) - if (index >= GetItemCount() || index < 0) - { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - return E_OUT_OF_RANGE; - } + SysTryReturnResult(NID_UI_CTRL, index < GetItemCount() && index >= 0, E_OUT_OF_RANGE, "The specified index (%d) is out of range.", index); - r = pImpl->SetItem(index, Tizen::Base::String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + r = pImpl->SetItem(index, String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -440,7 +372,7 @@ ContextMenu::RemoveItemAt(int index) result r = E_SUCCESS; r = pImpl->RemoveItemAt(index); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -455,7 +387,7 @@ ContextMenu::RemoveAllItems(void) result r = E_SUCCESS; r = pImpl->RemoveAllItems(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -487,32 +419,27 @@ ContextMenu::GetItemActionIdAt(int index) const const _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); -// if (index > MAX_ITEM_COUNT || index < 0) - if (index >= GetItemCount() || index < 0) - { - SysTryReturn(NID_UI_CTRL, false, -1, E_OUT_OF_RANGE, - "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); - } + SysTryReturn(NID_UI_CTRL, index < GetItemCount() && index >= 0, -1, E_OUT_OF_RANGE, "The specified index (%d) is out of range.", index); return pImpl->GetItemActionIdAt(index); } -Tizen::Graphics::Color +Color ContextMenu::GetItemTextColor(ContextMenuItemStatus status) const { // check whether the ContextMenu was created. const _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); - Tizen::Graphics::Color color = pImpl->GetItemTextColor(status); + Color color = pImpl->GetItemTextColor(status); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Tizen::Graphics::Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); return color; } result -ContextMenu::SetItemTextColor(ContextMenuItemStatus status, const Tizen::Graphics::Color& color) +ContextMenu::SetItemTextColor(ContextMenuItemStatus status, const Color& color) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -521,13 +448,13 @@ ContextMenu::SetItemTextColor(ContextMenuItemStatus status, const Tizen::Graphic result r = E_SUCCESS; r = pImpl->SetItemTextColor(status, color); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::SetAnchorPosition(const Tizen::Graphics::Point& position) +ContextMenu::SetAnchorPosition(const Point& position) { _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -535,66 +462,66 @@ ContextMenu::SetAnchorPosition(const Tizen::Graphics::Point& position) result r = E_SUCCESS; FloatPoint floatPosition = _CoordinateSystemUtils::ConvertToFloat(position); r = pImpl->SetAnchorPosition(floatPosition.x, floatPosition.y); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } result -ContextMenu::SetAnchorPosition(const Tizen::Graphics::FloatPoint& position) +ContextMenu::SetAnchorPosition(const FloatPoint& position) { _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); result r = E_SUCCESS; r = pImpl->SetAnchorPosition(position.x, position.y); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } -Tizen::Graphics::Point +Point ContextMenu::GetAnchorPosition(void) const { const _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); - Tizen::Graphics::FloatPoint position = pImpl->GetAnchorPosition(); + FloatPoint position = pImpl->GetAnchorPosition(); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Tizen::Graphics::Point(0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Point(0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); return _CoordinateSystemUtils::ConvertToInteger(position); } -Tizen::Graphics::FloatPoint +FloatPoint ContextMenu::GetAnchorPositionF(void) const { const _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); - Tizen::Graphics::FloatPoint position = pImpl->GetAnchorPosition(); + FloatPoint position = pImpl->GetAnchorPosition(); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Tizen::Graphics::FloatPoint(0.0f, 0.0f), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, FloatPoint(0.0f, 0.0f), r, "[%s] Propagating.", GetErrorMessage(r)); return position; } -Tizen::Graphics::Color +Color ContextMenu::GetColor(void) const { // check whether the ContextMenu was created. const _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); - Tizen::Graphics::Color color = pImpl->GetColor(); + Color color = pImpl->GetColor(); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Tizen::Graphics::Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); return color; } result -ContextMenu::SetColor(const Tizen::Graphics::Color& color) +ContextMenu::SetColor(const Color& color) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); @@ -603,12 +530,12 @@ ContextMenu::SetColor(const Tizen::Graphics::Color& color) result r = E_SUCCESS; r = pImpl->SetColor(color); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } -Tizen::Graphics::Color +Color ContextMenu::GetItemColor(ContextMenuItemStatus status) const { // check whether the ContextMenu was created. @@ -616,29 +543,29 @@ ContextMenu::GetItemColor(ContextMenuItemStatus status) const SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); SysTryReturn(NID_UI_CTRL, (status != CONTEXT_MENU_ITEM_STATUS_NORMAL), Color(0, 0, 0, 0), E_INVALID_STATE, - "[E_INVALID_ARG] CONTEXT_MENU_ITEM_STATUS_NORMAL is not supported."); + "[%s] Invalid argument is used. CONTEXT_MENU_ITEM_STATUS_NORMAL is not supported.", GetErrorMessage(E_INVALID_ARG)); - Tizen::Graphics::Color color = pImpl->GetItemColor(status); + Color color = pImpl->GetItemColor(status); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Tizen::Graphics::Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); return color; } result -ContextMenu::SetItemColor(ContextMenuItemStatus status, const Tizen::Graphics::Color& color) +ContextMenu::SetItemColor(ContextMenuItemStatus status, const Color& color) { // check whether the ContextMenu was created. _ContextMenuImpl* pImpl = _ContextMenuImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); - SysTryReturn(NID_UI_CTRL, (status != CONTEXT_MENU_ITEM_STATUS_NORMAL), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] CONTEXT_MENU_ITEM_STATUS_NORMAL is not supported."); + SysTryReturnResult(NID_UI_CTRL, (status != CONTEXT_MENU_ITEM_STATUS_NORMAL), E_INVALID_ARG, + "Invalid argument is used. CONTEXT_MENU_ITEM_STATUS_NORMAL is not supported."); result r = E_SUCCESS; r = pImpl->SetItemColor(status, color); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -667,7 +594,7 @@ ContextMenu::SetMaxVisibleItemsCount(int maxItemsCount) result r = E_SUCCESS; r = pImpl->SetMaxVisibleItemsCount(maxItemsCount); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } diff --git a/src/ui/controls/FUiCtrlOptionMenu.cpp b/src/ui/controls/FUiCtrlOptionMenu.cpp index 26048a5..4b39689 100644 --- a/src/ui/controls/FUiCtrlOptionMenu.cpp +++ b/src/ui/controls/FUiCtrlOptionMenu.cpp @@ -49,7 +49,7 @@ OptionMenu::Construct(void) // Create _OptionMenuImpl _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::CreateOptionMenuImplN(*this); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, pOptionMenuImpl != null, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, pOptionMenuImpl != null, r, "Propagating."); // Set _OptionMenuImpl _pControlImpl = pOptionMenuImpl; @@ -63,10 +63,10 @@ OptionMenu::AddActionEventListener(IActionEventListener& listener) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->AddActionEventListener(listener); - SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); } void @@ -75,10 +75,10 @@ OptionMenu::RemoveActionEventListener(IActionEventListener& listener) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->RemoveActionEventListener(listener); - SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); } result @@ -87,10 +87,10 @@ OptionMenu::AddItem(const String& text, int actionId) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->AddItem(text, actionId, null, null, null); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -101,10 +101,10 @@ OptionMenu::AddItem(const Bitmap& normalBitmap, const Bitmap* pPressedBitmap, co ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->AddItem(String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -115,10 +115,10 @@ OptionMenu::AddItem(const String& text, int actionId, const Bitmap& normalBitmap ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->AddItem(text, actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -129,10 +129,10 @@ OptionMenu::InsertItemAt(int mainIndex, const String& text, int actionId) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->InsertItemAt(mainIndex, text, actionId, null, null, null); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -143,10 +143,10 @@ OptionMenu::InsertItemAt(int mainIndex, const Bitmap& normalBitmap, const Bitmap ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->InsertItemAt(mainIndex, String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -157,10 +157,10 @@ OptionMenu::InsertItemAt(int mainIndex, const String& text, int actionId, const ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->InsertItemAt(mainIndex, text, actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -171,10 +171,10 @@ OptionMenu::SetItemAt(int mainIndex, const String& text, int actionId) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->SetItemAt(mainIndex, text, actionId, null, null, null); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -185,10 +185,10 @@ OptionMenu::SetItemAt(int mainIndex, const Bitmap& normalBitmap, const Bitmap* p ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->SetItemAt(mainIndex, String(""), actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -199,10 +199,10 @@ OptionMenu::SetItemAt(int mainIndex, const String &text, int actionId, const Bit ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->SetItemAt(mainIndex, text, actionId, &normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -213,10 +213,10 @@ OptionMenu::RemoveItemAt(int mainIndex) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->RemoveItemAt(mainIndex); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating."); return r; } @@ -227,11 +227,11 @@ OptionMenu::RemoveAllItems(void) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); pOptionMenuImpl->RemoveAllItems(); result r = GetLastResult(); - SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); return; } @@ -242,7 +242,7 @@ OptionMenu::GetItemCount(void) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); int count = pOptionMenuImpl->GetItemCount(); result r = GetLastResult(); @@ -257,7 +257,7 @@ OptionMenu::GetItemIndexFromActionId(int actionId) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); int index = pOptionMenuImpl->GetItemIndexFromActionId(actionId); result r = GetLastResult(); @@ -272,11 +272,11 @@ OptionMenu::GetItemActionIdAt(int mainIndex) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); int actionId = pOptionMenuImpl->GetItemActionIdAt(mainIndex); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), -1, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r)); return actionId; } @@ -287,10 +287,10 @@ OptionMenu::AddSubItem(int mainIndex, const String& text, int actionId) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->AddSubItem(mainIndex, text, actionId); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -301,10 +301,10 @@ OptionMenu::InsertSubItemAt(int mainIndex, int subIndex, const String& text, int ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->InsertSubItemAt(mainIndex, subIndex, text, actionId); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -315,10 +315,10 @@ OptionMenu::SetSubItemAt(int mainIndex, int subIndex, const String& text, int ac ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->SetSubItemAt(mainIndex, subIndex, text, actionId); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -329,10 +329,10 @@ OptionMenu::RemoveSubItemAt(int mainIndex, int subIndex) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->RemoveSubItemAt(mainIndex, subIndex); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -343,11 +343,11 @@ OptionMenu::GetSubItemCount(int mainIndex) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); int count = pOptionMenuImpl->GetSubItemCount(mainIndex); - result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (count >= 0), -1, r, "[%s] Propagating.", GetErrorMessage(r)); + + SysTryReturn(NID_UI_CTRL, (count >= 0), -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); return count; } @@ -358,7 +358,7 @@ OptionMenu::GetSubItemIndexFromActionId(int actionId) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); int index = pOptionMenuImpl->GetSubItemIndexFromActionId(actionId); result r = GetLastResult(); @@ -373,11 +373,11 @@ OptionMenu::GetSubItemActionIdAt(int mainIndex, int subIndex) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); int actionId = pOptionMenuImpl->GetSubItemActionIdAt(mainIndex, subIndex); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), -1, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r)); return actionId; } @@ -388,10 +388,10 @@ OptionMenu::SetItemTextColor(OptionMenuItemStatus status, const Color& color) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->SetItemTextColor(status, color); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -402,11 +402,11 @@ OptionMenu::GetItemTextColor(OptionMenuItemStatus status) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); Color color = pOptionMenuImpl->GetItemTextColor(status); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); return color; } @@ -417,10 +417,10 @@ OptionMenu::SetItemColor(OptionMenuItemStatus status, const Color& color) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->SetItemColor(status, color); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -431,14 +431,14 @@ OptionMenu::GetItemColor(OptionMenuItemStatus status) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); SysTryReturn(NID_UI_CTRL, (status != OPTION_MENU_ITEM_STATUS_NORMAL), Color(0, 0, 0, 0), E_INVALID_ARG, - "[E_INVALID_ARG] OPTION_MENU_ITEM_STATUS_NORMAL is not supported."); + "[%s] Invalid argument is used. OPTION_MENU_ITEM_STATUS_NORMAL is not supported.", GetErrorMessage(E_INVALID_ARG)); Color color = pOptionMenuImpl->GetItemColor(status); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); return color; } @@ -449,10 +449,10 @@ OptionMenu::SetColor(const Color& color) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->SetColor(color); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -463,11 +463,11 @@ OptionMenu::GetColor(void) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); Color color = pOptionMenuImpl->GetColor(); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, Color(0, 0, 0, 0), r, "[%s] Propagating.", GetErrorMessage(r)); return color; } @@ -478,10 +478,10 @@ OptionMenu::SetMaxVisibleItemsCount(int maxItemsCount) ClearLastResult(); _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); result r = pOptionMenuImpl->SetMaxVisibleItemsCount(maxItemsCount); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return r; } @@ -492,11 +492,11 @@ OptionMenu::GetMaxVisibleItemsCount(void) const ClearLastResult(); const _OptionMenuImpl* pOptionMenuImpl = _OptionMenuImpl::GetInstance(*this); - SysAssertf((pOptionMenuImpl != null), "Not yet constructed. Construct() should be called before use."); + SysAssertf(pOptionMenuImpl != null, "Not yet constructed. Construct() should be called before use."); int count = pOptionMenuImpl->GetMaxVisibleItemsCount(); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), -1, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r)); return count; } diff --git a/src/ui/controls/FUiCtrlTabBar.cpp b/src/ui/controls/FUiCtrlTabBar.cpp index e4e4443..e4da941 100644 --- a/src/ui/controls/FUiCtrlTabBar.cpp +++ b/src/ui/controls/FUiCtrlTabBar.cpp @@ -28,6 +28,7 @@ using namespace Tizen::Graphics; using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui; namespace Tizen { namespace Ui { namespace Controls { @@ -54,7 +55,7 @@ TabBar::Construct(int x, int y, int width) float floatWidth = _CoordinateSystemUtils::ConvertToFloat(width); pImpl = _TabBarImpl::CreateTabBarImplN(this, FloatRectangle(floatX, floatY, floatWidth, 0.0f)); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, pImpl, r, "Propagating."); _pControlImpl = pImpl; @@ -70,7 +71,7 @@ TabBar::Construct(float x, float y, float width) pImpl = _TabBarImpl::CreateTabBarImplN(this, FloatRectangle(x, y, width, 0.0f)); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, pImpl, r, "Propagating."); _pControlImpl = pImpl; @@ -82,8 +83,8 @@ TabBar::AddItem(const TabBarItem& item) { _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); - SysTryReturn(NID_UI_CTRL, item.__pTabBarItemImpl != null, E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] Input TabBarItem is not constructed.\n"); + SysTryReturnResult(NID_UI_CTRL, item.__pTabBarItemImpl != null, E_INVALID_ARG, + "Invalid argument is used. Input TabBarItem is not constructed.\n"); return pImpl->AddItem(item.GetText(), item.GetActionId()); } @@ -93,13 +94,13 @@ TabBar::InsertItemAt(int index, const TabBarItem& item) { _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); - SysTryReturn(NID_UI_CTRL, item.__pTabBarItemImpl != null, E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] Input TabBarItem is not constructed.\n"); + SysTryReturnResult(NID_UI_CTRL, item.__pTabBarItemImpl != null, E_INVALID_ARG, + "Invalid argument is used. Input TabBarItem is not constructed.\n"); return pImpl->InsertItemAt(index, item.GetText(), item.GetActionId()); } -Tizen::Graphics::Color +Color TabBar::GetColor(void) const { const _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); @@ -117,7 +118,7 @@ TabBar::GetItemCount(void) const return pImpl->GetItemCount(); } -Tizen::Graphics::Color +Color TabBar::GetSelectedItemColor(void) const { const _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); @@ -126,7 +127,7 @@ TabBar::GetSelectedItemColor(void) const return pImpl->GetSelectedItemColor(); } -Tizen::Graphics::Color +Color TabBar::GetItemTextColor(TabBarItemStatus status) const { const _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); @@ -163,7 +164,7 @@ TabBar::RemoveAllItems(void) } result -TabBar::SetColor(const Tizen::Graphics::Color& color) +TabBar::SetColor(const Color& color) { _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -176,8 +177,8 @@ TabBar::SetItemAt(int index, const TabBarItem& item) { _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); - SysTryReturn(NID_UI_CTRL, item.__pTabBarItemImpl != null, E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] Input TabBarItem is not constructed.\n"); + SysTryReturnResult(NID_UI_CTRL, item.__pTabBarItemImpl != null, E_INVALID_ARG, + "Invalid argument is used. Input TabBarItem is not constructed.\n"); return pImpl->SetItemAt(index, item.GetText(), item.GetActionId()); } @@ -192,7 +193,7 @@ TabBar::SetItemSelected(int index) } result -TabBar::SetItemTextColor(TabBarItemStatus status, const Tizen::Graphics::Color& color) +TabBar::SetItemTextColor(TabBarItemStatus status, const Color& color) { _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -201,7 +202,7 @@ TabBar::SetItemTextColor(TabBarItemStatus status, const Tizen::Graphics::Color& } result -TabBar::SetSelectedItemColor(const Tizen::Graphics::Color& color) +TabBar::SetSelectedItemColor(const Color& color) { _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -228,7 +229,7 @@ TabBar::SetWidth(float width) } void -TabBar::AddActionEventListener(Tizen::Ui::IActionEventListener& listener) +TabBar::AddActionEventListener(IActionEventListener& listener) { _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -238,7 +239,7 @@ TabBar::AddActionEventListener(Tizen::Ui::IActionEventListener& listener) void -TabBar::RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener) +TabBar::RemoveActionEventListener(IActionEventListener& listener) { _TabBarImpl* pImpl = _TabBarImpl::GetInstance(*this); SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); diff --git a/src/ui/controls/FUiCtrlTabBarItem.cpp b/src/ui/controls/FUiCtrlTabBarItem.cpp index 8af9e54..7ee91f2 100644 --- a/src/ui/controls/FUiCtrlTabBarItem.cpp +++ b/src/ui/controls/FUiCtrlTabBarItem.cpp @@ -26,6 +26,7 @@ #include "FUiCtrl_TabBarItemImpl.h" using namespace Tizen::Ui::Controls; +using namespace Tizen::Base; namespace Tizen { namespace Ui { namespace Controls { @@ -42,7 +43,7 @@ TabBarItem::~TabBarItem(void) } result -TabBarItem::Construct(const Tizen::Base::String& text, int actionId) +TabBarItem::Construct(const String& text, int actionId) { SysAssertf(__pTabBarItemImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class."); @@ -61,8 +62,7 @@ TabBarItem::Construct(const Tizen::Base::String& text, int actionId) result TabBarItem::SetActionId(int actionId) { - - SysTryReturnResult(NID_UI_CTRL, __pTabBarItemImpl != null, E_INVALID_STATE, "This instance is not constructed"); + SysTryReturnResult(NID_UI_CTRL, __pTabBarItemImpl != null, E_INVALID_STATE, "__pTabBarItemImpl must not be null"); SysTryReturnResult(NID_UI_CTRL, actionId >= 0, E_INVALID_ARG, "The action ID of the item must be a positive integer."); @@ -73,27 +73,27 @@ TabBarItem::SetActionId(int actionId) int TabBarItem::GetActionId(void) const { - SysTryReturn(NID_UI_CTRL, __pTabBarItemImpl != null, -1, E_INVALID_STATE, "This instance is not constructed"); + SysTryReturn(NID_UI_CTRL, __pTabBarItemImpl != null, -1, E_INVALID_STATE, "[%s] __pTabBarItemImpl must not be null", GetErrorMessage(E_INVALID_STATE)); SetLastResult(E_SUCCESS); return __pTabBarItemImpl->GetActionId(); } -Tizen::Base::String +String TabBarItem::GetText(void) const { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, __pTabBarItemImpl != null, Tizen::Base::String(), E_INVALID_STATE, "This instance is not constructed"); + SysTryReturn(NID_UI_CTRL, __pTabBarItemImpl != null, String(), E_INVALID_STATE, "[%s] __pTabBarItemImpl must not be null", GetErrorMessage(E_INVALID_STATE)); SetLastResult(E_SUCCESS); return __pTabBarItemImpl->GetText(); } result -TabBarItem::SetText(const Tizen::Base::String& text) +TabBarItem::SetText(const String& text) { - SysTryReturnResult(NID_UI_CTRL, __pTabBarItemImpl != null, E_INVALID_STATE, "This instance is not constructed"); + SysTryReturnResult(NID_UI_CTRL, __pTabBarItemImpl != null, E_INVALID_STATE, "__pTabBarItemImpl must not be null"); __pTabBarItemImpl->SetText(text); diff --git a/src/ui/controls/FUiCtrl_ContextMenu.cpp b/src/ui/controls/FUiCtrl_ContextMenu.cpp index 4b2c35b..b83347e 100644 --- a/src/ui/controls/FUiCtrl_ContextMenu.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenu.cpp @@ -39,6 +39,7 @@ using namespace Tizen::Graphics; using namespace Tizen::Media; using namespace Tizen::Ui::Animations; +using namespace Tizen::Ui; namespace { static const float TOUCH_PRESS_THRESHOLD_INSENSITIVE = 0.16f; @@ -153,7 +154,7 @@ _ContextMenu* _ContextMenu::CreateContextMenuN(const FloatPoint& point, enum ContextMenuCoreStyle style, enum ContextMenuCoreAlign contextMenuAlign) { _ContextMenu* pContextMenu = new (std::nothrow) _ContextMenu(point, style, contextMenuAlign); - SysTryReturn(NID_UI_CTRL, pContextMenu != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pContextMenu != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); result r = E_SUCCESS; @@ -187,7 +188,8 @@ _ContextMenu::CreateContextMenuN(const FloatPoint& point, enum ContextMenuCoreSt pContextMenu->__pScrollPanel->SetFocusable(false); _Scroll* pScroll = pContextMenu->__pScrollPanel->GetScrollBar(); - SysTryCatch(NID_UI_CTRL, pScroll, , E_INVALID_STATE, "[E_INVALID_STATE] _Scroll isn't constructed"); + SysTryCatch(NID_UI_CTRL, pScroll, , E_INVALID_STATE, + "[%s] pScroll is in invalid state. _Scroll is not constructed.", GetErrorMessage(E_INVALID_STATE)); pScroll->SetContextMenuScrollType(true); pContextMenu->AttachChild(*(pContextMenu->__pScrollPanel)); @@ -214,15 +216,15 @@ _ContextMenu::Install(void) // load bitmap of a background and arrow r = LoadBitmap(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to load bitmap."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to load bitmap."); r = __actionId.Construct(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to construct arraylist."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to construct arraylist."); if (__style == CONTEXT_MENU_CORE_STYLE_LIST) { _IContextMenuPresenter* pPresenter = new (std::nothrow) _ContextMenuListPresenter(this); - SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "Memory allocation failed."); SetPresenter(*pPresenter); @@ -231,7 +233,7 @@ _ContextMenu::Install(void) else { _IContextMenuPresenter* pPresenter = new (std::nothrow) _ContextMenuGridPresenter(this); - SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "Memory allocation failed."); SetPresenter(*pPresenter); @@ -253,7 +255,7 @@ _ContextMenu::Initialize(void) Color itemTextSelectedColor; r = SetBounds(FloatRectangle(0.0f, 0.0f, screen.width, screen.height)); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "SetBounds failed."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set bounds."); SetMovable(false); SetResizable(false); @@ -308,7 +310,7 @@ _ContextMenu::OnAttachedToMainTree(void) if (pOwner == null) { __pCurrentFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame()); - SysTryReturn(NID_UI_CTRL, __pCurrentFrame != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Current frame instance is not available."); + SysTryReturnResult(NID_UI_CTRL, __pCurrentFrame != null, E_SYSTEM, "Failed to get current frame instance."); _Form* pForm = __pCurrentFrame->GetCurrentForm(); pForm != null ? SetOwner(pForm) : SetOwner(__pCurrentFrame); @@ -366,7 +368,7 @@ _ContextMenu::OnAttachedToMainTree(void) } r = __pContextMenuPresenter->CalculateWindowRect(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating."); if (__pScrollPanel != null) { @@ -489,7 +491,7 @@ _ContextMenu::AddItem(const Base::String& text, int actionId, const Bitmap* pNor result r = E_SUCCESS; r = __pContextMenuPresenter->AddItem(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to add a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add a item."); __actionId.Add(actionId); @@ -507,7 +509,7 @@ _ContextMenu::InsertItem(int index, const Base::String& text, int actionId, cons result r = E_SUCCESS; r = __pContextMenuPresenter->InsertItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to insert a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to insert a item."); __actionId.InsertAt(actionId, index); @@ -524,7 +526,7 @@ _ContextMenu::SetItem(int index, const Base::String& text, int actionId, const B result r = E_SUCCESS; r = __pContextMenuPresenter->SetItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to set a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set a item."); __actionId.SetAt(actionId, index); @@ -539,7 +541,7 @@ _ContextMenu::RemoveItemAt(int index) result r = E_SUCCESS; r = __pContextMenuPresenter->DeleteItem(index); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove a item."); __actionId.RemoveAt(index); @@ -555,7 +557,7 @@ _ContextMenu::RemoveAllItems(void) result r = E_SUCCESS; r = __pContextMenuPresenter->DeleteItemAll(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove all items."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove all items."); __actionId.RemoveAll(); @@ -594,6 +596,7 @@ _ContextMenu::GetItemActionIdAt(int index) const { int count = __actionId.GetCount(); int actionId = -1; + result r = E_SUCCESS; if (count <= 0 || index >= count) @@ -689,12 +692,7 @@ _ContextMenu::SetPropertyMaxVisibleItemsCount(const Variant& count) { int showCount = count.ToInt(); - if (showCount < 1) - { - SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Count is invalid."); - return E_INVALID_ARG; - } - + SysTryReturnResult(NID_UI_CTRL, showCount > 0, E_INVALID_ARG, "Invalid argument is used. Count is invalid."); __showItemCount = showCount; @@ -704,7 +702,7 @@ _ContextMenu::SetPropertyMaxVisibleItemsCount(const Variant& count) Variant _ContextMenu::GetPropertyMaxVisibleItemsCount(void) const { - return Tizen::Ui::Variant(__showItemCount); + return Variant(__showItemCount); } int @@ -727,12 +725,12 @@ _ContextMenu::SetShowItemCount(int count) result r; r = SetProperty("maxVisibleItemsCount", Variant(count)); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to set property."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set show item count."); if (__style == CONTEXT_MENU_CORE_STYLE_LIST) { r = __pContextMenuPresenter->CalculateWindowRect(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to calculate window."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to calculate window."); } return E_SUCCESS; @@ -751,7 +749,7 @@ _ContextMenu::SetPropertyColor(const Variant& color) Variant _ContextMenu::GetPropertyColor(void) const { - return Tizen::Ui::Variant(__backgroundColor); + return Variant(__backgroundColor); } result @@ -779,7 +777,7 @@ _ContextMenu::SetPropertyNormalItemColor(const Variant& color) Variant _ContextMenu::GetPropertyNormalItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL]); + return Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL]); } result @@ -793,7 +791,7 @@ _ContextMenu::SetPropertyPressedItemColor(const Variant& color) Variant _ContextMenu::GetPropertyPressedItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED]); + return Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED]); } result @@ -807,7 +805,7 @@ _ContextMenu::SetPropertyHighlightedItemColor(const Variant & color) Variant _ContextMenu::GetPropertyHighlightedItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]); + return Variant(__itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]); } result @@ -869,7 +867,7 @@ _ContextMenu::SetPropertyNormalItemTextColor(const Variant& color) Variant _ContextMenu::GetPropertyNormalItemTextColor(void) const { - return Tizen::Ui::Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL]); + return Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_NORMAL]); } result @@ -883,7 +881,7 @@ _ContextMenu::SetPropertyPressedItemTextColor(const Variant& color) Variant _ContextMenu::GetPropertyPressedItemTextColor(void) const { - return Tizen::Ui::Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED]); + return Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED]); } result @@ -897,7 +895,7 @@ _ContextMenu::SetPropertyHighlightedItemTextColor(const Variant & color) Variant _ContextMenu::GetPropertyHighlightedItemTextColor(void) const { - return Tizen::Ui::Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]); + return Variant(__textColor[CONTEXT_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]); } result @@ -949,18 +947,17 @@ _ContextMenu::GetTextColor(enum ContextMenuCoreItemStatus status) const } result -_ContextMenu::AddActionEventListener(const Tizen::Ui::Controls::_IActionEventListener& listener) +_ContextMenu::AddActionEventListener(const _IActionEventListener& listener) { result r = E_SUCCESS; if (__pActionEvent == null) { __pActionEvent = _ActionEvent::CreateInstanceN(*this); - SysTryReturn(NID_UI_CTRL, __pActionEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, - "[E_OUT_OF_MEMORY] Memory allocation failed.") + SysTryReturnResult(NID_UI_CTRL, __pActionEvent != null, GetLastResult(), "Propagating.") r = __pActionEvent->AddListener(listener); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to remove an action event listener.") + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to remove action event listener.") } return r; @@ -972,20 +969,20 @@ CATCH: } result -_ContextMenu::RemoveActionEventListener(const Tizen::Ui::Controls::_IActionEventListener& listener) +_ContextMenu::RemoveActionEventListener(const _IActionEventListener& listener) { - SysTryReturn(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE, E_INVALID_STATE, - "[E_INVALID_STATE] The action event instance isn't constructed.") + SysTryReturnResult(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE, + "__pActionEvent must not be null.") result r = E_SUCCESS; r = __pActionEvent->RemoveListener(listener); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove an action event listener") + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove action event listener.") return r; } -Tizen::Ui::Controls::_ActionEvent* +_ActionEvent* _ContextMenu::GetActionEvent(void) const { return __pActionEvent; @@ -1055,7 +1052,7 @@ CATCH: } result -_ContextMenu::LoadColorReplacedBitmap(const Tizen::Graphics::Color& color) +_ContextMenu::LoadColorReplacedBitmap(const Color& color) { // Delete old bitmap if (__pBackgroundNormalBitmap != null) @@ -1093,7 +1090,7 @@ _ContextMenu::LoadColorReplacedBitmap(const Tizen::Graphics::Color& color) GET_REPLACED_BITMAP_CONFIG_N(CONTEXTMENU::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, color, __pBackgroundNormalBitmap); r = GetLastResult(); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s]Failed to load bitmap.", GetErrorMessage(r)); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to load bitmap.", GetErrorMessage(r)); return r; @@ -1138,7 +1135,7 @@ _ContextMenu::GetPressedBitmap(void) result r; GET_REPLACED_BITMAP_CONFIG_N(CONTEXTMENU::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __itemColor[CONTEXT_MENU_CORE_ITEM_STATUS_PRESSED], __pPressedBitmap); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s]Failed to load bitmap.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Failed to load bitmap.", GetErrorMessage(r)); return __pPressedBitmap; } @@ -1266,7 +1263,7 @@ _ContextMenu::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinf } void -_ContextMenu::OnFontChanged(Tizen::Graphics::Font* pFont) +_ContextMenu::OnFontChanged(Font* pFont) { return __pContextMenuPresenter->OnFontChanged(pFont); } diff --git a/src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp b/src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp index 79640d0..4092b2c 100644 --- a/src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp @@ -31,7 +31,6 @@ #include "FUi_ResourceManager.h" #include "FUiCtrl_ActionEvent.h" #include "FUiCtrl_IActionEventListener.h" - #include "FUiCtrl_ContextMenuGridPresenter.h" using namespace Tizen::Graphics; @@ -115,17 +114,17 @@ _ContextMenuGridPresenter::Install(void) LoadShape(); __pModel = new (std::nothrow) _ContextMenuModel; - SysTryCatch(NID_UI_CTRL, __pModel != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage."); + SysTryReturnResult(NID_UI_CTRL, __pModel != null, E_OUT_OF_MEMORY, "Memory allocation failed."); r = __pModel->Construct(); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create data instance."); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pFont = __pContextMenu->GetFallbackFont(); r = GetLastResult(); SysTryCatch(NID_UI_CTRL, (__pFont != null), , r, "[%s] Propagating.", GetErrorMessage(r)); __pTextObject = new (std::nothrow) TextObject(); - SysTryCatch(NID_UI_CTRL, __pTextObject, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create data instance."); + SysTryCatch(NID_UI_CTRL, __pTextObject, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pTextObject->Construct(); __pTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE); @@ -181,10 +180,10 @@ _ContextMenuGridPresenter::LoadShape(void) } _ContextMenuItem* -_ContextMenuGridPresenter::CreateItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuGridPresenter::CreateItemN(const Base::String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap) { _ContextMenuItem* pItem = _ContextMenuItem::CreateContextMenuItemN(); - SysTryReturn(NID_UI_CTRL, pItem != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pItem != null, null, GetLastResult(), "[%s] pItem must not be null.", GetErrorMessage(GetLastResult())); ContextMenuItemDrawingType itemType = CONTEXT_MENU_ITEM_DRAWING_TYPE_NONE; result r = E_SUCCESS; @@ -241,12 +240,12 @@ _ContextMenuGridPresenter::CreateItem(const Base::String& text, int actionId, co } result -_ContextMenuGridPresenter::AddItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* normalBitmap, - const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuGridPresenter::AddItem(const Base::String& text, int actionId, const Bitmap* pNormalBitmap, + const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { - _ContextMenuItem* pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + _ContextMenuItem* pItem = CreateItemN(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); result r = __pModel->AddItem(pItem); @@ -260,76 +259,74 @@ _ContextMenuGridPresenter::AddItem(const Base::String& text, int actionId, const if (r != E_SUCCESS) { result rt = __pModel->RemoveItem(__pModel->GetItemCount() - 1); - SysTryReturn(NID_UI_CTRL, rt == E_SUCCESS, rt, rt, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnResult(NID_UI_CTRL, rt == E_SUCCESS, rt, "Propagating."); - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to adjust item layout."); } return r; } result -_ContextMenuGridPresenter::InsertItem(int index, const Tizen::Base::String& text, int actionId, - const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuGridPresenter::InsertItem(int index, const String& text, int actionId, + const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { - if (text.GetLength() == 0 && normalBitmap == null && pPressedBitmap == null) - { - return E_INVALID_ARG; - } + SysTryReturnResult(NID_UI_CTRL, (text.GetLength() != 0 || pNormalBitmap != null || pPressedBitmap != null), E_INVALID_ARG, + "Invalid argument(s) is used. If text is empty then pNormalBitmap or pPressedBitmap must not be null."); _ContextMenuItem* pItem = null; - pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + pItem = CreateItemN(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed."); result r = __pModel->InsertItem(pItem, index); if (r != E_SUCCESS) { delete pItem; - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to insert item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to insert item."); } r = AdjustItemLayout(); if (r != E_SUCCESS) { result rt = __pModel->RemoveItem(index); - SysTryReturn(NID_UI_CTRL, rt == E_SUCCESS, rt, rt, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnResult(NID_UI_CTRL, rt == E_SUCCESS, rt, "Propagating."); - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to insert item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to adjust item layout."); } return E_SUCCESS; } result -_ContextMenuGridPresenter::SetItem(int index, const Tizen::Base::String& text, int actionId, - const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuGridPresenter::SetItem(int index, const String& text, int actionId, + const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { - if (text.GetLength() == 0 && normalBitmap == null && pPressedBitmap == null) - { - return E_INVALID_ARG; - } + SysTryReturnResult(NID_UI_CTRL, (text.GetLength() != 0 || pNormalBitmap != null || pPressedBitmap != null), E_INVALID_ARG, + "Invalid argument(s) is used. If text is empty then pNormalBitmap or pPressedBitmap must not be null."); _ContextMenuItem* pItem = null; - pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + + pItem = CreateItemN(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); + result r = __pModel->SetItem(pItem, index); if (r != E_SUCCESS) { delete pItem; - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to set item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to set item."); } r = AdjustItemLayout(); if (r != E_SUCCESS) { result rt = __pModel->RemoveItem(index); - SysTryReturn(NID_UI_CTRL, rt == E_SUCCESS, rt, rt, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnResult(NID_UI_CTRL, rt == E_SUCCESS, rt, "Propagating."); - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to set item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to adjust item layout."); } return E_SUCCESS; @@ -340,14 +337,11 @@ _ContextMenuGridPresenter::DeleteItem(int index) { int itemCount = __pContextMenu->GetItemCount(); - if (itemCount <= 0 || index >= itemCount || index < 0) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "Invalid argument."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, itemCount > 0, E_INVALID_STATE, "__pContextMenu is in invalid state. Itemcount must be > 0."); + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index < itemCount , E_INVALID_ARG, "Invalid argument is used. Index (%d) is not valid", index); result r = __pModel->RemoveItem(index); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to delete item."); return r; } @@ -357,14 +351,10 @@ _ContextMenuGridPresenter::DeleteItemAll(void) { int itemCount = __pContextMenu->GetItemCount(); - if (itemCount <= 0) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "Invalid argument."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, itemCount > 0, E_INVALID_STATE, "__pContextMenu is in invalid state. Itemcount must be > 0."); result r = __pModel->RemoveAllItem(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item all."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to delete all items."); return r; } @@ -428,10 +418,10 @@ _ContextMenuGridPresenter::CalculateWindowRect(void) result r = E_SUCCESS; r = AdjustItemLayout(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); r = CalculateRect(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); AdjustItemPosition(); @@ -447,10 +437,10 @@ _ContextMenuGridPresenter::ApplyColorProperty(void) result _ContextMenuGridPresenter::CalculateRect(void) { - Tizen::Graphics::FloatRectangle windowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu window itself - Tizen::Graphics::FloatRectangle bodyRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // bg surronding showing items, relative to window - Tizen::Graphics::FloatRectangle arrowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window - Tizen::Graphics::FloatRectangle itemRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window + FloatRectangle windowRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu window itself + FloatRectangle bodyRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // bg surronding showing items, relative to window + FloatRectangle arrowRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window + FloatRectangle itemRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window float bodyTopMargin = __topMargin; float bodyBottomMargin = __bottomMargin; @@ -465,6 +455,7 @@ _ContextMenuGridPresenter::CalculateRect(void) FloatPoint anchorPosition = __pContextMenu->GetAnchorPosition(); FloatDimension screen = _ControlManager::GetInstance()->GetScreenSizeF(); + if (__pContextMenu->GetLayout() == _CONTROL_ORIENTATION_LANDSCAPE) { screen.SetSize(screen.height, screen.width); @@ -823,7 +814,7 @@ _ContextMenuGridPresenter::AdjustItemLayout(void) return GetLastResult(); } -Tizen::Graphics::FloatDimension +FloatDimension _ContextMenuGridPresenter::AdjustItemLayoutIconStyle(void) { ClearLastResult(); @@ -834,11 +825,8 @@ _ContextMenuGridPresenter::AdjustItemLayoutIconStyle(void) float itemHeight = __itemHeight + __itemGap; FloatDimension layoutSize(0.0f, 0.0f); - if (itemCount > MAX_ITEM_COUNT) - { - SetLastResult(E_MAX_EXCEEDED); - return layoutSize; - } + SysTryReturn(NID_UI_CTRL, itemCount <= MAX_ITEM_COUNT, layoutSize, E_MAX_EXCEEDED, + "[%s] ItemCount exceeds the maximum limit.", GetErrorMessage(E_MAX_EXCEEDED)); countPerLine = GetCountPerLine(itemCount); @@ -931,7 +919,7 @@ _ContextMenuGridPresenter::AdjustItemLayoutIconStyle(void) } -Tizen::Graphics::FloatDimension +FloatDimension _ContextMenuGridPresenter::AdjustItemLayoutTabStyle(void) { ClearLastResult(); @@ -1157,7 +1145,7 @@ _ContextMenuGridPresenter::GetCountPerLine(int count) const } int -_ContextMenuGridPresenter::GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& point) const +_ContextMenuGridPresenter::GetItemIndexFromPosition(const FloatPoint& point) const { int index = -1; int itemCount = __pModel->GetItemCount(); @@ -1197,18 +1185,20 @@ _ContextMenuGridPresenter::Draw(void) result r = E_SUCCESS; Canvas* pCanvas = __pContextMenu->GetCanvasN(); - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + + r = GetLastResult(); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); // Clear canvas for drawing area of the ContextMenu. pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - Tizen::Graphics::FloatRectangle bounds(__pContextMenu->GetWindowRect()); - pCanvas->Clear(Tizen::Graphics::FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height)); + FloatRectangle bounds(__pContextMenu->GetWindowRect()); + pCanvas->Clear(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height)); r = DrawBackground(pCanvas); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to draw background."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to draw background."); r = DrawArrow(pCanvas); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to draw arrow."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to draw arrow."); r = DrawItem(pCanvas); @@ -1220,11 +1210,11 @@ _ContextMenuGridPresenter::Draw(void) result _ContextMenuGridPresenter::DrawBackground(Canvas* pCanvas) { - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error occurred. pCanvas is null."); result r = E_SUCCESS; - Tizen::Graphics::FloatRectangle bodyRect = __pContextMenu->GetBodyRect(); + FloatRectangle bodyRect = __pContextMenu->GetBodyRect(); const Bitmap* pBackgroundNormalBitmap = __pContextMenu->GetBackgroundNormalBitmap(); const Bitmap* pBackgroundEffectBitmap = __pContextMenu->GetBackgroundEffectBitmap(); @@ -1253,10 +1243,10 @@ _ContextMenuGridPresenter::DrawBackground(Canvas* pCanvas) result _ContextMenuGridPresenter::DrawArrow(Canvas* pCanvas) { - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error occurred. pCanvas is null."); result r = E_SUCCESS; - Tizen::Graphics::FloatRectangle arrowRect = __pContextMenu->GetArrowRect(); + FloatRectangle arrowRect = __pContextMenu->GetArrowRect(); ContextMenuCoreDropPosition dropPosition = __pContextMenu->GetDropPosition(); const Bitmap* pArrowNormalBitmap = __pContextMenu->GetArrowNormalBitmap(dropPosition); @@ -1276,9 +1266,9 @@ _ContextMenuGridPresenter::DrawArrow(Canvas* pCanvas) } result -_ContextMenuGridPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas) +_ContextMenuGridPresenter::DrawItem(Canvas* pCanvas) { - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error occurred. pCanvas is null."); result r = E_SUCCESS; TextSimple* pSimpleText = null; @@ -1368,7 +1358,7 @@ _ContextMenuGridPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas) __pTextObject->RemoveAll(); pSimpleText = new (std::nothrow)TextSimple(const_cast (text.GetPointer()), text.GetLength()); - SysTryReturn(NID_UI_CTRL, pSimpleText != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pSimpleText != null, E_OUT_OF_MEMORY, "Memory allocation failed."); __pTextObject->AppendElement(*pSimpleText); __pTextObject->SetForegroundColor(__pContextMenu->GetTextColor(itemStatus), 0, __pTextObject->GetTextLength()); @@ -1416,6 +1406,7 @@ _ContextMenuGridPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas) Color contentHighlightedColor; GET_COLOR_CONFIG(FOCUSUI::CONTENT_BG_HIGHLIGHTED, contentHighlightedColor); + Bitmap* pBitmap = null; result r = GET_REPLACED_BITMAP_CONFIG_N(FOCUSUI::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, contentHighlightedColor, pBitmap); SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to load bitmap."); @@ -1434,9 +1425,9 @@ _ContextMenuGridPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas) } result -_ContextMenuGridPresenter::DrawLine(Tizen::Graphics::Canvas* pCanvas, Tizen::Graphics::FloatPoint point1, Tizen::Graphics::FloatPoint point2, bool drawVLine) +_ContextMenuGridPresenter::DrawLine(Canvas* pCanvas, FloatPoint point1, FloatPoint point2, bool drawVLine) { - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error occurred. pCanvas is null."); result r = E_SUCCESS; @@ -1881,11 +1872,13 @@ _ContextMenuGridPresenter::SetAllAccessibilityElement(void) if (pContainer != null) { _AccessibilityElement* pElementContextMenu = new (std::nothrow) _AccessibilityElement(true); - SysTryReturnVoidResult(NID_UI_CTRL, pElementContextMenu, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage."); + SysTryReturnVoidResult(NID_UI_CTRL, pElementContextMenu, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pElementContextMenu->SetSupportOperatingGesture(false); + pElementContextMenu->SetTraitWithStringId("IDS_TPLATFORM_BODY_CONTEXTUAL_POP_UP_T_TTS"); pElementContextMenu->SetHintWithStringId("IDS_TPLATFORM_BODY_CONTEXTUAL_POP_UP_IS_OPEN_DOUBLE_TAP_TO_CLOSE_THE_POP_UP_T_TTS"); + pElementContextMenu->SetBounds(FloatRectangle(0.0f, 0.0f, __pContextMenu->GetBoundsF().width, __pContextMenu->GetBoundsF().height)); pContainer->AddElement(*pElementContextMenu); __pContextMenu->AddAccessibilityElement(*pElementContextMenu); @@ -1900,14 +1893,14 @@ _ContextMenuGridPresenter::SetAllAccessibilityElement(void) pElement->SetName(L"ContextMenuItem" + Integer::ToString(i)); if (pItem->GetType() == CONTEXT_MENU_ITEM_DRAWING_TYPE_BITMAP) { - pElement->SetLabelWithStringId("IDS_TPLATFORM_BODY_ICON"); + pElement->SetLabelWithStringId("IDS_TPLATFORM_BODY_ICON."); } else { pElement->SetLabel(pItem->GetText()); } - pElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_CONTEXTUAL_POP_UP_T_TTS"); + pElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_CONTEXTUAL_POP_UP_T_TTS."); pElement->SetBounds(pItem->GetDrawRect()); pContainer->AddElement(*pElement); __pContextMenu->AddAccessibilityElement(*pElement); @@ -1950,18 +1943,18 @@ _ContextMenuGridPresenter::SetTopDrawnItemIndex(int index) } result -_ContextMenuGridPresenter::DrawBitmap(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Graphics::Bitmap& bitmap) +_ContextMenuGridPresenter::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap) { result r = E_SUCCESS; if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap)) { r = canvas.DrawNinePatchedBitmap(bounds, bitmap); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw ninepatched bitmap.") + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to draw ninepatched bitmap.") } else { r = canvas.DrawBitmap(bounds, bitmap); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Fail to draw bitmap.") + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to draw bitmap.") } return r; diff --git a/src/ui/controls/FUiCtrl_ContextMenuImpl.cpp b/src/ui/controls/FUiCtrl_ContextMenuImpl.cpp index 5f99ae3..595414b 100644 --- a/src/ui/controls/FUiCtrl_ContextMenuImpl.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenuImpl.cpp @@ -30,6 +30,7 @@ using namespace Tizen::App; using namespace Tizen::Base; using namespace Tizen::Graphics; +using namespace Tizen::Ui; namespace Tizen { namespace Ui { namespace Controls { @@ -107,7 +108,7 @@ _ContextMenuImpl::CreateContextMenuImplN(ContextMenu* pPublic, const FloatPoint& } _ContextMenu* pCore = _ContextMenu::CreateContextMenuN(point, coreStyle, contextMenuAlign); - SysTryReturn(NID_UI_CTRL, pCore != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pCore != null, null, GetLastResult(), "[%s] Propogating.", GetErrorMessage(GetLastResult())); _ContextMenuImpl* pImpl = new (std::nothrow) _ContextMenuImpl(pPublic, pCore, style); r = CheckConstruction(pCore, pImpl); @@ -137,35 +138,29 @@ _ContextMenuImpl::_Dispose(void) } result -_ContextMenuImpl::AddItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, - const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuImpl::AddItem(const Base::String& text, int actionId, const Bitmap* pNormalBitmap, + const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->AddItem(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); } result -_ContextMenuImpl::InsertItem(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, - const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuImpl::InsertItem(int index, const String& text, int actionId, const Bitmap* pNormalBitmap, + const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->InsertItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); } result -_ContextMenuImpl::SetItem(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, - const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuImpl::SetItem(int index, const String& text, int actionId, const Bitmap* pNormalBitmap, + const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->SetItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); } @@ -174,11 +169,9 @@ _ContextMenuImpl::RemoveItemAt(int index) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - if (index >= GetItemCount() || index < 0) { - SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The specified index is not valid(index = %d).", index); + SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[%s] The specified index is not valid(index = %d).", GetErrorMessage(E_OUT_OF_RANGE), index); // E_OUT_OF_RANGE is for API version 2.0 over return (_AppInfo::GetApiVersion() <= _API_VERSION_2_0 && _AppInfo::IsOspCompat())?E_SYSTEM:E_OUT_OF_RANGE; @@ -192,8 +185,6 @@ _ContextMenuImpl::RemoveAllItems(void) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->RemoveAllItems(); } @@ -202,19 +193,15 @@ _ContextMenuImpl::SetAnchorPosition(float x, float y) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->SetAnchorPosition(x, y); } -Tizen::Graphics::FloatPoint +FloatPoint _ContextMenuImpl::GetAnchorPosition(void) const { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - - Tizen::Graphics::FloatPoint point; + FloatPoint point; point = __pContextMenu->GetAnchorPosition(); return point; @@ -225,8 +212,6 @@ _ContextMenuImpl::GetItemCount(void) const { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->GetItemCount(); } @@ -235,8 +220,6 @@ _ContextMenuImpl::SetMaxVisibleItemsCount(int maxItemsCount) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->SetShowItemCount(maxItemsCount); } @@ -245,8 +228,6 @@ _ContextMenuImpl::GetMaxVisibleItemsCount(void) const { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->GetShowItemCount(); } @@ -255,8 +236,6 @@ _ContextMenuImpl::GetItemIndexFromActionId(int actionId) const { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->GetItemIndexAt(actionId); } @@ -265,8 +244,6 @@ _ContextMenuImpl::GetItemActionIdAt(int index) const { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->GetItemActionIdAt(index); } @@ -275,34 +252,28 @@ _ContextMenuImpl::SetColor(const Graphics::Color& color) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - result r = E_SUCCESS; r = __pContextMenu->SetColor(color); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to set color."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set color."); return r; } -Tizen::Graphics::Color +Color _ContextMenuImpl::GetColor(void) const { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - return __pContextMenu->GetColor(); } result -_ContextMenuImpl::SetItemTextColor(ContextMenuItemStatus status, const Tizen::Graphics::Color& color) +_ContextMenuImpl::SetItemTextColor(ContextMenuItemStatus status, const Color& color) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - result r = E_SUCCESS; switch (status) @@ -320,7 +291,7 @@ _ContextMenuImpl::SetItemTextColor(ContextMenuItemStatus status, const Tizen::Gr break; default: - SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Invalid argument at ContextMenuItemStatus."); + SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Invalid argument is used. ContextMenuItemStatus parameter is invalid."); r = E_INVALID_ARG; break; } @@ -329,14 +300,14 @@ _ContextMenuImpl::SetItemTextColor(ContextMenuItemStatus status, const Tizen::Gr } -Tizen::Graphics::Color +Color _ContextMenuImpl::GetItemTextColor(ContextMenuItemStatus status) const { ClearLastResult(); SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - Tizen::Graphics::Color color(0, 0, 0, 0); + Color color(0, 0, 0, 0); switch (status) { @@ -353,7 +324,7 @@ _ContextMenuImpl::GetItemTextColor(ContextMenuItemStatus status) const break; default: - SysLogException(NID_UI_CTRL, E_SYSTEM, "Invalid argument at ContextMenuItemStatus."); + SysLogException(NID_UI_CTRL, E_SYSTEM, "Invalid argument is used. ContextMenuItemStatus parameter is invalid."); break; } return color; @@ -361,7 +332,7 @@ _ContextMenuImpl::GetItemTextColor(ContextMenuItemStatus status) const } result -_ContextMenuImpl::SetItemColor(ContextMenuItemStatus status, const Tizen::Graphics::Color& color) +_ContextMenuImpl::SetItemColor(ContextMenuItemStatus status, const Color& color) { ClearLastResult(); @@ -384,7 +355,7 @@ _ContextMenuImpl::SetItemColor(ContextMenuItemStatus status, const Tizen::Graphi break; default: - SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Invalid argument at ContextMenuItemStatus."); + SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Invalid argument is used. ContextMenuItemStatus parameter is invalid."); r = E_INVALID_ARG; break; } @@ -393,14 +364,14 @@ _ContextMenuImpl::SetItemColor(ContextMenuItemStatus status, const Tizen::Graphi } -Tizen::Graphics::Color +Color _ContextMenuImpl::GetItemColor(ContextMenuItemStatus status) const { ClearLastResult(); SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - Tizen::Graphics::Color color(0, 0, 0, 0); + Color color(0, 0, 0, 0); switch (status) { @@ -417,7 +388,7 @@ _ContextMenuImpl::GetItemColor(ContextMenuItemStatus status) const break; default: - SysLogException(NID_UI_CTRL, E_SYSTEM, "Invalid argument at ContextMenuItemStatus."); + SysLogException(NID_UI_CTRL, E_SYSTEM, "Invalid argument is used. ContextMenuItemStatus parameter is invalid."); break; } @@ -433,52 +404,48 @@ _ContextMenuImpl::GetPublicStyle(void) const } result -_ContextMenuImpl::AddActionEventListener(Tizen::Ui::IActionEventListener& listener) +_ContextMenuImpl::AddActionEventListener(IActionEventListener& listener) { ClearLastResult(); - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); - result r = E_SUCCESS; if (__pPublicActionEvent == null) { __pPublicActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic()); - SysTryReturn(NID_UI_CTRL, __pPublicActionEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, - "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, __pPublicActionEvent != null, GetLastResult(),"Propagating."); } r = __pPublicActionEvent->AddListener(listener); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to add an action event listener."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add action event listener."); r = __pContextMenu->AddActionEventListener(*this); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to add an action event listener."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add action event listener."); return r; } result -_ContextMenuImpl::RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener) +_ContextMenuImpl::RemoveActionEventListener(IActionEventListener& listener) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, __pPublicActionEvent != null, E_INVALID_STATE, E_INVALID_STATE, - "[E_INVALID_STATE] This instance isn't constructed.") - SysAssertf(__pContextMenu != null, "Not yet constructed. Construct() should be called before use."); + SysTryReturnResult(NID_UI_CTRL, __pPublicActionEvent != null, E_INVALID_STATE, + "__pPublicActionEvent must not be null.") result r = E_SUCCESS; r = __pPublicActionEvent->RemoveListener(listener); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove an action event listener."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove action event listener."); r = __pContextMenu->RemoveActionEventListener(*this); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove an action event listener."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove action event listener."); return r; } void -_ContextMenuImpl::OnActionPerformed(const Tizen::Ui::_Control& source, int actionId) +_ContextMenuImpl::OnActionPerformed(const _Control& source, int actionId) { ClearLastResult(); diff --git a/src/ui/controls/FUiCtrl_ContextMenuItem.cpp b/src/ui/controls/FUiCtrl_ContextMenuItem.cpp index a646529..0b16123 100644 --- a/src/ui/controls/FUiCtrl_ContextMenuItem.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenuItem.cpp @@ -157,11 +157,7 @@ _ContextMenuItem::CreateContextMenuItemN(void) _ContextMenuItem* pItem = null; pItem = new (std::nothrow) _ContextMenuItem(); - if (pItem == null) - { - SetLastResult(E_OUT_OF_MEMORY); - return null; - } + SysTryReturn(NID_UI_CTRL, pItem != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pItem->AcquireHandle(); @@ -177,7 +173,7 @@ _ContextMenuItem::InitializeAccessibilityElement(void) { pContainer->Activate(true); _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true); - SysTryReturnVoidResult(NID_UI_CTRL, pElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage."); + SysTryReturnVoidResult(NID_UI_CTRL, pElement, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_CONTEXTUAL_POP_UP_T_TTS"); pElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height)); @@ -255,35 +251,29 @@ _ContextMenuItem::SetTextSize(float size) } result -_ContextMenuItem::SetText(const Tizen::Base::String& text) +_ContextMenuItem::SetText(const String& text) { - if (text.GetLength() <= 0) - { - return E_INVALID_ARG; - } + SysTryReturnResult(NID_UI_CTRL, text.GetLength() > 0, E_INVALID_ARG, "Invalid argument is used. Length of text must be greater than 0"); __text = text; return E_SUCCESS; } -const Tizen::Base::String& +const String& _ContextMenuItem::GetText(void) const { return __text; } result -_ContextMenuItem::SetBitmap(ContextMenuItemDrawingStatus status, const Tizen::Graphics::Bitmap* pBitmap) +_ContextMenuItem::SetBitmap(ContextMenuItemDrawingStatus status, const Bitmap* pBitmap) { - if (status < CONTEXT_MENU_ITEM_DRAWING_STATUS_NORMAL || status > CONTEXT_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED) - { - return E_INVALID_ARG; - } + SysTryReturnResult(NID_UI_CTRL, (status >= CONTEXT_MENU_ITEM_DRAWING_STATUS_NORMAL && status <= CONTEXT_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED), + E_INVALID_ARG, "Invalid argument is used. The status is not valid."); - SysTryReturn(NID_UI_CTRL, (status != CONTEXT_MENU_ITEM_DRAWING_STATUS_NORMAL || pBitmap != null), E_INVALID_ARG, - E_INVALID_ARG, - "[E_INVALID_ARG] The normal bitmap must not be null."); + SysTryReturnResult(NID_UI_CTRL, (status != CONTEXT_MENU_ITEM_DRAWING_STATUS_NORMAL || pBitmap != null), + E_INVALID_ARG, "Invalid argument is used. The normal bitmap must not be null."); Bitmap* pClonedBitmap = _BitmapImpl::CloneN(*pBitmap); @@ -299,7 +289,7 @@ _ContextMenuItem::SetBitmap(ContextMenuItemDrawingStatus status, const Tizen::Gr return E_SUCCESS; } -const Tizen::Graphics::Bitmap* +const Bitmap* _ContextMenuItem::GetBitmap(ContextMenuItemDrawingStatus status) const { if (status < CONTEXT_MENU_ITEM_DRAWING_STATUS_NORMAL || status > CONTEXT_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED) @@ -311,38 +301,38 @@ _ContextMenuItem::GetBitmap(ContextMenuItemDrawingStatus status) const } void -_ContextMenuItem::SetSize(Tizen::Graphics::FloatDimension size) +_ContextMenuItem::SetSize(FloatDimension size) { __size = size; } -Tizen::Graphics::FloatDimension +FloatDimension _ContextMenuItem::GetSize(void) const { return __size; } void -_ContextMenuItem::SetDrawRect(Tizen::Graphics::FloatRectangle rect) +_ContextMenuItem::SetDrawRect(FloatRectangle rect) { __drawRect = rect; } -Tizen::Graphics::FloatRectangle +FloatRectangle _ContextMenuItem::GetDrawRect(void) const { return __drawRect; } void -_ContextMenuItem::SetPressedDrawRect(Tizen::Graphics::FloatRectangle rect) +_ContextMenuItem::SetPressedDrawRect(FloatRectangle rect) { __pressedDrawRect = rect; } -Tizen::Graphics::FloatRectangle +FloatRectangle _ContextMenuItem::GetPressedDrawRect(void) const { return __pressedDrawRect; @@ -407,7 +397,7 @@ _ContextMenuItem::DrawItemUpperDivider(void) if (__pUpperDividerLineLabel == null) { __pUpperDividerLineLabel = _Label::CreateLabelN(); - SysTryReturnVoidResult(NID_UI_CTRL, __pUpperDividerLineLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnVoidResult(NID_UI_CTRL, __pUpperDividerLineLabel, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); AttachChild(*__pUpperDividerLineLabel); @@ -437,7 +427,7 @@ _ContextMenuItem::DrawItemBackground(void) if (__pBackgroundLabel == null) { __pBackgroundLabel = _Label::CreateLabelN(); - SysTryReturnVoidResult(NID_UI_CTRL, __pBackgroundLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnVoidResult(NID_UI_CTRL, __pBackgroundLabel, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); __pBackgroundLabel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE); AttachChild(*__pBackgroundLabel); @@ -498,7 +488,7 @@ _ContextMenuItem::DrawItemLowerDivider(void) if (__pLowerDividerLineLabel == null) { __pLowerDividerLineLabel = _Label::CreateLabelN(); - SysTryReturnVoidResult(NID_UI_CTRL, __pLowerDividerLineLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnVoidResult(NID_UI_CTRL, __pLowerDividerLineLabel, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); AttachChild(*__pLowerDividerLineLabel); @@ -618,7 +608,7 @@ _ContextMenuItem::TouchMoved(const _Control& source, const _TouchInfo& touchinfo } void -_ContextMenuItem::OnFontChanged(Tizen::Graphics::Font* pFont) +_ContextMenuItem::OnFontChanged(Font* pFont) { String fontName = _Control::GetFont(); diff --git a/src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp b/src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp index 534731c..128e646 100644 --- a/src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp @@ -109,10 +109,10 @@ _ContextMenuListPresenter::Install(void) LoadShape(); __pModel = new (std::nothrow) _ContextMenuModel; - SysTryCatch(NID_UI_CTRL, __pModel != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage."); + SysTryReturnResult(NID_UI_CTRL, __pModel != null, E_OUT_OF_MEMORY, "Memory allocation failed."); r = __pModel->Construct(); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create data instance."); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = GetLastResult(), GetLastResult(), "[%s] Memory allocation failed.", GetErrorMessage(GetLastResult())); __pFont = __pContextMenu->GetFallbackFont(); r = GetLastResult(); @@ -164,10 +164,10 @@ _ContextMenuListPresenter::LoadShape(void) } _ContextMenuItem* -_ContextMenuListPresenter::CreateItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuListPresenter::CreateItemN(const Base::String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap) { _ContextMenuItem* pItem = _ContextMenuItem::CreateContextMenuItemN(); - SysTryReturn(NID_UI_CTRL, pItem != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pItem != null, null, GetLastResult(), "[%s] pItem must not be null.", GetErrorMessage(GetLastResult())); ContextMenuItemDrawingType itemType = CONTEXT_MENU_ITEM_DRAWING_TYPE_TEXT; _Label* pLabel = null; @@ -302,77 +302,74 @@ _ContextMenuListPresenter::CalculateItemSize(const String &text, ContextMenuItem } result -_ContextMenuListPresenter::AddItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* normalBitmap, - const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuListPresenter::AddItem(const Base::String& text, int actionId, const Bitmap* pNormalBitmap, + const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { - _ContextMenuItem* pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + _ContextMenuItem* pItem = CreateItemN(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); result r = __pModel->AddItem(pItem); if (r != E_SUCCESS) { delete pItem; - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to add item."); } return r; } result -_ContextMenuListPresenter::InsertItem(int index, const Tizen::Base::String& text, int actionId, - const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuListPresenter::InsertItem(int index, const String& text, int actionId, + const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { - if (text.GetLength() == 0 && normalBitmap == null && pPressedBitmap == null) - { - return E_INVALID_ARG; - } + + SysTryReturnResult(NID_UI_CTRL, (text.GetLength() != 0 || pNormalBitmap != null || pPressedBitmap != null), E_INVALID_ARG, + "Invalid argument(s) is used. If text is empty then pNormalBitmap or pPressedBitmap must not be null."); _ContextMenuItem* pItem = null; - pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + pItem = CreateItemN(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); result r = __pModel->InsertItem(pItem, index); if (r != E_SUCCESS) { delete pItem; - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to add item."); } return E_SUCCESS; } result -_ContextMenuListPresenter::SetItem(int index, const Tizen::Base::String& text, int actionId, - const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, - const Tizen::Graphics::Bitmap* pHighlightedBitmap) +_ContextMenuListPresenter::SetItem(int index, const String& text, int actionId, + const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, + const Bitmap* pHighlightedBitmap) { _ContextMenuItem* pItem = null; result r = E_SUCCESS; - if (text.GetLength() == 0 && normalBitmap == null && pPressedBitmap == null) - { - return E_INVALID_ARG; - } + SysTryReturnResult(NID_UI_CTRL, (text.GetLength() != 0 || pNormalBitmap != null || pPressedBitmap != null), E_INVALID_ARG, + "Invalid argument(s) is used. If text is empty then pNormalBitmap or pPressedBitmap must not be null."); pItem = __pModel->GetItem(index); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, pItem != null, r, r, "Failed to get the item."); + SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "Failed to get the item."); r = __pContextMenu->GetScrollPanel()->DetachChild(*pItem); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to detach item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to detach item."); - pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + pItem = CreateItemN(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); r = __pModel->SetItem(pItem, index); if (r != E_SUCCESS) { delete pItem; - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to add item."); } CalculateItemMaximumWidth(); @@ -386,21 +383,17 @@ _ContextMenuListPresenter::DeleteItem(int index) _ContextMenuItem* pItem = null; result r = E_SUCCESS; - if (__pContextMenu->GetItemCount() <= 0) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "Invalid argument."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, __pContextMenu->GetItemCount() > 0, E_INVALID_STATE, "__pContextMenu is in invalid state. Item count is less than or equal to zero."); pItem = __pModel->GetItem(index); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, pItem != null, r, r, "Failed to get the item."); + SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "Failed to get the item."); r = __pContextMenu->GetScrollPanel()->DetachChild(*pItem); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to detach item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to detach item."); r = __pModel->RemoveItem(index); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to delete item."); CalculateItemMaximumWidth(); @@ -410,16 +403,12 @@ _ContextMenuListPresenter::DeleteItem(int index) result _ContextMenuListPresenter::DeleteItemAll(void) { - if (__pContextMenu->GetItemCount() <= 0) - { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "Invalid argument."); - return E_INVALID_STATE; - } + SysTryReturnResult(NID_UI_CTRL, __pContextMenu->GetItemCount() > 0, E_INVALID_STATE, "__pContextMenu is in invalid state. Item count is less than or equal to zero."); __pContextMenu->GetScrollPanel()->DetachAllChildren(); result r = __pModel->RemoveAllItem(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item all."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to delete item all."); return r; } @@ -466,10 +455,10 @@ _ContextMenuListPresenter::ApplyColorProperty(void) result _ContextMenuListPresenter::CalculateRect(void) { - Tizen::Graphics::FloatRectangle windowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu window itself - Tizen::Graphics::FloatRectangle bodyRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // bg surronding showing items, relative to window - Tizen::Graphics::FloatRectangle arrowRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window - Tizen::Graphics::FloatRectangle itemRect = Tizen::Graphics::FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window + FloatRectangle windowRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // ContextMenu window itself + FloatRectangle bodyRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // bg surronding showing items, relative to window + FloatRectangle arrowRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window + FloatRectangle itemRect = FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f); // relative to window float bodyTopMargin = __topMargin; float bodyBottomMargin = __bottomMargin; @@ -825,7 +814,7 @@ _ContextMenuListPresenter::AdjustItemLayout(void) } -Tizen::Graphics::FloatDimension +FloatDimension _ContextMenuListPresenter::AdjustItemLayoutStyle(void) { int itemMaxCount = CalculateShowItemCount(); @@ -906,7 +895,7 @@ _ContextMenuListPresenter::CalculateItemMaximumWidth(void) _ContextMenuItem* pItem = null; pItem = __pModel->GetItem(i); - SysTryReturn(NID_UI_CTRL, pItem != null, , E_SYSTEM, "[E_SYSTEM] A system error occurred. Unable to get the item."); + SysTryReturnVoidResult(NID_UI_CTRL, pItem != null, E_SYSTEM, "[%s] A system error occurred. Unable to get the item.", GetErrorMessage(E_SYSTEM)); CalculateItemSize(pItem->GetText(), pItem->GetType(), textArea, itemSize); @@ -919,7 +908,7 @@ _ContextMenuListPresenter::CalculateItemMaximumWidth(void) } int -_ContextMenuListPresenter::GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& point) const +_ContextMenuListPresenter::GetItemIndexFromPosition(const FloatPoint& point) const { int index = -1; int itemCount = __pModel->GetItemCount(); @@ -962,18 +951,19 @@ _ContextMenuListPresenter::Draw(void) result r = E_SUCCESS; Canvas* pCanvas = __pContextMenu->GetCanvasN(); - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + r = GetLastResult(); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, GetLastResult(), "Propagating."); // Clear canvas for drawing area of the ContextMenu. pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); - Tizen::Graphics::FloatRectangle bounds(__pContextMenu->GetWindowRect()); - pCanvas->Clear(Tizen::Graphics::FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height)); + FloatRectangle bounds(__pContextMenu->GetWindowRect()); + pCanvas->Clear(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height)); r = DrawBackground(pCanvas); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to draw background."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to draw background."); r = DrawArrow(pCanvas); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to draw arrow."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to draw arrow."); delete pCanvas; @@ -983,11 +973,11 @@ _ContextMenuListPresenter::Draw(void) result _ContextMenuListPresenter::DrawBackground(Canvas* pCanvas) { - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error has occurred. pCanvas is null."); result r = E_SUCCESS; - Tizen::Graphics::FloatRectangle bodyRect = __pContextMenu->GetBodyRect(); + FloatRectangle bodyRect = __pContextMenu->GetBodyRect(); const Bitmap* pBackgroundNormalBitmap = __pContextMenu->GetBackgroundNormalBitmap(); const Bitmap* pBackgroundEffectBitmap = __pContextMenu->GetBackgroundEffectBitmap(); @@ -1017,10 +1007,10 @@ _ContextMenuListPresenter::DrawBackground(Canvas* pCanvas) result _ContextMenuListPresenter::DrawArrow(Canvas* pCanvas) { - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error has occurred. pCanvas is null."); result r = E_SUCCESS; - Tizen::Graphics::FloatRectangle arrowRect = __pContextMenu->GetArrowRect(); + FloatRectangle arrowRect = __pContextMenu->GetArrowRect(); ContextMenuCoreDropPosition dropPosition = __pContextMenu->GetDropPosition(); const Bitmap* pArrowNormalBitmap = __pContextMenu->GetArrowNormalBitmap(dropPosition); @@ -1414,7 +1404,7 @@ _ContextMenuListPresenter::OnFocusModeStateChanged(void) } void -_ContextMenuListPresenter::OnFontChanged(Tizen::Graphics::Font* pFont) +_ContextMenuListPresenter::OnFontChanged(Font* pFont) { __pFont = pFont; String fontName = __pContextMenu->GetFont(); @@ -1444,7 +1434,7 @@ _ContextMenuListPresenter::SetAllAccessibilityElement(void) if (pContainerContextMenu != null) { _AccessibilityElement* pElementContextMenu = new (std::nothrow) _AccessibilityElement(true); - SysTryReturnVoidResult(NID_UI_CTRL, pElementContextMenu, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage."); + SysTryReturnVoidResult(NID_UI_CTRL, pElementContextMenu, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pElementContextMenu->SetSupportOperatingGesture(false); pElementContextMenu->SetTraitWithStringId("IDS_TPLATFORM_BODY_CONTEXTUAL_POP_UP_T_TTS"); @@ -1518,7 +1508,7 @@ _ContextMenuListPresenter::SetTopDrawnItemIndex(int index) } result -_ContextMenuListPresenter::DrawBitmap(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Graphics::Bitmap& bitmap) +_ContextMenuListPresenter::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap) { result r = E_SUCCESS; if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap)) diff --git a/src/ui/controls/FUiCtrl_ContextMenuModel.cpp b/src/ui/controls/FUiCtrl_ContextMenuModel.cpp index e4f2166..097816c 100644 --- a/src/ui/controls/FUiCtrl_ContextMenuModel.cpp +++ b/src/ui/controls/FUiCtrl_ContextMenuModel.cpp @@ -46,7 +46,7 @@ _ContextMenuModel::Construct(void) { result r = __items.Construct(DEFAULT_ITEM_COUNT); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to construct ArrayList."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to construct ArrayList."); return r; } @@ -86,10 +86,7 @@ _ContextMenuModel::GetItemCount(void) const result _ContextMenuModel::AddItem(_ContextMenuItem* pItem) { - if (IsValidItem(pItem) == false) - { - return E_SYSTEM; - } + SysTryReturnResult(NID_UI_CTRL, IsValidItem(pItem), E_SYSTEM, "A system error has occurred. pItem is not valid."); return __items.Add(*pItem); } @@ -97,10 +94,7 @@ _ContextMenuModel::AddItem(_ContextMenuItem* pItem) result _ContextMenuModel::InsertItem( _ContextMenuItem* pItem, int index) { - if (IsValidItem(pItem) == false) - { - return E_SYSTEM; - } + SysTryReturnResult(NID_UI_CTRL, IsValidItem(pItem), E_SYSTEM, "A system error has occurred. pItem is not valid."); return __items.InsertAt(*pItem, index); } @@ -112,10 +106,10 @@ _ContextMenuModel::SetItem(_ContextMenuItem* pItem, int index) if (IsValidItem(pItem) == false) { _ContextMenuItem* pTargetItem = GetItem(index); - if (pItem == null || pTargetItem == null || pItem->GetActionId() != pTargetItem->GetActionId()) - { - return E_SYSTEM; - } + + SysTryReturnResult(NID_UI_CTRL, pItem != null, E_SYSTEM, "A system error has occurred. pItem must not be null."); + SysTryReturnResult(NID_UI_CTRL, pTargetItem != null, E_SYSTEM, "A system error has occurred. pTargetItem must not be null."); + SysTryReturnResult(NID_UI_CTRL, pItem->GetActionId() == pTargetItem->GetActionId(), E_SYSTEM, "A system error has occurred. ActionId of pItem and pTargetItem does not match."); } return __items.SetAt(*pItem, index, true); diff --git a/src/ui/controls/FUiCtrl_OptionMenu.cpp b/src/ui/controls/FUiCtrl_OptionMenu.cpp index ecef4e6..ce0f4ef 100644 --- a/src/ui/controls/FUiCtrl_OptionMenu.cpp +++ b/src/ui/controls/FUiCtrl_OptionMenu.cpp @@ -44,6 +44,7 @@ using namespace Tizen::Graphics; using namespace Tizen::Base; using namespace Tizen::Media; +using namespace Tizen::Ui; using namespace Tizen::Ui::Animations; using namespace Runtime; @@ -142,7 +143,7 @@ _OptionMenu::CreateOptionMenuN(void) GET_SHAPE_CONFIG(OPTIONMENU::LIST_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, minHeight); pOptionMenu = new (std::nothrow) _OptionMenu(); - SysTryReturn(NID_UI_CTRL, pOptionMenu != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pOptionMenu != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); r = pOptionMenu->CreateRootVisualElement(); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -171,7 +172,7 @@ _OptionMenu::CreateOptionMenuN(void) pScrollPanel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE); pScroll = pScrollPanel->GetScrollBar(); - SysTryCatch(NID_UI_CTRL, pScroll, , E_INVALID_STATE, "[E_INVALID_STATE] _Scroll isn't constructed"); + SysTryCatch(NID_UI_CTRL, pScroll, , E_INVALID_STATE, "[%s] _Scroll is not constructed", GetErrorMessage(E_INVALID_STATE)); pScroll->SetContextMenuScrollType(true); pOptionMenu->AttachChild(*(pScrollPanel)); @@ -352,13 +353,13 @@ _OptionMenu::Install(void) // load bitmap of a background and arrow r = LoadBitmap(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to load bitmap."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to load bitmap."); r = __actionId.Construct(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to construct arraylist."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to construct arraylist."); _OptionMenuPresenter* pPresenter = new (std::nothrow) _OptionMenuPresenter(this); - SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pPresenter != null, E_OUT_OF_MEMORY, "Memory allocation failed."); SetPresenter(*pPresenter); @@ -380,7 +381,7 @@ _OptionMenu::Initialize(void) screen = _ControlManager::GetInstance()->GetScreenSizeF(); r = SetBounds(FloatRectangle(0.0f, 0.0f, screen.width, screen.height)); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "SetBounds failed."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set option menu bounds."); SetMovable(false); SetResizable(false); @@ -436,7 +437,7 @@ _OptionMenu::OnAttachedToMainTree(void) if (pOwner == null) { __pCurrentFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame()); - SysTryReturn(NID_UI_CTRL, __pCurrentFrame != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Current frame instance is not available."); + SysTryReturnResult(NID_UI_CTRL, __pCurrentFrame != null, E_SYSTEM, "Current frame instance is not available."); _Form* pForm = __pCurrentFrame->GetCurrentForm(); pForm != null ? SetOwner(pForm) : SetOwner(__pCurrentFrame); @@ -485,6 +486,7 @@ _OptionMenu::OnAttachedToMainTree(void) } r = __pOptionMenuPresenter->CalculateWindowRect(); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); GetEcoreEvasMgr()->GetEcoreEvas()->SetWindowBounds(*this, GetBoundsF()); @@ -587,11 +589,11 @@ _OptionMenu::AddItem(const String& text, int actionId, const Bitmap* pNormalBitm { result r = E_SUCCESS; - SysTryReturn(NID_UI_CTRL, (GetItemIndexFromActionId(actionId) == -1), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred." + SysTryReturnResult(NID_UI_CTRL, (GetItemIndexFromActionId(actionId) == -1), E_SYSTEM, "A system error has occurred." " The option menu already has an item with the same action id (%d)", actionId); r = __pOptionMenuPresenter->AddItem(text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to add a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add a item."); __actionId.Add(actionId); @@ -608,11 +610,11 @@ _OptionMenu::InsertItemAt(int mainIndex, const String& text, int actionId, const { result r = E_SUCCESS; - SysTryReturn(NID_UI_CTRL, (GetItemIndexFromActionId(actionId) == -1), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred." + SysTryReturnResult(NID_UI_CTRL, (GetItemIndexFromActionId(actionId) == -1), E_SYSTEM, "A system error has occurred." " The option menu already has an item with the same action id (%d)", actionId); r = __pOptionMenuPresenter->InsertItem(mainIndex, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to add a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add a item."); __actionId.InsertAt(actionId, mainIndex); @@ -636,7 +638,7 @@ _OptionMenu::SetItemAt(int mainIndex, const String& text, int actionId, const Bi result r = E_SUCCESS; r = __pOptionMenuPresenter->SetItem(mainIndex, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to set a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set a item."); __actionId.SetAt(actionId, mainIndex); @@ -652,7 +654,7 @@ result _OptionMenu::AddSubItem(int mainIndex, const String& text, int actionId) { result r = __pOptionMenuPresenter->AddSubItem(mainIndex, text, actionId); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating."); if (__pSubMenu != null && mainIndex == __subMenuIndex) { @@ -666,7 +668,7 @@ result _OptionMenu::InsertSubItemAt(int mainIndex, int subIndex, const String& text, int actionId) { result r = __pOptionMenuPresenter->InsertSubItemAt(mainIndex, subIndex, text, actionId); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating."); if (__pSubMenu != null && mainIndex == __subMenuIndex) { @@ -680,7 +682,7 @@ result _OptionMenu::SetSubItemAt(int mainIndex, int subIndex, const String& text, int actionId) { result r = __pOptionMenuPresenter->SetSubItemAt(mainIndex, subIndex, text, actionId); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating."); if (__pSubMenu != null && mainIndex == __subMenuIndex) { @@ -694,7 +696,7 @@ result _OptionMenu::RemoveSubItemAt(int mainIndex, int subIndex) { result r = __pOptionMenuPresenter->RemoveSubItemAt(mainIndex, subIndex); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating."); if (__pSubMenu != null && mainIndex == __subMenuIndex) { @@ -766,8 +768,7 @@ _OptionMenu::ShowSubMenu(int mainIndex, _OptionMenuItem& item) if (__pSubMenu->GetOwner() == null) { _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame()); - SysTryReturn(NID_UI_CTRL, pFrame != null, E_SYSTEM, - E_SYSTEM, "[E_SYSTEM] This instance is not constructed."); + SysTryReturnResult(NID_UI_CTRL, pFrame != null, E_SYSTEM, "This instance is not constructed."); _Form* pForm = pFrame->GetCurrentForm(); if (pForm != null) @@ -809,10 +810,7 @@ _OptionMenu::IsSubMenuShown(void) const result _OptionMenu::DestroySubMenu(void) { - if (__pSubMenu == null) - { - return E_SYSTEM; - } + SysTryReturnResult(NID_UI_CTRL, __pSubMenu != null, E_SYSTEM, "A system error has occured. __pSubMenu is null."); __pSubMenu->Close(); delete __pSubMenu; @@ -829,7 +827,7 @@ _OptionMenu::InsertItem(int index, const String& text, int actionId, const Bitma result r = E_SUCCESS; r = __pOptionMenuPresenter->InsertItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to insert a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to insert a item."); __actionId.InsertAt(actionId, index); @@ -847,7 +845,7 @@ _OptionMenu::SetItem(int index, const String& text, int actionId, const Bitmap* result r = E_SUCCESS; r = __pOptionMenuPresenter->SetItem(index, text, actionId, pNormalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to set a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set a item."); __actionId.SetAt(actionId, index); @@ -865,7 +863,7 @@ _OptionMenu::RemoveItemAt(int index) result r = E_SUCCESS; r = __pOptionMenuPresenter->DeleteItem(index); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove a item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove a item."); __actionId.RemoveAt(index); @@ -983,11 +981,7 @@ _OptionMenu::SetPropertyMaxVisibleItemsCount(const Variant& count) { int showCount = count.ToInt(); - if (showCount < 1) - { - SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Count is invalid."); - return E_INVALID_ARG; - } + SysTryReturnResult(NID_UI_CTRL, showCount > 0, E_INVALID_ARG, "Invalid argument is used. Count is invalid."); __showItemCount = showCount; @@ -997,7 +991,7 @@ _OptionMenu::SetPropertyMaxVisibleItemsCount(const Variant& count) Variant _OptionMenu::GetPropertyMaxVisibleItemsCount(void) const { - return Tizen::Ui::Variant(__showItemCount); + return Variant(__showItemCount); } int @@ -1014,7 +1008,7 @@ _OptionMenu::SetShowItemCount(int count) result r; r = SetProperty("maxVisibleItemsCount", Variant(count)); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to set property."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to set property."); if (__isAttachedToMainTree) { @@ -1031,7 +1025,7 @@ _OptionMenu::SetPropertyColor(const Variant& color) __backgroundColor = color.ToColor(); result r = LoadColorReplacedBitmap(__backgroundColor); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error occurred. Failed to load the color replacement bitmap.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has occurred. Failed to load the color replacement bitmap."); return E_SUCCESS; } @@ -1039,7 +1033,7 @@ _OptionMenu::SetPropertyColor(const Variant& color) Variant _OptionMenu::GetPropertyColor(void) const { - return Tizen::Ui::Variant(__backgroundColor); + return Variant(__backgroundColor); } result @@ -1060,7 +1054,7 @@ result _OptionMenu::SetMaxVisibleItemsCount(int maxItemsCount) { result r = SetPropertyMaxVisibleItemsCount(maxItemsCount); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); __isMaxVisibleCountSet = true; @@ -1083,7 +1077,7 @@ _OptionMenu::SetPropertyNormalItemColor(const Variant& color) Variant _OptionMenu::GetPropertyNormalItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL]); + return Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL]); } result @@ -1097,7 +1091,7 @@ _OptionMenu::SetPropertyPressedItemColor(const Variant& color) Variant _OptionMenu::GetPropertyPressedItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED]); + return Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED]); } result @@ -1111,7 +1105,7 @@ _OptionMenu::SetPropertyHighlightedItemColor(const Variant & color) Variant _OptionMenu::GetPropertyHighlightedItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]); + return Variant(__itemColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]); } result @@ -1172,7 +1166,7 @@ _OptionMenu::SetPropertyNormalItemTextColor(const Variant& color) Variant _OptionMenu::GetPropertyNormalItemTextColor(void) const { - return Tizen::Ui::Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL]); + return Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_NORMAL]); } result @@ -1186,7 +1180,7 @@ _OptionMenu::SetPropertyPressedItemTextColor(const Variant& color) Variant _OptionMenu::GetPropertyPressedItemTextColor(void) const { - return Tizen::Ui::Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED]); + return Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_PRESSED]); } result @@ -1200,7 +1194,7 @@ _OptionMenu::SetPropertyHighlightedItemTextColor(const Variant & color) Variant _OptionMenu::GetPropertyHighlightedItemTextColor(void) const { - return Tizen::Ui::Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]); + return Variant(__textColor[OPTION_MENU_CORE_ITEM_STATUS_HIGHLIGHTED]); } result @@ -1258,10 +1252,10 @@ _OptionMenu::AddActionEventListener(const _IActionEventListener& listener) if (__pActionEvent == null) { __pActionEvent = _ActionEvent::CreateInstanceN(*this); - SysTryReturn(NID_UI_CTRL, __pActionEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, __pActionEvent != null, GetLastResult(), "Propagating."); r = __pActionEvent->AddListener(listener); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to remove an action event listener."); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to remove action event listener."); } return r; @@ -1275,13 +1269,13 @@ CATCH: result _OptionMenu::RemoveActionEventListener(const _IActionEventListener& listener) { - SysTryReturn(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE, E_INVALID_STATE, - "[E_INVALID_STATE] The action event instance isn't constructed."); + SysTryReturnResult(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE, + "The action event instance isn't constructed."); result r = E_SUCCESS; r = __pActionEvent->RemoveListener(listener); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to remove an action event listener"); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove action event listener"); return r; } @@ -1291,7 +1285,7 @@ _OptionMenu::FireActionEvent(int actionId) { IEventArg* pArg = _ActionEvent::CreateActionEventArgN(actionId); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (pArg != null), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, (pArg != null), r, "Propagating."); r = __pActionEvent->Fire(*pArg); diff --git a/src/ui/controls/FUiCtrl_OptionMenuImpl.cpp b/src/ui/controls/FUiCtrl_OptionMenuImpl.cpp index adfa61d..4fad681 100755 --- a/src/ui/controls/FUiCtrl_OptionMenuImpl.cpp +++ b/src/ui/controls/FUiCtrl_OptionMenuImpl.cpp @@ -121,8 +121,8 @@ _OptionMenuImpl::InsertItemAt(int mainIndex, const String& text, int actionId, c const Bitmap* pPressedBitmap, const Bitmap *pHighlightedBitmap) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, (mainIndex >= 0 && mainIndex <= GetItemCount()), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is invalid.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, (mainIndex >= 0 && mainIndex <= GetItemCount()), E_INVALID_ARG, + "Invalid argument is used. The specified main index (%d) is invalid.", mainIndex); return GetCore().InsertItemAt(mainIndex, text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); } @@ -132,8 +132,8 @@ _OptionMenuImpl::SetItemAt(int mainIndex, const String& text, int actionId, cons const Bitmap* pPressedBitmap, const Bitmap *pHighlightedBitmap) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, (mainIndex >= 0 && mainIndex < GetItemCount()), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is invalid.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, (mainIndex >= 0 && mainIndex < GetItemCount()), E_INVALID_ARG, + "Invalid argument is used. The specified main index (%d) is invalid.", mainIndex); return GetCore().SetItemAt(mainIndex, text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); } @@ -142,8 +142,8 @@ result _OptionMenuImpl::RemoveItemAt(int mainIndex) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, (mainIndex >= 0 && mainIndex < GetItemCount()), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is invalid.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, (mainIndex >= 0 && mainIndex < GetItemCount()), E_INVALID_ARG, + "Invalid argument is used. The specified main index (%d) is invalid.", mainIndex); return GetCore().RemoveItemAt(mainIndex); } @@ -179,7 +179,7 @@ _OptionMenuImpl::GetItemActionIdAt(int mainIndex) const { ClearLastResult(); SysTryReturn(NID_UI_CTRL, (mainIndex >= 0 && mainIndex < GetItemCount()), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is invalid.", mainIndex); + "[%s] Invalid argument is used. The specified main index (%d) is invalid.", GetErrorMessage(E_INVALID_ARG), mainIndex); return GetCore().GetItemActionIdAt(mainIndex); } @@ -188,8 +188,8 @@ result _OptionMenuImpl::AddSubItem(int mainIndex, const String& text, int actionId) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is negative.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, + "Invalid argument is used. The specified main index (%d) is negative.", mainIndex); return GetCore().AddSubItem(mainIndex, text, actionId); } @@ -198,10 +198,10 @@ result _OptionMenuImpl::InsertSubItemAt(int mainIndex, int subIndex, const String& text, int actionId) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is negative.", mainIndex); - SysTryReturn(NID_UI_CTRL, (subIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified sub index (%d) is negative.", subIndex); + SysTryReturnResult(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, + "Invalid argument is used. The specified main index (%d) is negative.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, (subIndex >= 0), E_INVALID_ARG, + "Invalid argument is used. The specified sub index (%d) is negative.", subIndex); return GetCore().InsertSubItemAt(mainIndex, subIndex, text, actionId); } @@ -210,10 +210,10 @@ result _OptionMenuImpl::SetSubItemAt(int mainIndex, int subIndex, const String& text, int actionId) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is negative.", mainIndex); - SysTryReturn(NID_UI_CTRL, (subIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified sub index (%d) is negative.", subIndex); + SysTryReturnResult(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, + "Invalid argument is used. The specified main index (%d) is negative.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, (subIndex >= 0), E_INVALID_ARG, + "Invalid argument is used. The specified sub index (%d) is negative.", subIndex); return GetCore().SetSubItemAt(mainIndex, subIndex, text, actionId); } @@ -222,10 +222,10 @@ result _OptionMenuImpl::RemoveSubItemAt(int mainIndex, int subIndex) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is negative.", mainIndex); - SysTryReturn(NID_UI_CTRL, (subIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified sub index (%d) is negative.", subIndex); + SysTryReturnResult(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, + "Invalid argument is used. The specified main index (%d) is negative.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, (subIndex >= 0), E_INVALID_ARG, + "Invalid argument is used. The specified sub index (%d) is negative.", subIndex); return GetCore().RemoveSubItemAt(mainIndex, subIndex); } @@ -235,7 +235,7 @@ _OptionMenuImpl::GetSubItemCount(int mainIndex) const { ClearLastResult(); SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is negative.", mainIndex); + "[%s] Invalid argument is used. The specified main index (%d) is negative.", GetErrorMessage(E_INVALID_ARG), mainIndex); return GetCore().GetSubItemCount(mainIndex); } @@ -253,9 +253,9 @@ _OptionMenuImpl::GetSubItemActionIdAt(int mainIndex, int subIndex) const { ClearLastResult(); SysTryReturn(NID_UI_CTRL, (mainIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is negative.", mainIndex); + "[%s] Invalid argument is used. The specified main index (%d) is negative.", GetErrorMessage(E_INVALID_ARG), mainIndex); SysTryReturn(NID_UI_CTRL, (subIndex >= 0), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified sub index (%d) is negative.", subIndex); + "[%s] Invalid argument is used. The specified sub index (%d) is negative.", GetErrorMessage(E_INVALID_ARG), subIndex); return GetCore().GetSubItemActionIdAt(mainIndex, subIndex); } @@ -282,7 +282,7 @@ _OptionMenuImpl::SetItemTextColor(OptionMenuItemStatus status, const Color& colo break; default: - SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Invalid argument at OptionMenuItemStatus."); + SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Invalid argument is used. OptionMenuItemStatus param is invalid."); r = E_INVALID_ARG; break; } @@ -295,7 +295,7 @@ _OptionMenuImpl::GetItemTextColor(OptionMenuItemStatus status) const { ClearLastResult(); - Tizen::Graphics::Color color(0, 0, 0, 0); + Color color(0, 0, 0, 0); switch (status) { @@ -312,7 +312,7 @@ _OptionMenuImpl::GetItemTextColor(OptionMenuItemStatus status) const break; default: - SysLogException(NID_UI_CTRL, E_SYSTEM, "Invalid argument at OptionMenuItemStatus."); + SysLogException(NID_UI_CTRL, E_SYSTEM, "Invalid argument is used. OptionMenuItemStatus param is invalid."); break; } @@ -340,7 +340,7 @@ _OptionMenuImpl::SetItemColor(OptionMenuItemStatus status, const Color& color) break; default: - SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Invalid argument at OptionMenuItemStatus."); + SysLogException(NID_UI_CTRL, E_INVALID_ARG, "Invalid argument is used. OptionMenuItemStatus param is invalid."); r = E_INVALID_ARG; break; } @@ -353,7 +353,7 @@ _OptionMenuImpl::GetItemColor(OptionMenuItemStatus status) const { ClearLastResult(); - Tizen::Graphics::Color color(0, 0, 0, 0); + Color color(0, 0, 0, 0); switch (status) { @@ -370,7 +370,7 @@ _OptionMenuImpl::GetItemColor(OptionMenuItemStatus status) const break; default: - SysLogException(NID_UI_CTRL, E_SYSTEM, "Invalid argument at OptionMenuItemStatus."); + SysLogException(NID_UI_CTRL, E_SYSTEM, "Invalid argument is used. OptionMenuItemStatus parma is invalid."); break; } diff --git a/src/ui/controls/FUiCtrl_OptionMenuItem.cpp b/src/ui/controls/FUiCtrl_OptionMenuItem.cpp index af42170..dd8124e 100755 --- a/src/ui/controls/FUiCtrl_OptionMenuItem.cpp +++ b/src/ui/controls/FUiCtrl_OptionMenuItem.cpp @@ -197,11 +197,7 @@ _OptionMenuItem::CreateOptionMenuItemN(void) _OptionMenuItem* pItem = null; pItem = new (std::nothrow) _OptionMenuItem(); - if (pItem == null) - { - SetLastResult(E_OUT_OF_MEMORY); - return null; - } + SysTryReturn(NID_UI_CTRL, pItem != null, null , E_OUT_OF_MEMORY, "[%s] Memory allocation falied.", GetErrorMessage(E_OUT_OF_MEMORY)); pItem->AcquireHandle(); @@ -215,7 +211,7 @@ _OptionMenuItem::InsertSubItemAt(_OptionMenuItem& subItem, int index) if (__pSubItems == null) { __pSubItems = new (std::nothrow) ArrayList; - SysTryReturn(NID_UI_CTRL, (__pSubItems != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, __pSubItems != null, E_OUT_OF_MEMORY, "Memory allocation failed."); result r = __pSubItems->Construct(); if (r != E_SUCCESS) @@ -227,8 +223,8 @@ _OptionMenuItem::InsertSubItemAt(_OptionMenuItem& subItem, int index) } } - SysTryReturn(NID_UI_CTRL, (index >= 0 && index <= __pSubItems->GetCount()), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified index (%d) is greater than the available items count.", index); + SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index <= __pSubItems->GetCount()), E_INVALID_ARG, + "Invalid argument is used. The specified index (%d) is greater than the available items count.", index); return __pSubItems->InsertAt(subItem, index); } @@ -249,10 +245,10 @@ _OptionMenuItem::SetSubItemAt(_OptionMenuItem& subItem, int index) result _OptionMenuItem::RemoveSubItemAt(int index) { - SysTryReturn(NID_UI_CTRL, (__pSubItems != null), E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] A system error has occurred. The sub items list is null."); - SysTryReturn(NID_UI_CTRL, (index >= 0 && index < __pSubItems->GetCount()), E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] A system error has occurred. The specified index (%d) is greater than the available items count.", index); + SysTryReturnResult(NID_UI_CTRL, __pSubItems != null, E_SYSTEM, + "A system error has occurred. The sub items list is null."); + SysTryReturnResult(NID_UI_CTRL, (index >= 0 && index < __pSubItems->GetCount()), E_SYSTEM, + "A system error has occurred. The specified index (%d) is greater than the available items count.", index); return __pSubItems->RemoveAt(index, true); } @@ -277,10 +273,10 @@ _OptionMenuItem::GetSubItemCount(void) const _OptionMenuItem* _OptionMenuItem::GetSubItem(int index) { - SysTryReturn(NID_UI_CTRL, (__pSubItems != null), null, E_SYSTEM, - "[E_SYSTEM] A system error has occurred. The sub items list is null.", index); + SysTryReturn(NID_UI_CTRL, __pSubItems != null, null, E_SYSTEM, + "[%s] A system error has occurred. The sub items list is null.", GetErrorMessage(E_SYSTEM), index); SysTryReturn(NID_UI_CTRL, (index >= 0 && index < __pSubItems->GetCount()), null, E_SYSTEM, - "[E_SYSTEM] A system error has occurred. The specified index (%d) is greater than the available items count.", index); + "[%s] A system error has occurred. The specified index (%d) is greater than the available items count.", GetErrorMessage(E_SYSTEM), index); return static_cast<_OptionMenuItem*>(__pSubItems->GetAt(index)); } @@ -293,7 +289,7 @@ _OptionMenuItem::InitializeAccessibilityElement(void) { pContainer->Activate(true); _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true); - SysTryReturnVoidResult(NID_UI_CTRL, pElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnVoidResult(NID_UI_CTRL, pElement, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_CONTEXTUAL_POP_UP_T_TTS"); pElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height)); @@ -408,13 +404,11 @@ _OptionMenuItem::GetText(void) const result _OptionMenuItem::SetBitmap(OptionMenuItemDrawingStatus status, const Bitmap* pBitmap) { - if (status < OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL || status > OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED) - { - return E_INVALID_ARG; - } + SysTryReturnResult(NID_UI_CTRL, (status >= OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL && status <= OPTION_MENU_ITEM_DRAWING_STATUS_HIGHLIGHTED), + E_INVALID_ARG, "Invalid argument is used. The status is not valid."); - SysTryReturn(NID_UI_CTRL, (status != OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL || pBitmap != null), E_INVALID_ARG, - E_INVALID_ARG, "[E_INVALID_ARG] The normal bitmap must not be null."); + SysTryReturnResult(NID_UI_CTRL, (status != OPTION_MENU_ITEM_DRAWING_STATUS_NORMAL || pBitmap != null), + E_INVALID_ARG, "Invalid argument is used. The normal bitmap must not be null."); Bitmap* pClonedBitmap = _BitmapImpl::CloneN(*pBitmap); @@ -448,19 +442,19 @@ _OptionMenuItem::SetPressedItemColor(Color color) } void -_OptionMenuItem::SetSize(Tizen::Graphics::FloatDimension size) +_OptionMenuItem::SetSize(FloatDimension size) { __size = size; } -Tizen::Graphics::FloatDimension +FloatDimension _OptionMenuItem::GetSize(void) const { return __size; } void -_OptionMenuItem::SetDrawRect(Tizen::Graphics::FloatRectangle rect) +_OptionMenuItem::SetDrawRect(FloatRectangle rect) { __drawRect = rect; } @@ -472,7 +466,7 @@ _OptionMenuItem::GetDrawRect(void) const } void -_OptionMenuItem::SetPressedDrawRect(Tizen::Graphics::FloatRectangle rect) +_OptionMenuItem::SetPressedDrawRect(FloatRectangle rect) { __pressedDrawRect = rect; } @@ -609,7 +603,7 @@ _OptionMenuItem::DrawArrow(void) if (__pArrowLabel == null) { __pArrowLabel = _Label::CreateLabelN(); - SysTryCatch(NID_UI_CTRL, (__pArrowLabel != null), , r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryCatch(NID_UI_CTRL, __pArrowLabel != null, , r, "[%s] Propagating.", GetErrorMessage(r)); AttachChild(*__pArrowLabel); @@ -658,7 +652,7 @@ _OptionMenuItem::DrawItemUpperDivider(void) if (__pUpperDividerLineLabel == null) { __pUpperDividerLineLabel = _Label::CreateLabelN(); - SysTryReturnVoidResult(NID_UI_CTRL, __pUpperDividerLineLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnVoidResult(NID_UI_CTRL, __pUpperDividerLineLabel, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); AttachChild(*__pUpperDividerLineLabel); @@ -714,7 +708,7 @@ _OptionMenuItem::DrawItemBackground(void) if (__pBackgroundLabel == null) { __pBackgroundLabel = _Label::CreateLabelN(); - SysTryReturnVoidResult(NID_UI_CTRL, __pBackgroundLabel, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturnVoidResult(NID_UI_CTRL, __pBackgroundLabel, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); __pBackgroundLabel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE); AttachChild(*__pBackgroundLabel); @@ -758,7 +752,6 @@ _OptionMenuItem::DrawItemBackground(void) { GET_REPLACED_BITMAP_CONFIG_N(OPTIONMENU::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __selectedBgColor, __pSelectedBgBitmap); __pBackgroundLabel->SetBackgroundBitmap(*__pSelectedBgBitmap); - } else { @@ -884,7 +877,7 @@ _OptionMenuItem::TouchMoved(const _Control& source, const _TouchInfo& touchinfo) } void -_OptionMenuItem::OnFontChanged(Tizen::Graphics::Font* pFont) +_OptionMenuItem::OnFontChanged(Font* pFont) { String fontName = _Control::GetFont(); diff --git a/src/ui/controls/FUiCtrl_OptionMenuModel.cpp b/src/ui/controls/FUiCtrl_OptionMenuModel.cpp index 4a83234..f3fd3f5 100755 --- a/src/ui/controls/FUiCtrl_OptionMenuModel.cpp +++ b/src/ui/controls/FUiCtrl_OptionMenuModel.cpp @@ -46,7 +46,7 @@ result _OptionMenuModel::Construct(void) { result r = __items.Construct(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to construct ArrayList."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to construct ArrayList."); return r; } @@ -97,7 +97,7 @@ _OptionMenuModel::AddItem(_OptionMenuItem* pItem, int mainIndex) { _OptionMenuItem* pMainItem = GetItem(mainIndex); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (pItem != null), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "Propagating."); r = pMainItem->InsertSubItemAt(*pItem, pMainItem->GetSubItemCount()); } @@ -118,7 +118,7 @@ _OptionMenuModel::InsertItemAt( _OptionMenuItem* pItem, int mainIndex, int subIn { _OptionMenuItem* pMainItem = GetItem(mainIndex); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (pItem != null), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "Propagating."); r = pMainItem->InsertSubItemAt(*pItem, subIndex); @@ -133,24 +133,24 @@ _OptionMenuModel::SetItemAt(int mainIndex, const String& text, int actionId, con { _OptionMenuItem* pItem = GetItem(mainIndex, subIndex); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (pItem != null), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "Propagating."); OptionMenuItemDrawingType itemType = OPTION_MENU_ITEM_DRAWING_TYPE_TEXT; if (subIndex == INVALID_INDEX) { int index = GetItemIndexFromActionId(actionId); - SysTryReturn(NID_UI_CTRL, (index < 0 || mainIndex == index), E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] A system error has occurred. The specified actionId (%d) is not valid", actionId); + SysTryReturnResult(NID_UI_CTRL, (index < 0 || mainIndex == index), E_SYSTEM, + "A system error has occurred. The specified actionId (%d) is not valid", actionId); } else { _OptionMenuItem* pMainItem = GetItem(mainIndex); - SysTryReturn(NID_UI_CTRL, (pMainItem != null), E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] A system error has occurred. The specified main index (%d) does not exists.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, pMainItem != null, E_SYSTEM, + "A system error has occurred. The specified main index (%d) does not exists.", mainIndex); int index = pMainItem->GetSubItemIndexFromActionId(actionId); - SysTryReturn(NID_UI_CTRL, (index < 0 || subIndex == index), E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] A system error has occurred. The specified actionId (%d) is not valid", actionId); + SysTryReturnResult(NID_UI_CTRL, (index < 0 || subIndex == index), E_SYSTEM, + "A system error has occurred. The specified actionId (%d) is not valid", actionId); } _Label* pLabel = null; @@ -199,11 +199,11 @@ _OptionMenuModel::RemoveItem(int mainIndex, int subIndex) _OptionMenuItem* pMainItem = GetItem(mainIndex); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, (pMainItem != null), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, pMainItem != null, r, "Propagating."); - SysTryReturn(NID_UI_CTRL, - (subIndex > INVALID_INDEX && subIndex < pMainItem->GetSubItemCount()), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified sub index (%d) is out of range.", subIndex); + SysTryReturnResult(NID_UI_CTRL, + (subIndex > INVALID_INDEX && subIndex < pMainItem->GetSubItemCount()), E_INVALID_ARG, + "Invalid argument is used. The specified sub index (%d) is out of range.", subIndex); return pMainItem->RemoveSubItemAt(subIndex); } @@ -239,7 +239,7 @@ _OptionMenuModel::ResetSelectedItem(int selectedIndex) _OptionMenuItem* pItem = null; pItem = static_cast <_OptionMenuItem*>(__items.GetAt(selectedIndex)); - SysTryReturnVoidResult(NID_UI_CTRL, (pItem != null), E_SYSTEM, "[E_SYSTEM] A system error occurred. Item is null."); + SysTryReturnVoidResult(NID_UI_CTRL, pItem != null, E_SYSTEM, "[%s] A system error has occurred. pItem must not be null.", GetErrorMessage(E_SYSTEM)); pItem->SetAndInvalidate(false); } diff --git a/src/ui/controls/FUiCtrl_OptionMenuPresenter.cpp b/src/ui/controls/FUiCtrl_OptionMenuPresenter.cpp index 6a925a4..0edce24 100755 --- a/src/ui/controls/FUiCtrl_OptionMenuPresenter.cpp +++ b/src/ui/controls/FUiCtrl_OptionMenuPresenter.cpp @@ -97,10 +97,10 @@ _OptionMenuPresenter::Install(void) LoadShape(); __pModel = new (std::nothrow) _OptionMenuModel; - SysTryCatch(NID_UI_CTRL, __pModel != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, __pModel != null, E_OUT_OF_MEMORY, "Memory allocation failed."); r = __pModel->Construct(); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pFont = __pOptionMenu->GetFallbackFont(); r = GetLastResult(); @@ -140,10 +140,10 @@ _OptionMenuPresenter::LoadShape(void) } _OptionMenuItem* -_OptionMenuPresenter::CreateItem(const String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap, bool isSubItem) +_OptionMenuPresenter::CreateItemN(const String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap, bool isSubItem) { _OptionMenuItem* pItem = _OptionMenuItem::CreateOptionMenuItemN(); - SysTryReturn(NID_UI_CTRL, pItem != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pItem != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); OptionMenuItemDrawingType itemType = OPTION_MENU_ITEM_DRAWING_TYPE_TEXT; _Label* pLabel = null; @@ -305,15 +305,15 @@ _OptionMenuPresenter::CalculateItemSize(const String &text, OptionMenuItemDrawin result _OptionMenuPresenter::AddItem(const String& text, int actionId, const Bitmap* normalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap) { - _OptionMenuItem* pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + _OptionMenuItem* pItem = CreateItemN(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); result r = __pModel->AddItem(pItem); if (r != E_SUCCESS) { delete pItem; - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to add item."); } return r; @@ -322,17 +322,17 @@ _OptionMenuPresenter::AddItem(const String& text, int actionId, const Bitmap* no result _OptionMenuPresenter::AddSubItem(int mainIndex, const String& text, int actionId) { - SysTryReturn(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid mainIndex %d.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), E_INVALID_ARG, "Invalid argument is used. mainIndex (%d) is invalid.", mainIndex); - _OptionMenuItem* pItem = CreateItem(text, actionId, null, null, null, true); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + _OptionMenuItem* pItem = CreateItemN(text, actionId, null, null, null, true); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); result r = __pModel->AddItem(pItem, mainIndex); if (r != E_SUCCESS) { delete pItem; - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to add item."); } return r; @@ -360,14 +360,14 @@ result _OptionMenuPresenter::InsertItem(int mainIndex, const String& text, int actionId, const Bitmap* normalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap) { - _OptionMenuItem* pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + _OptionMenuItem* pItem = CreateItemN(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); result r = __pModel->InsertItemAt(pItem, mainIndex); if (r != E_SUCCESS) { delete pItem; - SysTryReturn(NID_UI_CTRL, false, r, r, "Failed to add item."); + SysTryReturnResult(NID_UI_CTRL, false, r, "Failed to add item."); } return E_SUCCESS; @@ -376,14 +376,14 @@ _OptionMenuPresenter::InsertItem(int mainIndex, const String& text, int actionId result _OptionMenuPresenter::InsertSubItemAt(int mainIndex, int subIndex, const String& text, int actionId) { - SysTryReturn(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid mainIndex %d.", mainIndex); - SysTryReturn(NID_UI_CTRL, subIndex >=0 && subIndex <= __pModel->GetSubItemCount(mainIndex), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid subIndex %d.", subIndex); + SysTryReturnResult(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), E_INVALID_ARG, " Invalid argument is used. mainIndex (%d) is invalid.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, subIndex >=0 && subIndex <= __pModel->GetSubItemCount(mainIndex), E_INVALID_ARG, " Invalid subIndex %d.", subIndex); - _OptionMenuItem* pItem = CreateItem(text, actionId, null, null, null, true); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + _OptionMenuItem* pItem = CreateItemN(text, actionId, null, null, null, true); + SysTryReturnResult(NID_UI_CTRL, pItem != null, GetLastResult(), "Failed to create item."); result r = __pModel->InsertItemAt(pItem, mainIndex, subIndex); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating."); return E_SUCCESS; } @@ -391,11 +391,11 @@ _OptionMenuPresenter::InsertSubItemAt(int mainIndex, int subIndex, const String& result _OptionMenuPresenter::SetSubItemAt(int mainIndex, int subIndex, const String& text, int actionId) { - SysTryReturn(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid mainIndex %d.", mainIndex); - SysTryReturn(NID_UI_CTRL, subIndex >=0 && subIndex < __pModel->GetSubItemCount(mainIndex), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid subIndex %d.", subIndex); + SysTryReturnResult(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), E_INVALID_ARG, "Invalid argument is used. mainIndex (%d) is invalid.", mainIndex); + SysTryReturnResult(NID_UI_CTRL, subIndex >=0 && subIndex < __pModel->GetSubItemCount(mainIndex), E_INVALID_ARG, "Invalid argument is used. SubIndex (%d) is invalid.", subIndex); result r = __pModel->SetItemAt(mainIndex, text, actionId, null, null, null, __itemFontSize, subIndex); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating."); return E_SUCCESS; } @@ -403,11 +403,11 @@ _OptionMenuPresenter::SetSubItemAt(int mainIndex, int subIndex, const String& te result _OptionMenuPresenter::RemoveSubItemAt(int mainIndex, int subIndex) { - SysTryReturn(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid mainIndex %d.", mainIndex); - SysTryReturn(NID_UI_CTRL, subIndex >=0 && subIndex < __pModel->GetSubItemCount(mainIndex), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid subIndex %d.", subIndex); + SysTryReturnResult(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), E_INVALID_ARG, "Invalid argument is used. mainIndex (%d) is invalid", mainIndex); + SysTryReturnResult(NID_UI_CTRL, subIndex >=0 && subIndex < __pModel->GetSubItemCount(mainIndex), E_INVALID_ARG, "Invalid argument is used. SubIndex (%d) is invalid.", subIndex); result r = __pModel->RemoveItem(mainIndex, subIndex); - SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating."); return E_SUCCESS; } @@ -415,7 +415,7 @@ _OptionMenuPresenter::RemoveSubItemAt(int mainIndex, int subIndex) int _OptionMenuPresenter::GetSubItemCount(int mainIndex) const { - SysTryReturn(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), -1, E_INVALID_ARG, "[E_INVALID_ARG] Invalid mainIndex %d.", mainIndex); + SysTryReturn(NID_UI_CTRL, mainIndex >=0 && mainIndex < __pModel->GetItemCount(), -1, E_INVALID_ARG, "[%s] Invalid argument is used. mainIndex (%d) is invalid.", GetErrorMessage(E_INVALID_ARG), mainIndex); return __pModel->GetSubItemCount(mainIndex); } @@ -450,7 +450,7 @@ _OptionMenuPresenter::CalculateItemMaximumWidth(void) _OptionMenuItem* pItem = null; pItem = __pModel->GetItem(i); - SysTryReturn(NID_UI_CTRL, pItem != null, , E_SYSTEM, "[E_SYSTEM] A system error occurred. Unable to get the item."); + SysTryReturnVoidResult(NID_UI_CTRL, pItem != null, E_SYSTEM, "[%s] A system has error occurred. Unable to get the item.", GetErrorMessage(E_SYSTEM)); CalculateItemSize(pItem->GetText(), pItem->GetType(), textArea, itemSize); @@ -467,19 +467,14 @@ _OptionMenuPresenter::CalculateItemMaximumWidth(void) result _OptionMenuPresenter::SetItem(int index, const String& text, int actionId, const Bitmap* normalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap) { - SysTryReturn(NID_UI_CTRL, index >=0 && index < __pModel->GetItemCount(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid mainIndex %d.", index); + SysTryReturnResult(NID_UI_CTRL, index >=0 && index < __pModel->GetItemCount(), E_INVALID_ARG, "Invalid argument is used. mainIndex (%d) is invalid.", index); result r = __pModel->SetItemAt(index, text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap, __itemFontSize); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); _OptionMenuItem* pItem = __pModel->GetItem(index); - if (pItem == null) - { - SysLog(NID_UI_CTRL, "Item is null."); - return r; - } - + SysTryReturnResult(NID_UI_CTRL, pItem != null, r, "Propagating."); CalculateItemMaximumWidth(); return r; @@ -488,14 +483,14 @@ _OptionMenuPresenter::SetItem(int index, const String& text, int actionId, const result _OptionMenuPresenter::DeleteItem(int index) { - SysTryReturn(NID_UI_CTRL, (index < __pOptionMenu->GetItemCount()), E_INVALID_ARG, E_INVALID_ARG, - "[E_INVALID_ARG] The specified main index (%d) is invalid.", index); + SysTryReturnResult(NID_UI_CTRL, (index < __pOptionMenu->GetItemCount()), E_INVALID_ARG, + "Invalid argument is used. The specified index (%d) is invalid.", index); result r = __pOptionMenu->GetScrollPanel()->DetachChild(*__pModel->GetItem(index)); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to detach item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to detach item."); r = __pModel->RemoveItem(index); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to delete item."); CalculateItemMaximumWidth(); @@ -505,13 +500,13 @@ _OptionMenuPresenter::DeleteItem(int index) result _OptionMenuPresenter::DeleteItemAll(void) { - SysTryReturn(NID_UI_CTRL, (__pOptionMenu->GetItemCount() > 0), E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] A system error occurred. No items exists."); + SysTryReturnResult(NID_UI_CTRL, (__pOptionMenu->GetItemCount() > 0), E_SYSTEM, + "A system error has occurred. No items exists."); __pOptionMenu->GetScrollPanel()->DetachAllChildren(); result r = __pModel->RemoveAllItem(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item all."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to delete all items."); return r; } @@ -760,7 +755,8 @@ _OptionMenuPresenter::Draw(void) result r = E_SUCCESS; Canvas* pCanvas = __pOptionMenu->GetCanvasN(); - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "Memory allocation failed."); + r = GetLastResult(); + SysTryReturnResult(NID_UI_CTRL, r = E_SUCCESS, r, "Propagating"); // Clear canvas for drawing area of the OptionMenu. pCanvas->SetBackgroundColor(Color(0, 0, 0, 0)); @@ -840,7 +836,7 @@ _OptionMenuPresenter::OnEnterKeyReleased(int selectedIndex) result _OptionMenuPresenter::DrawBackground(Canvas* pCanvas) { - SysTryReturn(NID_UI_CTRL, pCanvas != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error has occurred. pCanvas is null"); result r = E_SUCCESS; @@ -1026,7 +1022,7 @@ _OptionMenuPresenter::SetAllAccessibilityElement(void) if (pContainerOptionMenu != null) { _AccessibilityElement* pElementOptionMenu = new (std::nothrow) _AccessibilityElement(true); - SysTryReturnVoidResult(NID_UI_CTRL, pElementOptionMenu, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnVoidResult(NID_UI_CTRL, pElementOptionMenu, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pElementOptionMenu->SetSupportOperatingGesture(false); //pElementOptionMenu->SetTraitWithStringId("IDS_TPLATFORM_BODY_CONTEXTUAL_POP_UP_T_TTS"); diff --git a/src/ui/controls/FUiCtrl_TabBar.cpp b/src/ui/controls/FUiCtrl_TabBar.cpp index 35475dd..e880f64 100644 --- a/src/ui/controls/FUiCtrl_TabBar.cpp +++ b/src/ui/controls/FUiCtrl_TabBar.cpp @@ -33,6 +33,7 @@ using namespace Tizen::Base; using namespace Tizen::Graphics; using namespace Tizen::Base::Runtime; +using namespace Tizen::Ui; namespace Tizen { namespace Ui { namespace Controls { @@ -74,7 +75,7 @@ _TabBar* _TabBar::CreateTabBarN(void) { _TabBar* pTabBar = new (std::nothrow) _TabBar(); - SysTryReturn(NID_UI_CTRL, pTabBar != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pTabBar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); result r = pTabBar->Initialize(); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to Initialize.", GetErrorMessage(r)); @@ -100,7 +101,7 @@ result _TabBar::Initialize(void) { _TabBarPresenter* pTabBarPresenter = new (std::nothrow) _TabBarPresenter(*this); - SysTryReturn(NID_UI_CTRL, pTabBarPresenter != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pTabBarPresenter != null, E_OUT_OF_MEMORY, "Memory allocation failed."); result r = pTabBarPresenter->Construct(); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -130,19 +131,19 @@ _TabBar::SetPresenter(const _TabBarPresenter& tabBarPresenter) } result -_TabBar::AddItem(const Tizen::Base::String& text, int actionId) +_TabBar::AddItem(const String& text, int actionId) { return __pTabBarPresenter->AddItem(text, actionId); } result -_TabBar::InsertItemAt(int index, const Tizen::Base::String& text, int actionId) +_TabBar::InsertItemAt(int index, const String& text, int actionId) { return __pTabBarPresenter->InsertItemAt(index, text, actionId); } result -_TabBar::SetItemAt(int index, const Tizen::Base::String& text, int actionId) +_TabBar::SetItemAt(int index, const String& text, int actionId) { return __pTabBarPresenter->SetItemAt(index, text, actionId); } @@ -177,16 +178,16 @@ _TabBar::SetPropertyColor(const Variant& color) Variant _TabBar::GetPropertyColor(void) const { - return Tizen::Ui::Variant(__color); + return Variant(__color); } result -_TabBar::SetColor(Tizen::Graphics::Color color) +_TabBar::SetColor(Color color) { return SetProperty("color", Variant(color)); } -Tizen::Graphics::Color +Color _TabBar::GetColor(void) const { Variant color = GetProperty("color"); @@ -211,7 +212,7 @@ _TabBar::SetPropertyNormalItemColor(const Variant& color) Variant _TabBar::GetPropertyNormalItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[ITEM_STATUS_NORMAL]); + return Variant(__itemColor[ITEM_STATUS_NORMAL]); } result @@ -231,7 +232,7 @@ _TabBar::SetPropertySelectedItemColor(const Variant& color) Variant _TabBar::GetPropertySelectedItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[ITEM_STATUS_SELECTED]); + return Variant(__itemColor[ITEM_STATUS_SELECTED]); } result @@ -251,7 +252,7 @@ _TabBar::SetPropertyPressedItemColor(const Variant& color) Variant _TabBar::GetPropertyPressedItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[ITEM_STATUS_PRESSED]); + return Variant(__itemColor[ITEM_STATUS_PRESSED]); } result @@ -271,11 +272,11 @@ _TabBar::SetPropertyDisabledItemColor(const Variant& color) Variant _TabBar::GetPropertyDisabledItemColor(void) const { - return Tizen::Ui::Variant(__itemColor[ITEM_STATUS_DISABLED]); + return Variant(__itemColor[ITEM_STATUS_DISABLED]); } result -_TabBar::SetItemColor(_TabBarItemStatus itemStatus, Tizen::Graphics::Color color) +_TabBar::SetItemColor(_TabBarItemStatus itemStatus, Color color) { result r = E_SUCCESS; @@ -299,7 +300,7 @@ _TabBar::SetItemColor(_TabBarItemStatus itemStatus, Tizen::Graphics::Color color return r; } -Tizen::Graphics::Color +Color _TabBar::GetItemColor(_TabBarItemStatus itemStatus) const { Color itemColor; @@ -339,7 +340,7 @@ _TabBar::SetPropertyNormalItemTextColor(const Variant & color) Variant _TabBar::GetPropertyNormalItemTextColor(void) const { - return Tizen::Ui::Variant(__itemTextColor[ITEM_STATUS_NORMAL]); + return Variant(__itemTextColor[ITEM_STATUS_NORMAL]); } result @@ -353,7 +354,7 @@ _TabBar::SetPropertySelectedItemTextColor(const Variant & color) Variant _TabBar::GetPropertySelectedItemTextColor(void) const { - return Tizen::Ui::Variant(__itemTextColor[ITEM_STATUS_SELECTED]); + return Variant(__itemTextColor[ITEM_STATUS_SELECTED]); } result @@ -367,7 +368,7 @@ _TabBar::SetPropertyPressedItemTextColor(const Variant & color) Variant _TabBar::GetPropertyPressedItemTextColor(void) const { - return Tizen::Ui::Variant(__itemTextColor[ITEM_STATUS_PRESSED]); + return Variant(__itemTextColor[ITEM_STATUS_PRESSED]); } result @@ -381,11 +382,11 @@ _TabBar::SetPropertyDisabledItemTextColor(const Variant & color) Variant _TabBar::GetPropertyDisabledItemTextColor(void) const { - return Tizen::Ui::Variant(__itemTextColor[ITEM_STATUS_DISABLED]); + return Variant(__itemTextColor[ITEM_STATUS_DISABLED]); } void -_TabBar::SetItemTextColor(_TabBarItemStatus status, Tizen::Graphics::Color color) +_TabBar::SetItemTextColor(_TabBarItemStatus status, Color color) { Color itemTextColor; result r = E_SUCCESS; @@ -410,7 +411,7 @@ _TabBar::SetItemTextColor(_TabBarItemStatus status, Tizen::Graphics::Color color } -Tizen::Graphics::Color +Color _TabBar::GetItemTextColor(_TabBarItemStatus status) const { Color itemTextColor; @@ -458,7 +459,7 @@ _TabBar::GetItemCount(void) const } _TabBarItem* -_TabBar::GetItemFromPosition(const Tizen::Graphics::FloatPoint& position) const +_TabBar::GetItemFromPosition(const FloatPoint& position) const { return __pTabBarPresenter->GetItemFromPosition(position); } @@ -476,14 +477,14 @@ _TabBar::SetWidth(float width) GET_SHAPE_CONFIG(TABBAR::HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, height); result r = SetSize(FloatDimension(width, height)); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); __pTabBarPresenter->ResetItemPositionX(); return r; } void -_TabBar::AddActionEventListener(const Tizen::Ui::Controls::_IActionEventListener& listener) +_TabBar::AddActionEventListener(const _IActionEventListener& listener) { ClearLastResult(); @@ -493,7 +494,7 @@ _TabBar::AddActionEventListener(const Tizen::Ui::Controls::_IActionEventListener if (__pActionEvent == null || IsFailed(GetLastResult())) { - SysLog(NID_UI_CTRL, "[E_INVALID_STATE] System error occured."); + SysLog(NID_UI_CTRL, "[%s] System error occured.", GetErrorMessage(E_INVALID_STATE)); SetLastResult(E_INVALID_STATE); delete __pActionEvent; return; @@ -505,9 +506,9 @@ _TabBar::AddActionEventListener(const Tizen::Ui::Controls::_IActionEventListener } void -_TabBar::RemoveActionEventListener(const Tizen::Ui::Controls::_IActionEventListener& listener) +_TabBar::RemoveActionEventListener(const _IActionEventListener& listener) { - SysTryReturnVoidResult(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE, "[E_INVALID_STATE] This instance isn't constructed.") + SysTryReturnVoidResult(NID_UI_CTRL, __pActionEvent != null, E_INVALID_STATE, "[%s] This instance isn't constructed.", GetErrorMessage(E_INVALID_STATE)) // Todo : check fail case of RemoveListener __pActionEvent->RemoveListener(listener); } @@ -533,7 +534,7 @@ _TabBar::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo) if (__pActionEvent) { IEventArg* pEventArg = _ActionEvent::CreateActionEventArgN(pItem->GetActionId()); - SysTryReturn(NID_UI_CTRL, pEventArg != null, E_INVALID_STATE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pEventArg != null, E_INVALID_STATE, GetLastResult(), "[%s] Memory allocation failed.", GetErrorMessage(GetLastResult())); PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, this); __pActionEvent->Fire(*pEventArg); @@ -649,7 +650,7 @@ _TabBar::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) if (__pActionEvent) { IEventArg* pEventArg = _ActionEvent::CreateActionEventArgN(pItem->GetActionId()); - SysTryReturn(NID_UI_CTRL, pEventArg != null, E_INVALID_STATE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pEventArg != null, E_INVALID_STATE, GetLastResult(), "[%s] Memory allocation failed.", GetErrorMessage(GetLastResult())); PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, this); __pActionEvent->Fire(*pEventArg); diff --git a/src/ui/controls/FUiCtrl_TabBarImpl.cpp b/src/ui/controls/FUiCtrl_TabBarImpl.cpp index 43591fc..d344543 100644 --- a/src/ui/controls/FUiCtrl_TabBarImpl.cpp +++ b/src/ui/controls/FUiCtrl_TabBarImpl.cpp @@ -30,7 +30,9 @@ using namespace Tizen::Ui; using namespace Tizen::Graphics; -using namespace Tizen::Base::Runtime; +using namespace Tizen::Base; +using namespace Tizen::Ui; +using namespace Runtime; namespace Tizen { namespace Ui { namespace Controls { @@ -63,10 +65,10 @@ _TabBarImpl::~_TabBarImpl(void) } _TabBarImpl* -_TabBarImpl::CreateTabBarImplN(TabBar* pTabBar, const Tizen::Graphics::FloatRectangle& bounds) +_TabBarImpl::CreateTabBarImplN(TabBar* pTabBar, const FloatRectangle& bounds) { ClearLastResult(); - SysTryReturn(NID_UI_CTRL, bounds.width >= 0.0f && bounds.height >= 0.0f, null, E_INVALID_ARG, "[E_INVALID_ARG] The specified width is smaller than minimum size."); + SysTryReturn(NID_UI_CTRL, bounds.width >= 0.0f && bounds.height >= 0.0f, null, E_INVALID_ARG, "[%s] Invalid argument is used. The specified width is smaller than minimum size.", GetErrorMessage(E_INVALID_ARG)); float height = 0.0f; GET_SHAPE_CONFIG(TABBAR::HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, height); @@ -74,20 +76,19 @@ _TabBarImpl::CreateTabBarImplN(TabBar* pTabBar, const Tizen::Graphics::FloatRect result r = E_SUCCESS; _TabBar* pCore = _TabBar::CreateTabBarN(); - SysTryReturn(NID_UI_CTRL, pCore != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] _TabBar is not constructed."); + SysTryReturn(NID_UI_CTRL, pCore != null, null, GetLastResult(), "[%s] Memory allocation failed.", GetErrorMessage(GetLastResult())); _TabBarImpl* pImpl = new (std::nothrow) _TabBarImpl(pTabBar, pCore); - r = CheckConstruction(pCore, pImpl); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturn(NID_UI_CTRL, pImpl != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); r = pImpl->SetBounds(FloatRectangle(bounds.x, bounds.y, bounds.width, height)); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] SetBounds is failed.", GetErrorMessage(r)); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set bounds.", GetErrorMessage(r)); r = pImpl->SetMinimumSize(FloatDimension(pImpl->GetMinimumSizeF().width, height)); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] SetMinimumSize is failed.", GetErrorMessage(r)); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set minimum size.", GetErrorMessage(r)); r = pImpl->SetMaximumSize(FloatDimension(pImpl->GetMaximumSizeLimitF().width, height)); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] SetMaximumSize is failed.", GetErrorMessage(r)); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set maximum size.", GetErrorMessage(r)); return pImpl; @@ -98,9 +99,10 @@ CATCH: } result -_TabBarImpl::AddItem(const Tizen::Base::String& text, int actionId) +_TabBarImpl::AddItem(const String& text, int actionId) { int itemMaxCnt = 0; + GET_FIXED_VALUE_CONFIG(TABBAR::ITEM_COUNT_MAX, GetCore().GetOrientation(), itemMaxCnt); SysTryReturn(NID_UI_CTRL, GetCore().GetItemCount() < itemMaxCnt, E_MAX_EXCEEDED, E_MAX_EXCEEDED, "[E_MAX_EXCEEDED] The item is not added more than %d.", itemMaxCnt); @@ -108,9 +110,10 @@ _TabBarImpl::AddItem(const Tizen::Base::String& text, int actionId) } result -_TabBarImpl::InsertItemAt(int index, const Tizen::Base::String& text, int actionId) +_TabBarImpl::InsertItemAt(int index, const String& text, int actionId) { int itemMaxCnt = 0; + GET_FIXED_VALUE_CONFIG(TABBAR::ITEM_COUNT_MAX, GetCore().GetOrientation(), itemMaxCnt); SysTryReturn(NID_UI_CTRL, GetCore().GetItemCount() < itemMaxCnt, E_MAX_EXCEEDED, E_MAX_EXCEEDED, "[E_MAX_EXCEEDED] The item is not added more than %d.", itemMaxCnt); SysTryReturn(NID_UI_CTRL, index >= 0 && index <= GetCore().GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This index(%d) is invalid.", index); @@ -118,7 +121,7 @@ _TabBarImpl::InsertItemAt(int index, const Tizen::Base::String& text, int action return GetCore().InsertItemAt(index, text, actionId); } -Tizen::Graphics::Color +Color _TabBarImpl::GetColor(void) const { return GetCore().GetColor(); @@ -130,13 +133,13 @@ _TabBarImpl::GetItemCount(void) const return GetCore().GetItemCount(); } -Tizen::Graphics::Color +Color _TabBarImpl::GetSelectedItemColor(void) const { return GetCore().GetItemColor(ITEM_STATUS_SELECTED); } -Tizen::Graphics::Color +Color _TabBarImpl::GetItemTextColor(TabBarItemStatus status) const { if (status == TAB_BAR_ITEM_STATUS_NORMAL) @@ -148,7 +151,7 @@ _TabBarImpl::GetItemTextColor(TabBarItemStatus status) const return GetCore().GetItemTextColor(ITEM_STATUS_SELECTED); } - return Tizen::Graphics::Color(0); + return Color(0); } int @@ -160,7 +163,7 @@ _TabBarImpl::GetSelectedItemIndex(void) const result _TabBarImpl::RemoveItemAt(int index) { - SysTryReturn(NID_UI_CTRL, index >= 0 && index < GetCore().GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This index(%d) is invalid.", index); + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index < GetCore().GetItemCount(), E_OUT_OF_RANGE, "This index(%d) is out of range.", index); return GetCore().RemoveItemAt(index); } @@ -172,15 +175,15 @@ _TabBarImpl::RemoveAllItems(void) } result -_TabBarImpl::SetColor(const Tizen::Graphics::Color& color) +_TabBarImpl::SetColor(const Color& color) { return GetCore().SetColor(color); } result -_TabBarImpl::SetItemAt(int index, const Tizen::Base::String& text, int actionId) +_TabBarImpl::SetItemAt(int index, const String& text, int actionId) { - SysTryReturn(NID_UI_CTRL, index >= 0 && index < GetCore().GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This index(%d) is invalid.", index); + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index < GetCore().GetItemCount(), E_OUT_OF_RANGE, "This index(%d) is out of range.", index); return GetCore().SetItemAt(index, text, actionId); } @@ -188,13 +191,13 @@ _TabBarImpl::SetItemAt(int index, const Tizen::Base::String& text, int actionId) result _TabBarImpl::SetItemSelected(int index) { - SysTryReturn(NID_UI_CTRL, index >= 0 && index < GetCore().GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This index(%d) is invalid.", index); + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index < GetCore().GetItemCount(), E_OUT_OF_RANGE, "This index(%d) is out of range.", index); return GetCore().SetItemSelected(index); } result -_TabBarImpl::SetItemTextColor(TabBarItemStatus status, const Tizen::Graphics::Color& color) +_TabBarImpl::SetItemTextColor(TabBarItemStatus status, const Color& color) { if (status == TAB_BAR_ITEM_STATUS_NORMAL) { @@ -209,7 +212,7 @@ _TabBarImpl::SetItemTextColor(TabBarItemStatus status, const Tizen::Graphics::Co } result -_TabBarImpl::SetSelectedItemColor(const Tizen::Graphics::Color& color) +_TabBarImpl::SetSelectedItemColor(const Color& color) { return GetCore().SetItemColor(ITEM_STATUS_SELECTED, color); } @@ -221,7 +224,7 @@ _TabBarImpl::SetWidth(float width) } void -_TabBarImpl::AddActionEventListener(Tizen::Ui::IActionEventListener& listener) +_TabBarImpl::AddActionEventListener(IActionEventListener& listener) { ClearLastResult(); @@ -231,7 +234,7 @@ _TabBarImpl::AddActionEventListener(Tizen::Ui::IActionEventListener& listener) if (__pPublicActionEvent == null || IsFailed(GetLastResult())) { - SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[E_INVALID_STATE] System error occurred."); + SysLogException(NID_UI_CTRL, E_INVALID_STATE, "[%s] __pPublicActionEvent must not be null.", GetErrorMessage(E_INVALID_STATE)); SetLastResult(E_INVALID_STATE); delete __pPublicActionEvent; return; @@ -246,9 +249,9 @@ _TabBarImpl::AddActionEventListener(Tizen::Ui::IActionEventListener& listener) } void -_TabBarImpl::RemoveActionEventListener(Tizen::Ui::IActionEventListener& listener) +_TabBarImpl::RemoveActionEventListener(IActionEventListener& listener) { - SysTryReturnVoidResult(NID_UI_CTRL, __pPublicActionEvent, E_INVALID_STATE, "[E_INVALID_STATE] This instance isn't constructed.") + SysTryReturnVoidResult(NID_UI_CTRL, __pPublicActionEvent, E_INVALID_STATE, "[%s] This instance is not constructed yet.", GetErrorMessage(E_INVALID_STATE)) // Todo : check fail case of RemoveListener __pPublicActionEvent->RemoveListener(listener); @@ -287,7 +290,7 @@ _TabBarImpl::GetCore(void) } void -_TabBarImpl::OnActionPerformed(const Tizen::Ui::_Control& source, int actionId) +_TabBarImpl::OnActionPerformed(const _Control& source, int actionId) { if (__pPublicActionEvent != null) { @@ -307,18 +310,18 @@ public: GetInstance(_UiBuilder* uibuilder) { _TabBarMaker* pTabBarMaker = new (std::nothrow) _TabBarMaker(uibuilder); - SysTryReturn(NID_UI_CTRL, pTabBarMaker != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pTabBarMaker != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); return pTabBarMaker; }; protected: - virtual Tizen::Ui::Control* + virtual Control* Make(_UiBuilderControl* pControl) { result r = E_SUCCESS; _UiBuilderControlLayout* pControlProperty = null; TabBar* pTabBar = null; - Tizen::Graphics::FloatRectangle rect; - Tizen::Base::String elementString; + FloatRectangle rect; + String elementString; int opacity = 0; Color color; @@ -332,7 +335,7 @@ protected: //Construct pTabBar = new (std::nothrow) TabBar(); - SysTryReturn(NID_UI_CTRL, pTabBar != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturn(NID_UI_CTRL, pTabBar != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); r = pTabBar->Construct(rect.x, rect.y, rect.width); if (r != E_SUCCESS) diff --git a/src/ui/controls/FUiCtrl_TabBarItem.cpp b/src/ui/controls/FUiCtrl_TabBarItem.cpp index 3cf6bca..f4252e3 100644 --- a/src/ui/controls/FUiCtrl_TabBarItem.cpp +++ b/src/ui/controls/FUiCtrl_TabBarItem.cpp @@ -63,7 +63,7 @@ _TabBarItem::GetActionId(void) const } void -_TabBarItem::SetText(const Tizen::Base::String& text, _ControlOrientation orientation) +_TabBarItem::SetText(const String& text, _ControlOrientation orientation) { float fontSize = 0.0f; GET_SHAPE_CONFIG(TABBAR::FONT_SIZE, orientation, fontSize); @@ -96,7 +96,7 @@ _TabBarItem::SetText(const Tizen::Base::String& text, _ControlOrientation orient __text = text; } -Tizen::Base::String +String _TabBarItem::GetText(void) const { return __text; @@ -115,12 +115,12 @@ _TabBarItem::GetStatus(void) const } void -_TabBarItem::SetBounds(const Tizen::Graphics::FloatRectangle& bounds) +_TabBarItem::SetBounds(const FloatRectangle& bounds) { __bounds = bounds; } -Tizen::Graphics::FloatRectangle +FloatRectangle _TabBarItem::GetBounds(void) const { return __bounds; diff --git a/src/ui/controls/FUiCtrl_TabBarModel.cpp b/src/ui/controls/FUiCtrl_TabBarModel.cpp index b0a1606..20500b7 100644 --- a/src/ui/controls/FUiCtrl_TabBarModel.cpp +++ b/src/ui/controls/FUiCtrl_TabBarModel.cpp @@ -25,6 +25,7 @@ using namespace Tizen::Graphics; +using namespace Tizen::Base; namespace Tizen { namespace Ui { namespace Controls { @@ -92,10 +93,10 @@ _TabBarModel::GetWidthOfAllItems(void) const } result -_TabBarModel::AddItem(const Tizen::Base::String& text, int actionId, _ControlOrientation orientation) +_TabBarModel::AddItem(const String& text, int actionId, _ControlOrientation orientation) { _TabBarItem* pItem = new (std::nothrow) _TabBarItem(orientation); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed."); pItem->SetText(text, orientation); pItem->SetActionId(actionId); @@ -134,16 +135,16 @@ _TabBarModel::AddItem(const Tizen::Base::String& text, int actionId, _ControlOri } result -_TabBarModel::InsertItemAt(int index, const Tizen::Base::String& text, int actionId, _ControlOrientation orientation) +_TabBarModel::InsertItemAt(int index, const String& text, int actionId, _ControlOrientation orientation) { - SysTryReturn(NID_UI_CTRL, index >= 0 && index <= GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The argument(%d) is out of range.", index); + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index <= GetItemCount(), E_OUT_OF_RANGE, "The index (%d) is out of range.", index); if (GetItemCount() == 0) { return AddItem(text, actionId, orientation); } _TabBarItem* pItem = new (std::nothrow) _TabBarItem(orientation); - SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, "Memory allocation failed."); pItem->SetText(text, orientation); pItem->SetActionId(actionId); @@ -160,25 +161,25 @@ _TabBarModel::InsertItemAt(int index, const Tizen::Base::String& text, int actio } result r = __tabBarItems.InsertAt(*pItem, index); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); r = ReCalculateItemPosition(index + 1, orientation); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return E_SUCCESS; } result -_TabBarModel::SetItemAt(int index, const Tizen::Base::String& text, int actionId, _ControlOrientation orientation) +_TabBarModel::SetItemAt(int index, const String& text, int actionId, _ControlOrientation orientation) { _TabBarItem* pItem = static_cast <_TabBarItem*>(__tabBarItems.GetAt(index)); - SysTryReturn(NID_UI_CTRL, pItem != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The %d index item is not exist.", index); + SysTryReturnResult(NID_UI_CTRL, pItem != null, E_INVALID_ARG, "Invalid argument is used. The item at index (%d) does not exist.", index); pItem->SetText(text, orientation); pItem->SetActionId(actionId); result r = ReCalculateItemPosition(index + 1, orientation); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return E_SUCCESS; } @@ -187,16 +188,16 @@ result _TabBarModel::RemoveItemAt(int index, _ControlOrientation orientation) { _TabBarItem* pItem = static_cast <_TabBarItem*>(__tabBarItems.GetAt(index)); - SysTryReturn(NID_UI_CTRL, pItem != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The %d index item is not exist.", index); + SysTryReturnResult(NID_UI_CTRL, pItem != null, E_INVALID_ARG, "Invalid argument is used. The item at index(%d) does not exist.", index); float itemMargin = 0.0f; GET_SHAPE_CONFIG(TABBAR::ITEM_MARGIN, orientation, itemMargin); result r = __tabBarItems.RemoveAt(index, true); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); r = ReCalculateItemPosition(index, orientation); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return E_SUCCESS; } @@ -220,7 +221,7 @@ _TabBarModel::GetItemAt(int index) const result _TabBarModel::ReCalculateItemPosition(int itemIndex, _ControlOrientation orientation) { - SysTryReturn(NID_UI_CTRL, itemIndex >= 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The itemIndex(%d) is negative."); + SysTryReturnResult(NID_UI_CTRL, itemIndex >= 0, E_INVALID_ARG, "Invalid argument is used. The itemIndex(%d) is negative."); int itemCount = __tabBarItems.GetCount(); float itemMargin = 0.0f; GET_SHAPE_CONFIG(TABBAR::ITEM_MARGIN, orientation, itemMargin); diff --git a/src/ui/controls/FUiCtrl_TabBarPresenter.cpp b/src/ui/controls/FUiCtrl_TabBarPresenter.cpp index a97875b..c45fdd1 100644 --- a/src/ui/controls/FUiCtrl_TabBarPresenter.cpp +++ b/src/ui/controls/FUiCtrl_TabBarPresenter.cpp @@ -109,12 +109,12 @@ result _TabBarPresenter::Construct(void) { __pTabBarModel = new (std::nothrow) _TabBarModel; - SysTryReturn(NID_UI_CTRL, __pTabBarModel != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryReturnResult(NID_UI_CTRL, __pTabBarModel != null, E_OUT_OF_MEMORY, "Memory allocation failed."); result r = E_SUCCESS; r = LoadBitmap(); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); return r; @@ -130,10 +130,10 @@ _TabBarPresenter::InitializeFont(void) { result r = E_SUCCESS; __pFont = __tabBar.GetFallbackFont(); - SysTryCatch(NID_UI_CTRL, __pFont != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryCatch(NID_UI_CTRL, __pFont != null, r = GetLastResult(), GetLastResult(), "[%s] Propgating.", GetErrorMessage(GetLastResult())); __pTextObject = new (std::nothrow) TextObject(); - SysTryCatch(NID_UI_CTRL, __pTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + SysTryCatch(NID_UI_CTRL, __pTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pTextObject->Construct(); __pTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE); @@ -251,13 +251,13 @@ CATCH: } result -_TabBarPresenter::AddItem(const Tizen::Base::String& text, int actionId) +_TabBarPresenter::AddItem(const String& text, int actionId) { return __pTabBarModel->AddItem(text, actionId, _CONTROL_ORIENTATION_PORTRAIT); } result -_TabBarPresenter::InsertItemAt(int index, const Tizen::Base::String& text, int actionId) +_TabBarPresenter::InsertItemAt(int index, const String& text, int actionId) { if (index <= __pTabBarModel->GetSelectedItemIndex()) { @@ -268,13 +268,13 @@ _TabBarPresenter::InsertItemAt(int index, const Tizen::Base::String& text, int a } result r = __pTabBarModel->InsertItemAt(index, text, actionId, _CONTROL_ORIENTATION_PORTRAIT); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); return E_SUCCESS; } result -_TabBarPresenter::SetItemAt(int index, const Tizen::Base::String& text, int actionId) +_TabBarPresenter::SetItemAt(int index, const String& text, int actionId) { return __pTabBarModel->SetItemAt(index, text, actionId, _CONTROL_ORIENTATION_PORTRAIT); } @@ -298,12 +298,12 @@ _TabBarPresenter::RemoveItemAt(int index) } result r = __pTabBarModel->RemoveItemAt(index, _CONTROL_ORIENTATION_PORTRAIT); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); if (GetItemCount() != 0) { r = SetItemSelected(0); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); } else { @@ -324,7 +324,7 @@ result _TabBarPresenter::SetItemSelected(int index) { - SysTryReturn(NID_UI_CTRL, index >= 0 && index < GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The argument is out of range."); + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index < GetItemCount(), E_OUT_OF_RANGE, "The index (%d) is out of range.", index); int oldSelectedItemIndex = GetSelectedItemIndex(); if (index == oldSelectedItemIndex) @@ -333,7 +333,7 @@ _TabBarPresenter::SetItemSelected(int index) } _TabBarItem* pItem = GetItemAt(oldSelectedItemIndex); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); pItem->SetStatus(ITEM_STATUS_NORMAL); _AccessibilityElement* pElement = pItem->GetAccessibilityElement(); if(pElement != null) @@ -344,7 +344,7 @@ _TabBarPresenter::SetItemSelected(int index) pItem = GetItemAt(index); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); pItem->SetStatus(ITEM_STATUS_SELECTED); pElement = pItem->GetAccessibilityElement(); if(pElement != null) @@ -384,7 +384,7 @@ _TabBarPresenter::GetItemCount(void) const } int -_TabBarPresenter::GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& point) const +_TabBarPresenter::GetItemIndexFromPosition(const FloatPoint& point) const { FloatRectangle clientBounds = __tabBar.GetBoundsF(); @@ -418,7 +418,7 @@ _TabBarPresenter::GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& po } int -_TabBarPresenter::GetItemIndexFromAbsPosition(const Tizen::Graphics::FloatPoint& point) const +_TabBarPresenter::GetItemIndexFromAbsPosition(const FloatPoint& point) const { FloatRectangle clientBounds = __tabBar.GetBoundsF(); @@ -444,11 +444,11 @@ _TabBarPresenter::GetItemIndexFromAbsPosition(const Tizen::Graphics::FloatPoint& } _TabBarItem* -_TabBarPresenter::GetItemFromPosition(const Tizen::Graphics::FloatPoint& position) const +_TabBarPresenter::GetItemFromPosition(const FloatPoint& position) const { SetLastResult(E_SUCCESS); int index = GetItemIndexFromPosition(position); - SysTryReturn(NID_UI_CTRL, index != -1, null, E_SYSTEM, "[E_SYSTEM] Item not found."); + SysTryReturn(NID_UI_CTRL, index != -1, null, E_SYSTEM, "[%s] A system error has occurred. Item not found.", GetErrorMessage(E_SYSTEM)); return __pTabBarModel->GetItemAt(index); } @@ -456,17 +456,17 @@ _TabBarPresenter::GetItemFromPosition(const Tizen::Graphics::FloatPoint& positio result _TabBarPresenter::SetTopDrawnItemIndex(int index) { - SysTryReturn(NID_UI_CTRL, index >= 0 && index < GetItemCount(), - E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The argument(%d) is out of range.", index); + SysTryReturnResult(NID_UI_CTRL, index >= 0 && index < GetItemCount(), + E_OUT_OF_RANGE, "The index (%d) is out of range.", index); _TabBarItem* pTopItem = GetItemAt(index); result r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); float distance = pTopItem->GetBounds().x; _TabBarItem* pLastItem = GetItemAt(GetItemCount() - 1); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); FloatRectangle clientBounds = __tabBar.GetBoundsF(); float movableDistance = (pLastItem->GetBounds().x + pLastItem->GetBounds().width) - (clientBounds.width - __sideMargin * 2.0f - __arrowMargin * 2.0f); @@ -485,7 +485,7 @@ result _TabBarPresenter::SetItemStatus(int index, _TabBarItemStatus status) { _TabBarItem* pItem = __pTabBarModel->GetItemAt(index); - SysTryReturn(NID_UI_CTRL, pItem, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Item(%d) not exists.", index); + SysTryReturnResult(NID_UI_CTRL, pItem, E_SYSTEM, "A system error has occurred. Item at index (%d) does not exists.", index); pItem->SetStatus(status); @@ -496,7 +496,7 @@ _TabBarItemStatus _TabBarPresenter::GetItemStatus(int index) const { _TabBarItem* pItem = __pTabBarModel->GetItemAt(index); - SysTryReturn(NID_UI_CTRL, pItem, ITEM_STATUS_NORMAL, E_SYSTEM, "[E_SYSTEM] Item(%d) not exists.", index); + SysTryReturn(NID_UI_CTRL, pItem, ITEM_STATUS_NORMAL, E_SYSTEM, "[%s] A system error has occured. Item at index (%d) does not exists.", GetErrorMessage(E_SYSTEM), index); _TabBarItemStatus status = pItem->GetStatus(); @@ -511,7 +511,7 @@ _TabBarPresenter::AdjustItemPositionX(float distance) while (index < GetItemCount()) { _TabBarItem* pItem = __pTabBarModel->GetItemAt(index); - SysTryReturn(NID_UI_CTRL, pItem, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Item(%d) not exists.", index); + SysTryReturnResult(NID_UI_CTRL, pItem, E_INVALID_STATE, "Item at index (%d) does not exists.", index); FloatRectangle bounds = pItem->GetBounds(); bounds.x += distance; pItem->SetBounds(bounds); @@ -524,13 +524,14 @@ _TabBarPresenter::AdjustItemPositionX(float distance) } result -_TabBarPresenter::SetReplacementColor(const Tizen::Graphics::Color& color) +_TabBarPresenter::SetReplacementColor(const Color& color) { Bitmap* pColorReplcedBitmap = null; result r; + r = GET_REPLACED_BITMAP_CONFIG_N(TABBAR::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, color, pColorReplcedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Image loading fail."); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Image loading fail.", GetErrorMessage(E_SYSTEM)); if (__pBgBitmapCached != null) { @@ -542,7 +543,7 @@ _TabBarPresenter::SetReplacementColor(const Tizen::Graphics::Color& color) } result -_TabBarPresenter::SetItemReplacementColor(_TabBarItemStatus itemStatus, const Tizen::Graphics::Color& color) +_TabBarPresenter::SetItemReplacementColor(_TabBarItemStatus itemStatus, const Color& color) { Bitmap* pColorReplcedBitmap = null; @@ -550,12 +551,12 @@ _TabBarPresenter::SetItemReplacementColor(_TabBarItemStatus itemStatus, const Ti if (itemStatus == ITEM_STATUS_SELECTED) { r = GET_REPLACED_BITMAP_CONFIG_N(TABBAR::ITEM_BG_SELECTED, BITMAP_PIXEL_FORMAT_ARGB8888, color, pColorReplcedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Image loading fail."); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Image loading fail.", GetErrorMessage(E_SYSTEM)); } else if (itemStatus == ITEM_STATUS_PRESSED) { r = GET_REPLACED_BITMAP_CONFIG_N(TABBAR::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, color, pColorReplcedBitmap); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Image loading fail."); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Image loading fail.", GetErrorMessage(E_SYSTEM)); } else { @@ -576,7 +577,7 @@ void _TabBarPresenter::Draw(void) { Canvas* pCanvas = __tabBar.GetCanvasN(); - SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "[E_SYSTEM] It can not get canvas."); + SysTryReturnVoidResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "[%s] A system error has occured. Canvas instance must be null.", GetErrorMessage(E_SYSTEM)); FloatRectangle clientBounds = __tabBar.GetBoundsF(); @@ -612,7 +613,7 @@ _TabBarPresenter::ShiftToFocusedItem(int itemIndex, _FocusDirectionMove directio } _TabBarItem* pItem = GetItemAt(itemIndex); - SysTryReturn(NID_UI_CTRL, pItem != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Item loading fail."); + SysTryReturnResult(NID_UI_CTRL, pItem != null, E_SYSTEM, "Failed to load an item."); FloatRectangle itemBounds = pItem->GetBounds(); FloatRectangle clientBounds = __tabBar.GetBoundsF(); @@ -627,7 +628,7 @@ _TabBarPresenter::ShiftToFocusedItem(int itemIndex, _FocusDirectionMove directio r = SetTopDrawnItemIndex(firstDrawnItemIndex + 1); } - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); } __tabBar.Invalidate(); @@ -646,7 +647,7 @@ _TabBarPresenter::ResetItemPositionX(void) _TabBarItem* pFirstItem = __pTabBarModel->GetItemAt(0); _TabBarItem* pLastItem = __pTabBarModel->GetItemAt(itemCount - 1); - SysTryReturnVoidResult(NID_UI_CTRL, pFirstItem != null && pLastItem != null, E_SYSTEM, "[E_SYSTEM] Item not found."); + SysTryReturnVoidResult(NID_UI_CTRL, pFirstItem != null && pLastItem != null, E_SYSTEM, "[%s] A system error has occurred. Item not found.", GetErrorMessage(E_SYSTEM)); FloatRectangle clientBounds = __tabBar.GetBoundsF(); FloatRectangle firstItemBounds = pFirstItem->GetBounds(); @@ -669,9 +670,9 @@ _TabBarPresenter::OnBoundsChanged(void) } void -_TabBarPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas) +_TabBarPresenter::DrawItem(Canvas* pCanvas) { - SysTryReturnVoidResult(NID_UI_CTRL, __pTextObject != null, E_INVALID_STATE, "[E_INVALID_STATE] TextObject is not constructed."); + SysTryReturnVoidResult(NID_UI_CTRL, __pTextObject != null, E_INVALID_STATE, "[%s] TextObject is not constructed.", GetErrorMessage(E_INVALID_STATE)); FloatRectangle clientBounds = pCanvas->GetBoundsF(); @@ -750,7 +751,7 @@ _TabBarPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas) drawText = pDrawItem->GetText(); __pTextObject->RemoveAll(); pSimpleText = new (std::nothrow)TextSimple(const_cast (drawText.GetPointer()), drawText.GetLength()); - SysTryReturnVoidResult(NID_UI_CTRL, pSimpleText != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] TextSimple is not constructed."); + SysTryReturnVoidResult(NID_UI_CTRL, pSimpleText != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); __pFont = __tabBar.GetFallbackFont(); SysTryReturnVoidResult(NID_UI_CTRL, __pFont != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); @@ -775,7 +776,7 @@ _TabBarPresenter::DrawItem(Tizen::Graphics::Canvas* pCanvas) } void -_TabBarPresenter::DrawBackground(Tizen::Graphics::Canvas* pCanvas) +_TabBarPresenter::DrawBackground(Canvas* pCanvas) { result r = E_SUCCESS; FloatRectangle clientBounds = __tabBar.GetBoundsF(); @@ -795,7 +796,7 @@ _TabBarPresenter::DrawBackground(Tizen::Graphics::Canvas* pCanvas) } void -_TabBarPresenter::DrawArrow(Tizen::Graphics::Canvas* pCanvas) +_TabBarPresenter::DrawArrow(Canvas* pCanvas) { FloatRectangle clientBounds = __tabBar.GetBoundsF(); @@ -1016,7 +1017,7 @@ _TabBarPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchin } result -_TabBarPresenter::DrawBitmap(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Graphics::Bitmap& bitmap) +_TabBarPresenter::DrawBitmap(Canvas& canvas, const FloatRectangle& bounds, const Bitmap& bitmap) { result r = E_SUCCESS; if (_BitmapImpl::CheckNinePatchedBitmapStrictly(bitmap)) diff --git a/src/ui/inc/FUiCtrl_ContextMenuGridPresenter.h b/src/ui/inc/FUiCtrl_ContextMenuGridPresenter.h index d10be74..7d9b0a8 100644 --- a/src/ui/inc/FUiCtrl_ContextMenuGridPresenter.h +++ b/src/ui/inc/FUiCtrl_ContextMenuGridPresenter.h @@ -59,9 +59,9 @@ public: virtual result Draw(void); virtual result DrawBackground(Tizen::Graphics::Canvas* pCanvas); virtual result DrawArrow(Tizen::Graphics::Canvas* pCanvas); - virtual result AddItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); - virtual result InsertItem(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); - virtual result SetItem(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); + virtual result AddItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); + virtual result InsertItem(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); + virtual result SetItem(int index, const Tizen::Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); virtual result DeleteItem(int index); virtual result DeleteItemAll(void); virtual int CalculateShowItemCount(void); @@ -104,7 +104,7 @@ private: Tizen::Graphics::FloatDimension AdjustItemLayoutTabStyle(void); bool IsLayoutBitmapOnly(void); - _ContextMenuItem* CreateItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); + _ContextMenuItem* CreateItemN(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); result DrawItem(Tizen::Graphics::Canvas* pCanvas); result DrawLine(Tizen::Graphics::Canvas* pCanvas, Tizen::Graphics::FloatPoint point1, Tizen::Graphics::FloatPoint point2, bool drawVLine); void SetItemSize(_ContextMenuItem* pItem); diff --git a/src/ui/inc/FUiCtrl_ContextMenuListPresenter.h b/src/ui/inc/FUiCtrl_ContextMenuListPresenter.h index 0ccff3a..864dd3f 100644 --- a/src/ui/inc/FUiCtrl_ContextMenuListPresenter.h +++ b/src/ui/inc/FUiCtrl_ContextMenuListPresenter.h @@ -102,7 +102,7 @@ private: void AdjustItemPosition(void); Tizen::Graphics::FloatDimension AdjustItemLayoutStyle(void); - _ContextMenuItem* CreateItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); + _ContextMenuItem* CreateItemN(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap); int GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& point) const; void CalculateItemMaximumWidth(void); diff --git a/src/ui/inc/FUiCtrl_OptionMenuPresenter.h b/src/ui/inc/FUiCtrl_OptionMenuPresenter.h index 155a58a..cae21ba 100644 --- a/src/ui/inc/FUiCtrl_OptionMenuPresenter.h +++ b/src/ui/inc/FUiCtrl_OptionMenuPresenter.h @@ -123,7 +123,7 @@ private: void AdjustItemPosition(void); Tizen::Graphics::FloatDimension AdjustItemLayoutStyle(void); - _OptionMenuItem* CreateItem(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, + _OptionMenuItem* CreateItemN(const Base::String& text, int actionId, const Tizen::Graphics::Bitmap* pNormalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap, const Tizen::Graphics::Bitmap* pHighlightedBitmap, bool isSubItem = false); int GetItemIndexFromPosition(const Tizen::Graphics::FloatPoint& point) const;