Merge "Make radio buttons work with size negotiation, bug fixes." into tizen
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / buttons / push-button-impl.cpp
index 4f87d38..34245c2 100644 (file)
@@ -1,18 +1,19 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
 
@@ -58,9 +59,8 @@ BaseHandle Create()
 
 TypeRegistration typeRegistration( typeid(Toolkit::PushButton), typeid(Toolkit::Button), Create );
 
-SignalConnectorType signalConnector1( typeRegistration, Toolkit::PushButton::SIGNAL_TOGGLED , &PushButton::DoConnectSignal );
-SignalConnectorType signalConnector2( typeRegistration, Toolkit::PushButton::SIGNAL_PRESSED , &PushButton::DoConnectSignal );
-SignalConnectorType signalConnector3( typeRegistration, Toolkit::PushButton::SIGNAL_RELEASED, &PushButton::DoConnectSignal );
+SignalConnectorType signalConnector1( typeRegistration, Toolkit::PushButton::SIGNAL_PRESSED , &PushButton::DoConnectSignal );
+SignalConnectorType signalConnector2( typeRegistration, Toolkit::PushButton::SIGNAL_RELEASED, &PushButton::DoConnectSignal );
 
 TypeAction action1( typeRegistration, Toolkit::PushButton::ACTION_PUSH_BUTTON_CLICK, &PushButton::DoAction );
 
@@ -355,11 +355,6 @@ Actor& PushButton::GetFadeOutButtonImage()
   return mFadeOutButtonImage;
 }
 
-Toolkit::PushButton::ToggledSignalV2& PushButton::ToggledSignal()
-{
-  return mToggledSignalV2;
-}
-
 Toolkit::PushButton::PressedSignalV2& PushButton::PressedSignal()
 {
   return mPressedSignalV2;
@@ -583,7 +578,7 @@ void PushButton::OnButtonUp()
       // Notifies the painter the button has been toggled.
       GetPushButtonPainter( mPainter )->Toggled( handle );
 
-      //Emit signal.
+      // Emit signal.
       mToggledSignalV2.Emit( handle, mToggled );
     }
     else
@@ -643,6 +638,25 @@ float PushButton::OnAnimationTimeRequested() const
   return GetPushButtonPainter( mPainter )->GetAnimationTime();
 }
 
+void PushButton::OnButtonStageDisconnection()
+{
+  if( ButtonDown == mState )
+  {
+    if( !mToggleButton )
+    {
+      Toolkit::PushButton handle( GetOwner() );
+
+      // Notifies the painter the button has been released.
+      GetPushButtonPainter( mPainter )->Released( handle );
+
+      if( mAutoRepeating )
+      {
+        mAutoRepeatingTimer.Reset();
+      }
+    }
+  }
+}
+
 PushButton::PushButton()
 : Button(),
   mAutoRepeating( false ),