Merge "Added TextLabel and TextField tests" into tizen
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / buttons / push-button.cpp
index 5ca5681..d9e395e 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
 
@@ -21,6 +22,7 @@
 // INTERNAL INCLUDES
 
 #include <dali-toolkit/internal/controls/buttons/push-button-impl.h>
+#include <dali/public-api/actors/image-actor.h>
 
 namespace Dali
 {
@@ -28,12 +30,6 @@ namespace Dali
 namespace Toolkit
 {
 
-const char* const PushButton::SIGNAL_TOGGLED = "toggled";
-const char* const PushButton::SIGNAL_PRESSED = "pressed";
-const char* const PushButton::SIGNAL_RELEASED = "released";
-
-const char* const PushButton::ACTION_PUSH_BUTTON_CLICK = "push-button-click";
-
 PushButton::PushButton()
 : Button()
 {
@@ -78,59 +74,11 @@ PushButton PushButton::DownCast( BaseHandle handle )
   return Control::DownCast<PushButton, Internal::PushButton>(handle);
 }
 
-void PushButton::SetAutoRepeating( bool autoRepeating )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetAutoRepeating( autoRepeating );
-}
-
-bool PushButton::IsAutoRepeating() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).IsAutoRepeating();
-}
-
-void PushButton::SetInitialAutoRepeatingDelay( float initialAutoRepeatingDelay )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetInitialAutoRepeatingDelay( initialAutoRepeatingDelay );
-}
-
-float PushButton::GetInitialAutoRepeatingDelay() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).GetInitialAutoRepeatingDelay();
-}
-
-void PushButton::SetNextAutoRepeatingDelay( float nextAutoRepeatingDelay )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetNextAutoRepeatingDelay( nextAutoRepeatingDelay );
-}
-
-float PushButton::GetNextAutoRepeatingDelay() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).GetNextAutoRepeatingDelay();
-}
-
-void PushButton::SetToggleButton( bool toggle )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetToggleButton( toggle );
-}
-
-bool PushButton::IsToggleButton() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).IsToggleButton();
-}
-
-void PushButton::SetToggled( bool toggle )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetToggled( toggle );
-}
-
-bool PushButton::IsToggled() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).IsToggled();
-}
-
 void PushButton::SetButtonImage( Image image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetButtonImage( image );
+  Actor imageActor = ImageActor::New( image );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+  Dali::Toolkit::GetImplementation( *this ).SetButtonImage( imageActor );
 }
 
 void PushButton::SetButtonImage( Actor image )
@@ -145,7 +93,9 @@ Actor PushButton::GetButtonImage() const
 
 void PushButton::SetBackgroundImage( Image image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( image );
+  Actor imageActor = ImageActor::New( image );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+  Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( imageActor );
 }
 
 void PushButton::SetBackgroundImage( Actor image )
@@ -158,79 +108,70 @@ Actor PushButton::GetBackgroundImage() const
   return Dali::Toolkit::GetImplementation( *this ).GetBackgroundImage();
 }
 
-void PushButton::SetPressedImage( Image image )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetPressedImage( image );
-}
-
-void PushButton::SetPressedImage( Actor image )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetPressedImage( image );
-}
-
-Actor PushButton::GetPressedImage() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).GetPressedImage();
-}
-
-void PushButton::SetDimmedBackgroundImage( Image image )
+void PushButton::SetSelectedImage( Image image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetDimmedBackgroundImage( image );
+  Actor imageActor = ImageActor::New( image );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+  Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( imageActor );
 }
 
-void PushButton::SetDimmedBackgroundImage( Actor image )
+void PushButton::SetSelectedImage( Actor image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetDimmedBackgroundImage( image );
+  Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( image );
 }
 
-Actor PushButton::GetDimmedBackgroundImage() const
+Actor PushButton::GetSelectedImage() const
 {
-  return Dali::Toolkit::GetImplementation( *this ).GetDimmedBackgroundImage();
+  return Dali::Toolkit::GetImplementation( *this ).GetSelectedImage();
 }
 
-void PushButton::SetDimmedImage( Image image )
+void PushButton::SetSelectedBackgroundImage( Image image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetDimmedImage( image );
+  Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( ImageActor::New( image ) );
 }
 
-void PushButton::SetDimmedImage( Actor image )
+void PushButton::SetSelectedBackgroundImage( Actor image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetDimmedImage( image );
+  Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( image );
 }
 
-Actor PushButton::GetDimmedImage() const
+Actor PushButton::GetSelectedBackgroundImage() const
 {
-  return Dali::Toolkit::GetImplementation( *this ).GetDimmedImage();
+  return Dali::Toolkit::GetImplementation( *this ).GetSelectedBackgroundImage();
 }
 
-void PushButton::SetLabelText( const std::string& text )
+void PushButton::SetDisabledBackgroundImage( Image image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetLabelText( text );
+  Actor imageActor = ImageActor::New( image );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+  Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( imageActor );
 }
 
-void PushButton::SetLabelText( Actor text )
+void PushButton::SetDisabledBackgroundImage( Actor image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetLabelText( text );
+  Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( image );
 }
 
-Actor PushButton::GetLabelText() const
+Actor PushButton::GetDisabledBackgroundImage() const
 {
-  return Dali::Toolkit::GetImplementation( *this ).GetLabelText();
+  return Dali::Toolkit::GetImplementation( *this ).GetDisabledBackgroundImage();
 }
 
-PushButton::ToggledSignalV2& PushButton::ToggledSignal()
+void PushButton::SetDisabledImage( Image image )
 {
-  return Dali::Toolkit::GetImplementation( *this ).ToggledSignal();
+  Actor imageActor = ImageActor::New( image );
+  imageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+  Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( imageActor );
 }
 
-PushButton::PressedSignalV2& PushButton::PressedSignal()
+void PushButton::SetDisabledImage( Actor image )
 {
-  return Dali::Toolkit::GetImplementation( *this ).PressedSignal();
+  Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( image );
 }
 
-PushButton::ReleasedSignalV2& PushButton::ReleasedSignal()
+Actor PushButton::GetDisabledImage() const
 {
-  return Dali::Toolkit::GetImplementation( *this ).ReleasedSignal();
+  return Dali::Toolkit::GetImplementation( *this ).GetDisabledImage();
 }
 
 } // namespace Toolkit