DALi Version 1.2.61
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / buttons / push-button.cpp
index 5ca5681..22dba2d 100644 (file)
@@ -1,25 +1,29 @@
-//
-// 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) 2015 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
-
 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
 
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+#include <dali/public-api/images/resource-image.h>
 
+// INTERNAL INCLUDES
 #include <dali-toolkit/internal/controls/buttons/push-button-impl.h>
 
 namespace Dali
@@ -28,12 +32,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,159 +76,55 @@ 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 );
-}
+// Deprecated API
 
 void PushButton::SetButtonImage( Actor image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetButtonImage( image );
-}
-
-Actor PushButton::GetButtonImage() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).GetButtonImage();
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetButtonImage() is deprecated and will be removed from next release. Use Button.SetProperty UNSELECTED_STATE_IMAGE or Styling file instead.\n" );
 
-void PushButton::SetBackgroundImage( Image image )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( image );
+  Dali::Toolkit::GetImplementation( *this ).SetButtonImage( image );
 }
 
 void PushButton::SetBackgroundImage( Actor image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( image );
-}
-
-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 );
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetBackgroundImage() is deprecated and will be removed from next release.\n" );
 
-Actor PushButton::GetPressedImage() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).GetPressedImage();
+  Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( image );
 }
 
-void PushButton::SetDimmedBackgroundImage( Image image )
+void PushButton::SetSelectedImage( Actor image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetDimmedBackgroundImage( image );
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedImage() is deprecated and will be removed from next release. Use Button.SetProperty SELECTED_STATE_IMAGE or Styling file instead.\n" );
 
-void PushButton::SetDimmedBackgroundImage( Actor image )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetDimmedBackgroundImage( image );
+  Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( image );
 }
 
-Actor PushButton::GetDimmedBackgroundImage() const
+void PushButton::SetSelectedBackgroundImage( Actor image )
 {
-  return Dali::Toolkit::GetImplementation( *this ).GetDimmedBackgroundImage();
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetSelectedBackgroundImage() is deprecated and will be removed from next release.\n" );
 
-void PushButton::SetDimmedImage( Image image )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetDimmedImage( image );
+  Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( image );
 }
 
-void PushButton::SetDimmedImage( Actor image )
+void PushButton::SetDisabledBackgroundImage( Actor image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetDimmedImage( image );
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledBackgroundImage() is deprecated and will be removed from next release.\n" );
 
-Actor PushButton::GetDimmedImage() const
-{
-  return Dali::Toolkit::GetImplementation( *this ).GetDimmedImage();
+  Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( image );
 }
 
-void PushButton::SetLabelText( const std::string& text )
+void PushButton::SetDisabledImage( Actor image )
 {
-  Dali::Toolkit::GetImplementation( *this ).SetLabelText( text );
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledImage() is deprecated and will be removed from next release. Use Button.SetProperty DISABLED_STATE_IMAGE or Styling file instead.\n" );
 
-void PushButton::SetLabelText( Actor text )
-{
-  Dali::Toolkit::GetImplementation( *this ).SetLabelText( text );
+  Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( image );
 }
 
-Actor PushButton::GetLabelText() const
+void PushButton::SetDisabledSelectedImage( Actor image )
 {
-  return Dali::Toolkit::GetImplementation( *this ).GetLabelText();
-}
-
-PushButton::ToggledSignalV2& PushButton::ToggledSignal()
-{
-  return Dali::Toolkit::GetImplementation( *this ).ToggledSignal();
-}
+  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetDisabledSelectedImage() is deprecated and will be removed from next release.\n" );
 
-PushButton::PressedSignalV2& PushButton::PressedSignal()
-{
-  return Dali::Toolkit::GetImplementation( *this ).PressedSignal();
-}
-
-PushButton::ReleasedSignalV2& PushButton::ReleasedSignal()
-{
-  return Dali::Toolkit::GetImplementation( *this ).ReleasedSignal();
+  Dali::Toolkit::GetImplementation( *this ).SetDisabledSelectedImage( image );
 }
 
 } // namespace Toolkit