Add OnFocusableStateChanged call back
authorkeonpyo.kong <keonpyo.kong@samsung.com>
Tue, 30 Apr 2013 08:31:07 +0000 (17:31 +0900)
committerkeonpyo.kong <keonpyo.kong@samsung.com>
Tue, 30 Apr 2013 09:37:41 +0000 (18:37 +0900)
Change-Id: I25b7b6017df9f313c8de8fd0b748d258814b595e
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
apply code review

Change-Id: I16d49d3e3cb87e8f4bebbf1ec5f3bac7831a8e20
Signed-off-by: keonpyo.kong <keonpyo.kong@samsung.com>
src/ui/FUi_Control.cpp
src/ui/FUi_ControlImpl.cpp
src/ui/FUi_Window.cpp
src/ui/inc/FUi_Control.h
src/ui/inc/FUi_ControlImpl.h
src/ui/inc/FUi_Window.h

index ab1e038..8fed3a9 100644 (file)
@@ -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
index 7d7e2aa..b6089a2 100644 (file)
@@ -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.");
 
index 329c469..db591e0 100644 (file)
@@ -439,6 +439,13 @@ _Window::OnNativeWindowActivated(void)
 
 }
 
+void 
+_Window::OnFocusableStateChanged(bool focusalbeState)
+{
+       SetActivationEnabled(focusalbeState);
+}
+
+
 bool
 _Window::OnNotifiedN(const _Control& source, IList* pArgs)
 {
index 19cb0bc..4a1c38b 100644 (file)
@@ -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;
index 37b439a..2746558 100644 (file)
@@ -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);
index b755e90..8f377de 100644 (file)
@@ -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);