delete __pSearchBarModel;
__pSearchBarModel = null;
- if (__pReplacedSearchFieldNormalBitmap)
- {
- delete __pReplacedSearchFieldNormalBitmap;
- __pReplacedSearchFieldNormalBitmap = null;
- }
+ delete __pReplacedSearchFieldNormalBitmap;
+ __pReplacedSearchFieldNormalBitmap = null;
- if (__pReplacedSearchFieldDisabledBitmap)
- {
- delete __pReplacedSearchFieldDisabledBitmap;
- __pReplacedSearchFieldDisabledBitmap = null;
- }
+ delete __pReplacedSearchFieldDisabledBitmap;
+ __pReplacedSearchFieldDisabledBitmap = null;
- if (__pReplacedSearchBarBitmap)
- {
- delete __pReplacedSearchBarBitmap;
- __pReplacedSearchBarBitmap = null;
- }
+ delete __pReplacedSearchBarBitmap;
+ __pReplacedSearchBarBitmap = null;
- if (__pSearchBarBitmap)
- {
- delete __pSearchBarBitmap;
- __pSearchBarBitmap = null;
- }
+ delete __pSearchBarBitmap;
+ __pSearchBarBitmap = null;
- if (__pSearchFieldEffectBitmap)
- {
- delete __pSearchFieldEffectBitmap;
- __pSearchFieldEffectBitmap = null;
- }
+ delete __pSearchFieldEffectBitmap;
+ __pSearchFieldEffectBitmap = null;
- if (__pSearchBarEffectBitmap)
- {
- delete __pSearchBarEffectBitmap;
- __pSearchBarEffectBitmap = null;
- }
+ delete __pSearchBarEffectBitmap;
+ __pSearchBarEffectBitmap = null;
}
result
return r;
CATCH:
- if (__pIconElement)
+ if (__pIconElement != null)
{
__pIconElement->Destroy();
__pIconElement = null;
}
result
-_SearchBarPresenter::SetMode(SearchBarMode mode)
+_SearchBarPresenter::SetMode(SearchBarMode mode, bool isCalledByApp)
{
SysTryReturn(NID_UI_CTRL, IsModeLocked() == false, E_INVALID_OPERATION, E_INVALID_OPERATION,
"[E_INVALID_OPERATION] The searchbar mode is locked.");
__pSearchBarModel->SetMode(mode);
- result r = ChangeMode(mode);
+ result r = ChangeMode(mode, isCalledByApp);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
"[E_SYSTEM] A system error has occurred. Failed to change the mode of searchbar.");
Bitmap* pBackgroundBitmap = __pSearchBar->GetBackgroundBitmap();
- if (!pBackgroundBitmap)
+ if (pBackgroundBitmap == null)
{
r = DrawSearchBarDefaultBitmap();
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
void
_SearchBarPresenter::SetCancelButtonVisible(bool visible)
{
- if ((__pSearchBar->IsUsableCancelButton() == false) && visible)
+ if ((!__pSearchBar->IsUsableCancelButton()) && visible)
{
return;
}
result
-_SearchBarPresenter::ChangeMode(SearchBarMode mode)
+_SearchBarPresenter::ChangeMode(SearchBarMode mode, bool isCalledByApp)
{
result r = E_SUCCESS;
SetCancelButtonVisible(false);
SetContainerVisible(false);
- if (__pEdit)
+ if (__pEdit != null)
{
__pEdit->ClearText();
__pEdit->SetBounds(__searchFieldBounds);
SetCancelButtonVisible(true);
__pSearchBar->SetContentDimming();
- if (__pEdit)
+ if (__pEdit != null)
{
float buttonWidth = 0.0f;
_ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
GET_SHAPE_CONFIG(SEARCHBAR::BUTTON_WIDTH, orientation, buttonWidth);
float cancelButtonWidth = 0.0f;
- cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightTouchMarginF() + __pCancelButton->GetLeftTouchMarginF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
+ cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
if (cancelButtonWidth <= buttonWidth)
{
__pEdit->SetBounds(__searchFieldBounds);
}
- __pEdit->ShowKeypad();
+ if (isCalledByApp)
+ {
+ __pEdit->ShowKeypad();
+ }
}
__pSearchBar->SetContentsArea();
{
InitializeViewModeLayout();
- if (__pSearchBar->IsUsableCancelButton() == false)
+ if (!__pSearchBar->IsUsableCancelButton())
{
return;
}
__searchFieldBounds.width = (__pSearchBar->GetBoundsF().width > searchFieldMinWidth) ? __searchFieldBounds.width : searchFieldMinWidth;
float cancelButtonWidth = 0.0f;
- cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightTouchMarginF() + __pCancelButton->GetLeftTouchMarginF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
+ cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
if (cancelButtonWidth > buttonWidth)
{
r = __pSearchBar->ResizeCancelButton();
SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.",GetErrorMessage(r));
- cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightTouchMarginF() + __pCancelButton->GetLeftTouchMarginF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
+ cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
}
r = __pEdit->SetBounds(__searchFieldBounds);
return;
}
+void
+_SearchBarPresenter::OnTouchReleased(const _Control& source)
+{
+ if (&source == __pEdit)
+ {
+ __pEdit->ShowKeypad();
+ }
+}
+
Canvas*
_SearchBarPresenter::OnCanvasRequestedN(const FloatRectangle& bounds)
{
Canvas* pCanvas = null;
- if (__lazyDecode == true)
+ if (__lazyDecode)
{
Bitmap* pBackgroundBitmap = __pSearchBar->GetBackgroundBitmap();
SysTryReturn(NID_UI_CTRL, pBackgroundBitmap != null, null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get the background bitmap.");