Merge remote-tracking branch 'origin/tizen' into devel/new_mesh
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / default-controls / push-button-factory.cpp
index bbc21dc..6558ed5 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.
-//
-
-#include <dali-toolkit/public-api/controls/alignment/alignment.h>
+/*
+ * 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.
+ *
+ */
+
+// HEADER
 #include <dali-toolkit/public-api/controls/default-controls/push-button-factory.h>
 
 // EXTERNAL INCLUDES
-// INTERNAL INCLUDES
+#include <dali/public-api/actors/image-actor.h>
+#include <dali/public-api/images/resource-image.h>
 
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/alignment/alignment.h>
 
 namespace Dali
 {
@@ -42,27 +46,26 @@ Alignment CreateAlignedImage( Actor image )
 
 Alignment CreateAlignedImage( const std::string& imagePath )
 {
-  Image image = Image::New( imagePath );
-
+  Image image = ResourceImage::New( imagePath );
   return CreateAlignedImage( ImageActor::New( image ) );
 }
 
 } // namespace
 
 
-PushButton CreatePushButton( const std::string& releasedImagePath, const std::string& pressedImagePath, const std::string& backgroundImagePath,
-                             const std::string& dimmedReleasedImagePath, const std::string& dimmedBackgroundImagePath )
+PushButton CreatePushButton( const std::string& unselectedImagePath, const std::string& selectedImagePath, const std::string& backgroundImagePath,
+                             const std::string& disabledUnselectedImagePath, const std::string& disabledBackgroundImagePath )
 {
   PushButton button = Toolkit::PushButton::New();
 
-  if( !releasedImagePath.empty() )
+  if( !unselectedImagePath.empty() )
   {
-    button.SetButtonImage( CreateAlignedImage( releasedImagePath ) );
+    button.SetButtonImage( CreateAlignedImage( unselectedImagePath ) );
   }
 
-  if( !pressedImagePath.empty() )
+  if( !selectedImagePath.empty() )
   {
-    button.SetPressedImage( CreateAlignedImage( pressedImagePath ) );
+    button.SetSelectedImage( CreateAlignedImage( selectedImagePath ) );
   }
 
   if( !backgroundImagePath.empty() )
@@ -70,32 +73,32 @@ PushButton CreatePushButton( const std::string& releasedImagePath, const std::st
     button.SetBackgroundImage( CreateAlignedImage( backgroundImagePath ) );
   }
 
-  if( !dimmedReleasedImagePath.empty() )
+  if( !disabledUnselectedImagePath.empty() )
   {
-    button.SetDimmedImage( CreateAlignedImage( dimmedReleasedImagePath ) );
+    button.SetDisabledImage( CreateAlignedImage( disabledUnselectedImagePath ) );
   }
 
-  if( !dimmedBackgroundImagePath.empty() )
+  if( !disabledBackgroundImagePath.empty() )
   {
-    button.SetDimmedBackgroundImage( CreateAlignedImage( dimmedBackgroundImagePath ) );
+    button.SetDisabledBackgroundImage( CreateAlignedImage( disabledBackgroundImagePath ) );
   }
 
   return button;
 }
 
-PushButton CreatePushButton( Actor releasedImageActor, Actor pressedImageActor, Actor backgroundImageActor,
-                             Actor dimmedReleasedImageActor, Actor dimmedBackgroundImageActor )
+PushButton CreatePushButton( Actor unselectedImageActor, Actor selectedImageActor, Actor backgroundImageActor,
+                             Actor disabledUnselectedImageActor, Actor disabledBackgroundImageActor )
 {
   PushButton button = Toolkit::PushButton::New();
 
-  if( releasedImageActor )
+  if( unselectedImageActor )
   {
-    button.SetButtonImage( CreateAlignedImage( releasedImageActor ) );
+    button.SetButtonImage( CreateAlignedImage( unselectedImageActor ) );
   }
 
-  if( pressedImageActor )
+  if( selectedImageActor )
   {
-    button.SetPressedImage( CreateAlignedImage( pressedImageActor ) );
+    button.SetSelectedImage( CreateAlignedImage( selectedImageActor ) );
   }
 
   if( backgroundImageActor )
@@ -103,14 +106,14 @@ PushButton CreatePushButton( Actor releasedImageActor, Actor pressedImageActor,
     button.SetBackgroundImage( CreateAlignedImage( backgroundImageActor ) );
   }
 
-  if( dimmedReleasedImageActor )
+  if( disabledUnselectedImageActor )
   {
-    button.SetDimmedImage( CreateAlignedImage( dimmedReleasedImageActor ) );
+    button.SetDisabledImage( CreateAlignedImage( disabledUnselectedImageActor ) );
   }
 
-  if( dimmedBackgroundImageActor )
+  if( disabledBackgroundImageActor )
   {
-    button.SetDimmedBackgroundImage( CreateAlignedImage( dimmedBackgroundImageActor ) );
+    button.SetDisabledBackgroundImage( CreateAlignedImage( disabledBackgroundImageActor ) );
   }
 
   return button;