_OSP_EXPORT_ static const int EDIT_BG_NORMAL;
/**
+ * The property key to get the pressed background color of the edit of search bar.
+ *
+ * @since 2.1
+ */
+ _OSP_EXPORT_ static const int EDIT_BG_PRESSED;
+
+ /**
+ * The property key to get the highlighted background color of the edit of search bar.
+ *
+ * @since 2.1
+ */
+ _OSP_EXPORT_ static const int EDIT_BG_HIGHLIGHTED;
+
+ /**
* The property key to get the disabled background color of the edit of search bar.
*
* @since 2.1
_OSP_EXPORT_ static const int EDIT_BG_DISABLED;
/**
+ * The property key to get the focus color of the edit of search bar.
+ *
+ * @since 2.1
+ */
+ _OSP_EXPORT_ static const int EDIT_BG_FOCUS;
+
+ /**
* The property key to get the normal text color of the edit of search bar.
*
* @since 2.1
const int ColorKey::SearchBar::BUTTON_TEXT_DISABLED = _SEARCHBAR::BUTTON_TEXT_DISABLED_COLOR;
const int ColorKey::SearchBar::BUTTON_TEXT_HIGHLIGHTED = _SEARCHBAR::BUTTON_TEXT_HIGHLIGHTED_COLOR;
const int ColorKey::SearchBar::EDIT_BG_NORMAL = _SEARCHBAR::EDIT_BG_NORMAL_COLOR;
+const int ColorKey::SearchBar::EDIT_BG_PRESSED = _SEARCHBAR::EDIT_BG_PRESSED_COLOR;
+const int ColorKey::SearchBar::EDIT_BG_HIGHLIGHTED = _SEARCHBAR::EDIT_BG_HIGHLIGHTED_COLOR;
const int ColorKey::SearchBar::EDIT_BG_DISABLED = _SEARCHBAR::EDIT_BG_DISABLED_COLOR;
+const int ColorKey::SearchBar::EDIT_BG_FOCUS = _SEARCHBAR::EDIT_BG_FOCUS_COLOR;
const int ColorKey::SearchBar::EDIT_TEXT_NORMAL = _SEARCHBAR::EDIT_TEXT_NORMAL_COLOR;
const int ColorKey::SearchBar::EDIT_TEXT_DISABLED = _SEARCHBAR::EDIT_TEXT_DISABLED_COLOR;
const int ColorKey::SearchBar::EDIT_TEXT_HIGHLIGHTED = _SEARCHBAR::EDIT_TEXT_HIGHLIGHTED_COLOR;
return __pPublicTouchEventListeners;
}
+Tizen::Base::Collection::LinkedListT <Tizen::Base::Runtime::IEventListener*>*
+_ControlImpl::GetKeyEventListener(void) const
+{
+ return __pPublicKeyEventListeners;
+}
+
result
_ControlImpl::AddDragDropEventListener(IDragDropEventListener& listener)
{
, __pressedGuideTextColor(Color())
, __isSettingGuideTextColor(false)
, __pDefaultBackgroundEffectBitmap(null)
+ , __pDefaultFocusBitmap(null)
, __pGestureFlick(null)
, __pGestureLongPress(null)
, __pGestureTap(null)
, __pTextFilter(null)
, __previousBounds()
, __isTouchMoving(false)
+ , __isSearchFieldFocused(false)
{
for (int status = 0; status < EDIT_COLOR_MAX; status++)
{
__pDefaultBackgroundEffectBitmap = null;
}
+ if (__pDefaultFocusBitmap)
+ {
+ delete __pDefaultFocusBitmap;
+ __pDefaultFocusBitmap = null;
+ }
+
if (__pTextBlockEvent)
{
delete __pTextBlockEvent;
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
r = GET_BITMAP_CONFIG_N(SEARCHBAR::EDIT_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundEffectBitmap);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
+ r = GET_BITMAP_CONFIG_N(SEARCHBAR::EDIT_BG_FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
_pEditPresenter->SetSearchBarFlag(true);
return r;
}
+void
+_Edit::SetSearchFieldFocus(bool state)
+{
+ __isSearchFieldFocused = state;
+ return;
+}
+
+bool
+_Edit::IsSearchFieldFocused(void) const
+{
+ return __isSearchFieldFocused;
+}
+
Bitmap*
_Edit::GetDefaultBackgroundBitmap(EditStatus status) const
{
_Edit::GetDefaultBackgroundEffectBitmap(void) const
{
return __pDefaultBackgroundEffectBitmap;
+}
+Bitmap*
+_Edit::GetDefaultFocusBitmap(void) const
+{
+ return __pDefaultFocusBitmap;
}
bool
}
}
+ if (GetSearchBarFlag() && __pEdit->IsFocused() && __pEdit->IsSearchFieldFocused())
+ {
+ Bitmap* pFocusBitmap = null;
+ Bitmap* pReplacementColorFocusBitmap = null;
+
+ Color focusColor;
+ GET_COLOR_CONFIG(SEARCHBAR::EDIT_BG_FOCUS, focusColor);
+
+ pFocusBitmap = __pEdit->GetDefaultFocusBitmap();
+
+ pReplacementColorFocusBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pFocusBitmap, Color::GetColor(COLOR_ID_MAGENTA), focusColor);
+
+ if (pReplacementColorFocusBitmap)
+ {
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pReplacementColorFocusBitmap))
+ {
+ canvas.DrawNinePatchedBitmap(editRect, *pReplacementColorFocusBitmap);
+ }
+ else
+ {
+ canvas.DrawBitmap(editRect, *pReplacementColorFocusBitmap);
+ }
+ }
+
+ delete pReplacementColorFocusBitmap;
+ pReplacementColorFocusBitmap = null;
+ }
+
+
if (borderRoundEnable)
{
if (pEditBgBitmap)
#include "FUi_AccessibilityElement.h"
#include "FUi_AccessibilityManager.h"
#include "FUi_CoordinateSystemUtils.h"
+#include "FUiCtrl_SearchBarImpl.h"
+#include "FUiCtrl_EditFieldImpl.h"
+#include "FUiCtrl_ButtonImpl.h"
using namespace Tizen::Graphics;
using namespace Tizen::Ui;
, __isUserGuideTextColor(false)
, __isKeypadOpening(false)
, __isupdateContentBounds(false)
+ , __isKeyPressed(false)
+ , __isFocusCallbackToBeFired(true)
, __keypadAction(CORE_KEYPAD_ACTION_SEARCH)
, __pBackgroundBitmap(null)
, __backgroundColor(Color())
_SearchBar::~_SearchBar(void)
{
-
delete __pSearchBarPresenter;
__pSearchBarPresenter = null;
- if (__pEdit)
- {
- __pEdit->HideKeypad();
-
- __pClippedGroupControl->DetachChild(*__pEdit);
-
- delete __pEdit;
- __pEdit = null;
- }
-
- if (__pCancelButton)
- {
- __pClippedGroupControl->DetachChild(*__pCancelButton);
-
- delete __pCancelButton;
- __pCancelButton = null;
- }
-
if (__pClippedGroupControl)
{
DetachChild(*__pClippedGroupControl);
editBounds.width = (editBounds.width > searchBarMinWidthModeNormal) ? editBounds.width : searchBarMinWidthModeNormal;
editBounds.height = (editBounds.height > searchFieldMinHeight) ? editBounds.height : searchFieldMinHeight;
- __pEdit = _Edit::CreateEditN();
- r = GetLastResult();
- SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+ _SearchBarImpl* pSearchBarImpl = static_cast<_SearchBarImpl*>(GetUserData());
+ __pEdit = &(pSearchBarImpl->GetEditFieldImpl()->GetCore());
- r = __pEdit->Initialize(EDIT_STYLE_NORMAL | EDIT_STYLE_SINGLE_LINE | EDIT_STYLE_CLEAR | EDIT_STYLE_NOSCROLL, INPUT_STYLE_OVERLAY,
- SEARCHBAR_TEXT_LENGTH_MAX);
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturnResult(NID_UI_CTRL, __pEdit != null, E_SYSTEM,
+ "[E_SYSTEM] A system error has occured. Failed to get _Edit instance");
__pEdit->SetKeypadCommandButtonVisible(false);
__pEdit->SetBounds(editBounds);
_ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
- __pCancelButton = _Button::CreateButtonN();
+ _SearchBarImpl* pSearchBarImpl = static_cast<_SearchBarImpl*>(GetUserData());
+ __pCancelButton = &(pSearchBarImpl->GetButtonImpl()->GetCore());
+
+ SysTryReturnResult(NID_UI_CTRL, __pCancelButton != null, E_SYSTEM,
+ "[E_SYSTEM] A system error has occured. Failed to get _Edit instance");
+
r = GetLastResult();
SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
return _UI_TOUCH_EVENT_DELIVERY_YES;
}
- SetMode(SEARCH_BAR_MODE_INPUT);
-
return _UI_TOUCH_EVENT_DELIVERY_YES;
}
bool
_SearchBar::OnFocusGained(const _Control& source)
{
+ if (__isKeyPressed)
+ {
+ __isKeyPressed = false;
+ _Control::OnDrawFocus();
+
+ return true;
+ }
+
if (GetVisibleState() == true)
{
- SetMode(SEARCH_BAR_MODE_INPUT);
__pEdit->SetFocused();
}
- return false;
+ return true;
}
bool
-_SearchBar::OnFocusLost(const _Control& source)
+_SearchBar::OnFocusLost(const _Control &source)
{
- return false;
+ __pEdit->SetSearchFieldFocus(false);
+ _Control::OnFocusLost(source);
+ return true;
}
bool
_SearchBar::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
{
- if (!__pEdit->IsUsbKeyboardConnected())
- {
- return false;
- }
-
_KeyCode keyCode = keyInfo.GetKeyCode();
if (keyCode == _KEY_RIGHT)
{
- if (__isButtonEnabled)
+ if (GetMode() == SEARCH_BAR_MODE_NORMAL)
{
- __pEdit->SetFocused(false);
- __pCancelButton->SetButtonStatus(_BUTTON_STATUS_HIGHLIGHTED);
- __pCancelButton->SetFocused();
- __pCancelButton->Invalidate(true);
+ __pEdit->SetFocused();
+ return true;
}
+ if (!__isButtonEnabled || __pCancelButton->IsFocused() || !__isUsableCancelButton)
+ {
+ return true;
+ }
+
+ __pCancelButton->SetButtonStatus(_BUTTON_STATUS_HIGHLIGHTED);
+ SetFocusCallBackParameter(false);
+ __pCancelButton->SetFocused();
+ __pCancelButton->Invalidate(true);
+
return true;
}
if (__pCancelButton->GetButtonStatus() == _BUTTON_STATUS_HIGHLIGHTED)
{
__pCancelButton->SetButtonStatus(_BUTTON_STATUS_NORMAL);
- __pCancelButton->SetFocused(false);
__pCancelButton->Invalidate();
-
+ __pEdit->SetFocused();
}
if (__pCancelButton->GetButtonStatus() == _BUTTON_STATUS_DISABLED) //Searchbar Button is disabled, left arrow key is pressed
{
__pCancelButton->SetButtonStatus(_BUTTON_STATUS_NORMAL);
SetButtonEnabled(false);
+ __pEdit->SetFocused();
}
- __pEdit->SetFocused();
-
return true;
}
- return false;
-}
+ if (keyCode == _KEY_ENTER || keyCode == _KEY_TAB)
+ {
+ if (GetMode() == SEARCH_BAR_MODE_NORMAL)
+ {
+ return false;
+ }
+
+ SetMode(SEARCH_BAR_MODE_NORMAL);
+ __isKeyPressed = true;
+ SetFocused();
+
+ return true;
+ }
-bool
-_SearchBar::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
-{
return false;
}
__pAccessibilitySearchBarElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
__pAccessibilitySearchBarElement->SetName("SearchBar");
pContainer->AddElement(*__pAccessibilitySearchBarElement);
- }
+ }
return;
}
return;
}
+void
+_SearchBar::OnDrawFocus(void)
+{
+ __pEdit->SetSearchFieldFocus(true);
+ return;
+}
+
bool
_SearchBar::IsContentAttachable(const _Control* pContent)
{
return;
}
+void
+_SearchBar::SetFocusCallBackParameter(bool state)
+{
+ __isFocusCallbackToBeFired = state;
+ return;
+}
+
+bool
+_SearchBar::IsFocusCallBackToBeFired(void) const
+{
+ return __isFocusCallbackToBeFired;
+}
}}} // Tizen::Ui::Controls
#include "FUiCtrl_PublicTextEvent.h"
#include "FUiCtrl_SearchBarImpl.h"
#include "FUi_CoordinateSystemUtils.h"
+#include "FUiCtrl_EditFieldImpl.h"
+#include "FUiCtrl_ButtonImpl.h"
using namespace Tizen::App;
using namespace Tizen::Base;
_SearchBarImpl::_SearchBarImpl(SearchBar* pPublic, _SearchBar* pCore)
: _ControlImpl(pPublic, pCore)
, __pSearchBar(pCore)
+ , __pEditField(null)
+ , __pButton(null)
, __pContentControl(null)
, __pPublicActionEvent(null)
, __pPublicKeypadEvent(null)
, __pPublicTextEvent(null)
, __pPublicSearchBarEvent(null)
, __pPublicLanguageEvent(null)
+ , __pPublicFocusEventListeners(null)
{
ClearLastResult();
}
delete __pPublicSearchBarEvent;
__pPublicSearchBarEvent = null;
}
+
+ if (__pEditField)
+ {
+ delete __pEditField;
+ __pEditField = null;
+ }
+
+ if (__pButton)
+ {
+ delete __pButton;
+ __pButton = null;
+ }
+
+ if (__pPublicFocusEventListeners)
+ {
+ delete __pPublicFocusEventListeners;
+ __pPublicFocusEventListeners = null;
+ }
}
_SearchBarImpl*
break;
}
+ __pEditField = new (std::nothrow) EditField();
+ SysTryReturnResult(NID_UI_CTRL, __pEditField, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
+
+ r = __pEditField->Construct(GetBoundsF(), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_NONE, true);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pEditField->AddFocusEventListener(*this);
+ SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pEditField->AddKeyEventListener(*this);
+ SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pEditFieldImpl = _EditFieldImpl::GetInstance(*__pEditField);
+ SysTryReturnResult(NID_UI_CTRL, __pEditFieldImpl != null, E_SYSTEM,
+ "[E_SYSTEM] A system error has occured. Failed to EditFieldImpl instance");
+
+ String cancelButtonText;
+ GET_STRING_CONFIG(IDS_COM_SK_CANCEL, cancelButtonText);
+
+ __pButton = new (std::nothrow) Button();
+ SysTryReturnResult(NID_UI_CTRL, __pButton, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
+
+ r = __pButton->Construct(GetBoundsF(), cancelButtonText);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pButton->AddFocusEventListener(*this);
+ SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pButtonImpl = _ButtonImpl::GetInstance(*__pButton);
+ SysTryReturnResult(NID_UI_CTRL, __pButtonImpl != null, E_SYSTEM,
+ "[E_SYSTEM] A system error has occured. Failed to ButtonImpl instance");
+
r = __pSearchBar->Initialize(enableSearchBarButton, coreKeypadAction);
SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
r = __pSearchBar->AddLanguageEventListener(*this);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ __pPublicFocusEventListeners = CreatePublicEventListenerListN();
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
return r;
}
return;
}
+void
+_SearchBarImpl::OnFocusEventListenerAdded(IFocusEventListener& listener)
+{
+ ClearLastResult();
+ SysTryReturnVoidResult(NID_UI,
+ __pPublicFocusEventListeners->Add(const_cast <IFocusEventListener*>(&listener)) == E_SUCCESS, E_SYSTEM,
+ "[E_SYSTEM] A system error has occured. Failed to add listener.");
+}
+
+void
+_SearchBarImpl::OnFocusEventListenerRemoved(IFocusEventListener& listener)
+{
+ ClearLastResult();
+ SysTryReturnVoidResult(NID_UI,
+ __pPublicFocusEventListeners->Remove(&listener) == E_SUCCESS, E_SYSTEM,
+ "[E_SYSTEM] A system error has occured. Failed to remove listener.");
+}
+
+void
+_SearchBarImpl::OnFocusGained(const Tizen::Ui::Control& source)
+{
+ SetMode(SEARCH_BAR_MODE_INPUT);
+
+ if (!__pSearchBar->IsFocusCallBackToBeFired())
+ {
+ return;
+ }
+
+ IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
+ if (pEnumerator)
+ {
+ while (pEnumerator->MoveNext() == E_SUCCESS)
+ {
+ IEventListener* pListener = null;
+ pEnumerator->GetCurrent(pListener);
+
+ IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
+
+ if (pFocusEventListener != null )
+ {
+ pFocusEventListener->OnFocusGained(GetPublic());
+ }
+ }
+
+ delete pEnumerator;
+ }
+
+ return;
+}
+
+void
+_SearchBarImpl::OnFocusLost(const Tizen::Ui::Control& source)
+{
+ if (&source == __pEditField && __pButtonImpl->GetCore().GetButtonStatus() != _BUTTON_STATUS_HIGHLIGHTED) //Focus is lost from Edit, and button state is not Highlighted
+ {
+ SetMode(SEARCH_BAR_MODE_NORMAL);
+ }
+
+ if (&source == __pButton) //Button is highlighted and a touch is performed on Edit.
+ {
+ if (__pButtonImpl->GetCore().GetButtonStatus() == _BUTTON_STATUS_HIGHLIGHTED)
+ {
+ __pButtonImpl->GetCore().SetButtonStatus(_BUTTON_STATUS_NORMAL);
+ __pButtonImpl->GetCore().Invalidate();
+ }
+ }
+
+ if (!__pSearchBar->IsFocusCallBackToBeFired())
+ {
+ return;
+ }
+
+ IEnumeratorT<IEventListener*>* pEnumerator = __pPublicFocusEventListeners->GetEnumeratorN();
+ if (pEnumerator)
+ {
+ while (pEnumerator->MoveNext() == E_SUCCESS)
+ {
+ IEventListener* pListener = null;
+ pEnumerator->GetCurrent(pListener);
+
+ IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
+
+ if (pFocusEventListener != null )
+ {
+ pFocusEventListener->OnFocusLost(GetPublic());
+ }
+ }
+
+ delete pEnumerator;
+ }
+
+ return;
+}
+
+void
+_SearchBarImpl::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
+{
+ IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
+ if (pEnumerator)
+ {
+ while (pEnumerator->MoveNext() == E_SUCCESS)
+ {
+ IEventListener* pListener = null;
+ pEnumerator->GetCurrent(pListener);
+
+ IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
+
+ if (pKeyEventListener != null )
+ {
+ pKeyEventListener->OnKeyPressed(GetPublic(), keyCode);
+ }
+ }
+
+ delete pEnumerator;
+ }
+
+ return;
+}
+
+void
+_SearchBarImpl::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
+{
+ IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
+ if (pEnumerator)
+ {
+ while (pEnumerator->MoveNext() == E_SUCCESS)
+ {
+ IEventListener* pListener = null;
+ pEnumerator->GetCurrent(pListener);
+
+ IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
+
+ if (pKeyEventListener != null )
+ {
+ pKeyEventListener->OnKeyReleased(GetPublic(), keyCode);
+ }
+ }
+
+ delete pEnumerator;
+ }
+
+ return;
+}
+
+void
+_SearchBarImpl::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
+{
+ IEnumeratorT<IEventListener*>* pEnumerator = GetKeyEventListener()->GetEnumeratorN();
+ if (pEnumerator)
+ {
+ while (pEnumerator->MoveNext() == E_SUCCESS)
+ {
+ IEventListener* pListener = null;
+ pEnumerator->GetCurrent(pListener);
+
+ IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
+
+ if (pKeyEventListener != null )
+ {
+ pKeyEventListener->OnKeyLongPressed(GetPublic(), keyCode);
+ }
+ }
+
+ delete pEnumerator;
+ }
+
+ return;
+}
+
KeypadAction
_SearchBarImpl::ConvertKeypadAction(CoreKeypadAction keypadAction) const
{
return publicKeypadAction;
}
+_EditFieldImpl*
+_SearchBarImpl::GetEditFieldImpl(void) const
+{
+ return __pEditFieldImpl;
+}
+
+_ButtonImpl*
+_SearchBarImpl::GetButtonImpl(void) const
+{
+ return __pButtonImpl;
+}
+
class _SearchBarMaker
: public _UiBuilderControlMaker
{
delete __pSearchBarModel;
__pSearchBarModel = null;
- if (__pIconElement)
- {
- __pIconElement->Destroy();
- __pIconElement = null;
- }
-
if (__pReplacedSearchFieldNormalBitmap)
{
delete __pReplacedSearchFieldNormalBitmap;
if (mode == SEARCH_BAR_MODE_NORMAL)
{
+ __pSearchBar->SetFocusCallBackParameter(true);
InitializeViewModeLayout();
SetCancelButtonVisible(false);
SetContainerVisible(false);
{
__pEdit->ClearText();
__pEdit->SetBounds(__searchFieldBounds);
- __pEdit->HideKeypad();
+ if (__pEdit->IsFocused())
+ {
+ __pEdit->HideKeypad();
+ }
}
r = __pSearchBar->SendSearchBarEvent(_SEARCH_BAR_EVENT_MODE_CHANGE);
Tizen::Graphics::Bitmap* GetBackgroundBitmap(EditStatus status) const;
result LoadDefaultBackgroundBitmap(GroupStyle groupStyle);
result ReplaceDefaultBackgroundBitmapForSearchBar(void);
+ void SetSearchFieldFocus(bool state);
+ bool IsSearchFieldFocused(void) const;
Tizen::Graphics::Bitmap* GetDefaultBackgroundBitmap(EditStatus status) const;
bool IsCustomDefaultBackgroundBitmap(EditStatus status) const;
Tizen::Graphics::Bitmap* GetDefaultBackgroundEffectBitmap(void) const;
+ Tizen::Graphics::Bitmap* GetDefaultFocusBitmap(void) const;
void GetBlockRange(int& start, int& end) const;
Tizen::Graphics::Color GetBlockTextColor(void) const;
Tizen::Graphics::Color GetColor(EditStatus status) const;
//Default Bitmap
Tizen::Graphics::Bitmap* __pDefaultBackgroundBitmap[EDIT_COLOR_MAX];
Tizen::Graphics::Bitmap* __pDefaultBackgroundEffectBitmap;
+ Tizen::Graphics::Bitmap* __pDefaultFocusBitmap;
Tizen::Ui::_TouchFlickGestureDetector* __pGestureFlick;
Tizen::Ui::_TouchLongPressGestureDetector* __pGestureLongPress;
IEditTextFilter* __pTextFilter;
Tizen::Graphics::FloatRectangle __previousBounds;
bool __isTouchMoving;
+ bool __isSearchFieldFocused;
}; // _Edit
}}} // Tizen::Ui::Controls
SearchFieldStatus GetCurrentStatus(void);
void SetEditTextFilter(IEditTextFilter* pFilter);
void SendOpaqueCommand (const Tizen::Base::String& command);
+ void SetFocusCallBackParameter(bool state);
+ bool IsFocusCallBackToBeFired(void) const;
virtual _UiTouchEventDelivery OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
virtual bool OnFocusLost(const _Control& source);
virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
- virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
protected:
virtual void OnDraw(void);
result CreateContentsArea(void);
result CreateClippedGroupControl(void);
void CreateAccessibilityElement(void);
- //Tizen::Graphics::Font* CreateEditFontN(const Tizen::Graphics::Font* pFont);
+ virtual void OnDrawFocus(void);
Tizen::Ui::_Control* GetParentForm(void) const;
bool __isUserGuideTextColor;
bool __isKeypadOpening;
bool __isupdateContentBounds;
+ bool __isKeyPressed;
+ bool __isFocusCallbackToBeFired;
+
CoreKeypadAction __keypadAction;
Tizen::Graphics::Bitmap* __pBackgroundBitmap;
class _PublicActionEvent;
class _PublicTextEvent;
class _PublicTextBlockEvent;
+class EditField;
+class _EditFieldImpl;
+class _ButtonImpl;
class _SearchBarImpl
: public _ControlImpl
, public _ITextBlockEventListener
, public _ITextEventListener
, public _ISearchBarEventListener
- , virtual public Tizen::Base::Runtime::IEventListener
+ , public IKeyEventListener
+ , public IFocusEventListener
{
public:
static _SearchBarImpl* CreateSearchBarImplN(SearchBar* pCore, const Tizen::Graphics::Rectangle& bounds, bool enableSearchBarButton = true, KeypadAction keypadAction = KEYPAD_ACTION_SEARCH);
virtual void OnLanguageChanged(Tizen::Locales::LanguageCode oldLanguage, Tizen::Locales::LanguageCode newLanguage);
+ void OnFocusEventListenerAdded(IFocusEventListener& listener);
+ void OnFocusEventListenerRemoved(IFocusEventListener& listener);
+
+ //Focus Callbacks
+ virtual void OnFocusGained(const Tizen::Ui::Control& source);
+ virtual void OnFocusLost(const Tizen::Ui::Control& source);
+
+ //Key event Callbacks
+ virtual void OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode);
+ virtual void OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode);
+ virtual void OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode);
+
static _SearchBarImpl* GetInstance(SearchBar& searchBar);
static const _SearchBarImpl* GetInstance(const SearchBar& searchBar);
+ _EditFieldImpl* GetEditFieldImpl(void) const;
+ _ButtonImpl* GetButtonImpl(void) const;
+
private:
_SearchBarImpl(const _SearchBarImpl&);
_SearchBarImpl& operator =(const _SearchBarImpl&);
_SearchBar* __pSearchBar;
+ EditField* __pEditField;
+ Button* __pButton;
+ _EditFieldImpl* __pEditFieldImpl;
+ _ButtonImpl* __pButtonImpl;
+
Control* __pContentControl;
_PublicActionEvent* __pPublicActionEvent;
_PublicSearchBarEvent* __pPublicSearchBarEvent;
_PublicLanguageEvent* __pPublicLanguageEvent;
+ PublicEventListenerList* __pPublicFocusEventListeners;
+
}; // _SearchBarImpl
}}} // Tizen::Ui::Controls
// [ToDo] Rename API: These APIs return collection.
Tizen::Base::Collection::LinkedListT <Tizen::Base::Runtime::IEventListener*>* GetTouchEventListener(void) const;
+ Tizen::Base::Collection::LinkedListT <Tizen::Base::Runtime::IEventListener*>* GetKeyEventListener(void) const;
Tizen::Base::Collection::LinkedListT <Tizen::Base::Runtime::IEventListener*>* GetDragDropEventListener(void) const;
// Queries
DECLARE_COLOR_CONFIG(EDIT_TEXT_NORMAL, 17);
DECLARE_COLOR_CONFIG(EDIT_TEXT_DISABLED, 18);
DECLARE_COLOR_CONFIG(EDIT_TEXT_HIGHLIGHTED, 19);
+ DECLARE_COLOR_CONFIG(EDIT_BG_FOCUS, 20);
+ DECLARE_COLOR_CONFIG(EDIT_BG_PRESSED, 21);
+ DECLARE_COLOR_CONFIG(EDIT_BG_HIGHLIGHTED, 22);
DECLARE_IMAGE_CONFIG(EDIT_BG_NORMAL, 1);
DECLARE_IMAGE_CONFIG(EDIT_BG_DISABLED, 2);
DECLARE_IMAGE_CONFIG(EDIT_BG_HIGHLIGHTED, 3);
DECLARE_IMAGE_CONFIG(EDIT_BG_PRESSED, 4);
- DECLARE_IMAGE_CONFIG(EDIT_BG_EFFECT, 5);
- DECLARE_IMAGE_CONFIG(ICON_NORMAL, 6);
- DECLARE_IMAGE_CONFIG(ICON_EFFECT_NORMAL, 7);
- DECLARE_IMAGE_CONFIG(ICON_DISABLED, 8);
+ DECLARE_IMAGE_CONFIG(EDIT_BG_FOCUS, 5);
+ DECLARE_IMAGE_CONFIG(EDIT_BG_EFFECT, 6);
+ DECLARE_IMAGE_CONFIG(ICON_NORMAL, 7);
+ DECLARE_IMAGE_CONFIG(ICON_EFFECT_NORMAL, 8);
+ DECLARE_IMAGE_CONFIG(ICON_DISABLED, 9);
DECLARE_SHAPE_CONFIG(HORIZONTAL_MARGIN, 1);
DECLARE_SHAPE_CONFIG(VERTICAL_MARGIN, 2);
DECLARE_SHAPE_CONFIG(TEXT_HORIZONTAL_MARGIN, 3);
__pImageKeyTable->Add(ResourceKey(key), _SEARCHBAR::EDIT_BG_PRESSED_IMAGE);
}
{
+ const char* key ="SEARCHBAR::EDIT_BG_FOCUS";
+ __pImageKeyTable->Add(ResourceKey(key), _SEARCHBAR::EDIT_BG_FOCUS_IMAGE);
+ }
+ {
const char* key ="SEARCHBAR::ICON_NORMAL";
__pImageKeyTable->Add(ResourceKey(key), _SEARCHBAR::ICON_NORMAL_IMAGE);
}
__pColorKeyTable->Add(ResourceKey(key), _SEARCHBAR::EDIT_BG_NORMAL_COLOR);
}
{
+ const char* key ="SEARCHBAR::EDIT_BG_PRESSED";
+ __pColorKeyTable->Add(ResourceKey(key), _SEARCHBAR::EDIT_BG_PRESSED_COLOR);
+ }
+ {
+ const char* key ="SEARCHBAR::EDIT_BG_HIGHLIGHTED";
+ __pColorKeyTable->Add(ResourceKey(key), _SEARCHBAR::EDIT_BG_HIGHLIGHTED_COLOR);
+ }
+ {
+ const char* key ="SEARCHBAR::EDIT_BG_FOCUS";
+ __pColorKeyTable->Add(ResourceKey(key), _SEARCHBAR::EDIT_BG_FOCUS_COLOR);
+ }
+ {
const char* key ="SEARCHBAR::EDIT_BG_DISABLED";
__pColorKeyTable->Add(ResourceKey(key), _SEARCHBAR::EDIT_BG_DISABLED_COLOR);
}
ADD_COLOR_CONFIG(BUTTON_TEXT_HIGHLIGHTED, $F032L2P);
ADD_COLOR_CONFIG(EDIT_BG_NORMAL, $W031);
+ ADD_COLOR_CONFIG(EDIT_BG_PRESSED, $B0217);
+ ADD_COLOR_CONFIG(EDIT_BG_HIGHLIGHTED, $W031);
ADD_COLOR_CONFIG(EDIT_BG_DISABLED, $W031D);
+ ADD_COLOR_CONFIG(EDIT_BG_FOCUS, $W161);
ADD_COLOR_CONFIG(GUIDE_TEXT_NORMAL, $W032);
ADD_COLOR_CONFIG(GUIDE_TEXT_DISABLED, $W032D);
ADD_COLOR_CONFIG(GUIDE_TEXT_HIGHLIGHTED, $W032);
ADD_IMAGE_CONFIG(EDIT_BG_HIGHLIGHTED, #00_search_edit_field_bg.#.png);
ADD_IMAGE_CONFIG(EDIT_BG_PRESSED, #00_search_edit_field_bg.#.png);
ADD_IMAGE_CONFIG(EDIT_BG_EFFECT, #00_search_edit_field_bg_ef.#.png);
+ ADD_IMAGE_CONFIG(EDIT_BG_FOCUS, #00_search_edit_field_focus.#.png);
ADD_IMAGE_CONFIG(ICON_NORMAL, #00_search_icon.png);
ADD_IMAGE_CONFIG(ICON_DISABLED, #00_search_icon.png);