fix button enable/disable
authorMyung Jin Kim <critical.kim@samsung.com>
Thu, 2 May 2013 16:24:15 +0000 (01:24 +0900)
committerMyung Jin Kim <critical.kim@samsung.com>
Thu, 2 May 2013 16:24:15 +0000 (01:24 +0900)
Change-Id: I5c87c14eeb3291ebbceadea62ab83a7718d7d2ca

src/ui/controls/FUiCtrl_Button.cpp
src/ui/controls/FUiCtrl_ButtonPresenter.cpp
src/ui/inc/FUiCtrl_Button.h
src/ui/inc/FUiCtrl_ButtonPresenter.h

index 477d599..43397e7 100644 (file)
@@ -349,9 +349,9 @@ _Button::OnFontInfoRequested(unsigned long& style, float& size)
 }
 
 void
-_Button::OnAncestorInputEnableStateChanged(const _Control& control)
+_Button::OnAncestorEnableStateChanged(const _Control& control)
 {
-       __pButtonPresenter->OnAncestorInputEnableStateChanged(control);
+       __pButtonPresenter->OnAncestorEnableStateChanged(control);
 
        return;
 }
@@ -1123,7 +1123,7 @@ _Button::GetButtonStatus(void) const
 {
        _ButtonStatus status = __buttonStatus;
 
-       if (!IsEnabled())
+       if (IsEnabled() == false && status != _BUTTON_STATUS_SELECTED)
        {
                status = _BUTTON_STATUS_DISABLED;
        }
@@ -1136,7 +1136,7 @@ _Button::GetPrevButtonStatus(void) const
 {
        _ButtonStatus status = __prevButtonStatus;
 
-       if (!IsEnabled())
+       if (IsEnabled() == false && status != _BUTTON_STATUS_SELECTED)
        {
                status = _BUTTON_STATUS_DISABLED;
        }
index 3dec074..6b6b390 100644 (file)
@@ -1001,15 +1001,18 @@ _ButtonPresenter::OnTouchMoveHandled(const _Control& control)
 }
 
 void
-_ButtonPresenter::OnAncestorInputEnableStateChanged(const _Control& control)
+_ButtonPresenter::OnAncestorEnableStateChanged(const _Control& control)
 {
        if (!__pButton->IsEnabled())
        {
                return;
        }
 
-       __pButton->SetButtonStatus(_BUTTON_STATUS_NORMAL);
-       __pButton->Invalidate();
+       if (__pButton->GetButtonStatus() == _BUTTON_STATUS_PRESSED)
+       {
+               __pButton->SetButtonStatus(_BUTTON_STATUS_NORMAL);
+               __pButton->Invalidate();
+       }
 
        return;
 }
index 464ff78..2fbf55f 100644 (file)
@@ -136,7 +136,7 @@ public:
        virtual void OnFontInfoRequested(unsigned long& style, float& size);
        virtual Tizen::Graphics::Dimension GetContentSize(void) const;
        virtual Tizen::Graphics::FloatDimension GetContentSizeF(void) const;
-       virtual void OnAncestorInputEnableStateChanged(const _Control& control);
+       virtual void OnAncestorEnableStateChanged(const _Control& control);
 
 public:
        result SetText(const Tizen::Base::String& text);
index d28ca14..1e7381b 100644 (file)
@@ -62,7 +62,7 @@ public:
        virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
        virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
        virtual void OnTouchMoveHandled(const _Control& control);
-       virtual void OnAncestorInputEnableStateChanged(const _Control& control);
+       virtual void OnAncestorEnableStateChanged(const _Control& control);
 
        void Draw(void);