From ca5a9279807309c1fec1286ce75d042ae80746fb Mon Sep 17 00:00:00 2001 From: "keonpyo.kong" Date: Tue, 30 Apr 2013 17:31:07 +0900 Subject: [PATCH] Add OnFocusableStateChanged call back Change-Id: I25b7b6017df9f313c8de8fd0b748d258814b595e Signed-off-by: keonpyo.kong apply code review Change-Id: I16d49d3e3cb87e8f4bebbf1ec5f3bac7831a8e20 Signed-off-by: keonpyo.kong --- src/ui/FUi_Control.cpp | 10 ++++++++++ src/ui/FUi_ControlImpl.cpp | 10 ++++++---- src/ui/FUi_Window.cpp | 7 +++++++ src/ui/inc/FUi_Control.h | 4 +++- src/ui/inc/FUi_ControlImpl.h | 3 ++- src/ui/inc/FUi_Window.h | 1 + 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/ui/FUi_Control.cpp b/src/ui/FUi_Control.cpp index ab1e038..8fed3a9 100644 --- a/src/ui/FUi_Control.cpp +++ b/src/ui/FUi_Control.cpp @@ -942,6 +942,11 @@ _Control::OnBackgroundColorChanged(Color& backgroundColor) { } +void +_Control::OnFocusableStateChanged(bool focusalbeState) +{ +} + void _Control::OnTouchCancelHandled(const _Control& control) { @@ -2427,7 +2432,12 @@ void _Control::SetFocusable(bool focusable) { ClearLastResult(); + bool oldState = __focusable; __focusable = focusable; + if (oldState != __focusable) + { + GetControlDelegate().OnFocusableStateChanged(focusable); + } } bool diff --git a/src/ui/FUi_ControlImpl.cpp b/src/ui/FUi_ControlImpl.cpp index 7d7e2aa..b6089a2 100644 --- a/src/ui/FUi_ControlImpl.cpp +++ b/src/ui/FUi_ControlImpl.cpp @@ -2697,6 +2697,12 @@ _ControlImpl::OnBackgroundColorChanged(Color& backgroundColor) GetCore().OnBackgroundColorChanged(backgroundColor); } +void +_ControlImpl::OnFocusableStateChanged(bool focusalbeState) +{ + GetCore().OnFocusableStateChanged(focusalbeState); +} + void _ControlImpl::OnTouchCancelHandled(const _Control& control) { @@ -3387,10 +3393,6 @@ _ControlImpl::SetFocusable(bool focusable) E_INVALID_OPERATION, "[E_INVALID_OPERATION] The control can't chage it's focusable property."); SysTryReturn(NID_UI, - IsAttachedToMainTree(), E_SYSTEM, - E_SYSTEM, "[E_SYSTEM] This control should be attached to the main tree."); - - SysTryReturn(NID_UI, focusable || GetCore().GetFocused() != &this->GetCore(), E_INVALID_OPERATION, E_INVALID_OPERATION, "[E_INVALID_OPERATION] This already focused control cannot be unfocusable."); diff --git a/src/ui/FUi_Window.cpp b/src/ui/FUi_Window.cpp index 329c469..db591e0 100644 --- a/src/ui/FUi_Window.cpp +++ b/src/ui/FUi_Window.cpp @@ -439,6 +439,13 @@ _Window::OnNativeWindowActivated(void) } +void +_Window::OnFocusableStateChanged(bool focusalbeState) +{ + SetActivationEnabled(focusalbeState); +} + + bool _Window::OnNotifiedN(const _Control& source, IList* pArgs) { diff --git a/src/ui/inc/FUi_Control.h b/src/ui/inc/FUi_Control.h index 19cb0bc..4a1c38b 100644 --- a/src/ui/inc/FUi_Control.h +++ b/src/ui/inc/FUi_Control.h @@ -116,6 +116,7 @@ public: virtual void OnDrawFocus(void) = 0; virtual void OnChildControlFocusMoved(const _Control& control) = 0; virtual bool IsChildControlFocusManage(void) const = 0; + virtual void OnFocusableStateChanged(bool focusalbeState) = 0; }; class _IPropagatedTouchEventListener @@ -263,9 +264,10 @@ public: virtual void OnFontInfoRequested(unsigned long& style, int& size); virtual void OnFontInfoRequested(unsigned long& style, float& size); virtual void OnBackgroundColorChanged(Tizen::Graphics::Color& backgroundColor); - virtual void OnDrawFocus(void); + virtual void OnDrawFocus(void); virtual void OnChildControlFocusMoved(const _Control& control); virtual bool IsChildControlFocusManage(void) const; + virtual void OnFocusableStateChanged(bool focusalbeState); // Control Hierarchy - Common bool HasParent(void) const; diff --git a/src/ui/inc/FUi_ControlImpl.h b/src/ui/inc/FUi_ControlImpl.h index 37b439a..2746558 100644 --- a/src/ui/inc/FUi_ControlImpl.h +++ b/src/ui/inc/FUi_ControlImpl.h @@ -169,8 +169,9 @@ public: virtual void OnFontInfoRequested(unsigned long& style, float& size); virtual void OnBackgroundColorChanged(Tizen::Graphics::Color& backgroundColor); virtual void OnDrawFocus(void); - virtual void OnChildControlFocusMoved(const _Control& control); + virtual void OnChildControlFocusMoved(const _Control& control); virtual bool IsChildControlFocusManage(void) const; + virtual void OnFocusableStateChanged(bool focusalbeState); // Event Callbacks virtual bool OnKeyPressed(const _ControlImpl& source, const _KeyInfo& keyInfo); diff --git a/src/ui/inc/FUi_Window.h b/src/ui/inc/FUi_Window.h index b755e90..8f377de 100644 --- a/src/ui/inc/FUi_Window.h +++ b/src/ui/inc/FUi_Window.h @@ -98,6 +98,7 @@ public: virtual result OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds); virtual result OnAttachingToMainTree(const _Control* pParent); virtual result OnDetachingFromMainTree(void); + virtual void OnFocusableStateChanged(bool focusalbeState); #if defined(WINDOW_BASE_ROTATE) void OnWindowStateChanged(void); void SetPreferredRotation(bool enable); -- 2.7.4