Merge "(TableView) Move from devel-api to public-api" into tizen
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / default-controls / check-button-factory.cpp
index 97cd22c..87fbb94 100644 (file)
@@ -1,26 +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 "check-button-factory.h"
 
 // EXTERNAL 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>
-#include <dali/dali.h>
 
 namespace Dali
 {
@@ -43,7 +46,7 @@ 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 ) );
 }
@@ -51,7 +54,7 @@ Alignment CreateAlignedImage( const std::string& imagePath )
 } // namespace
 
 
-CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& checkedImagePath, const std::string& dimmedBackgroundImagePath, const std::string& dimmedCheckedImagePath )
+CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& selectedImagePath, const std::string& disabledBackgroundImagePath, const std::string& disabledSelectedImagePath )
 {
   CheckBoxButton button = Toolkit::CheckBoxButton::New();
 
@@ -60,25 +63,25 @@ CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, con
     button.SetBackgroundImage( CreateAlignedImage( backgroundImagePath ) );
   }
 
-  if( !checkedImagePath.empty() )
+  if( !selectedImagePath.empty() )
   {
-    button.SetCheckedImage( CreateAlignedImage( checkedImagePath ) );
+    button.SetSelectedImage( CreateAlignedImage( selectedImagePath ) );
   }
 
-  if( !dimmedBackgroundImagePath.empty() )
+  if( !disabledBackgroundImagePath.empty() )
   {
-    button.SetDimmedBackgroundImage( CreateAlignedImage( dimmedBackgroundImagePath ) );
+    button.SetDisabledBackgroundImage( CreateAlignedImage( disabledBackgroundImagePath ) );
   }
 
-  if( !dimmedCheckedImagePath.empty() )
+  if( !disabledSelectedImagePath.empty() )
   {
-    button.SetDimmedCheckedImage( CreateAlignedImage( dimmedCheckedImagePath ) );
+    button.SetDisabledSelectedImage( CreateAlignedImage( disabledSelectedImagePath ) );
   }
 
   return button;
 }
 
-CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedImageActor, Actor dimmedBackgroundImageActor, Actor dimmedCheckedImagActor )
+CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor selectedImageActor, Actor disabledBackgroundImageActor, Actor disabledSelectedImagActor )
 {
   CheckBoxButton button = Toolkit::CheckBoxButton::New();
 
@@ -87,25 +90,25 @@ CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedIm
     button.SetBackgroundImage( CreateAlignedImage( backgroundImageActor ) );
   }
 
-  if( checkedImageActor )
+  if( selectedImageActor )
   {
-    button.SetCheckedImage( CreateAlignedImage( checkedImageActor ) );
+    button.SetSelectedImage( CreateAlignedImage( selectedImageActor ) );
   }
 
-  if( dimmedBackgroundImageActor )
+  if( disabledBackgroundImageActor )
   {
-    button.SetDimmedBackgroundImage( CreateAlignedImage( dimmedBackgroundImageActor ) );
+    button.SetDisabledBackgroundImage( CreateAlignedImage( disabledBackgroundImageActor ) );
   }
 
-  if( dimmedCheckedImagActor )
+  if( disabledSelectedImagActor )
   {
-    button.SetDimmedCheckedImage( CreateAlignedImage( dimmedCheckedImagActor ) );
+    button.SetDisabledSelectedImage( CreateAlignedImage( disabledSelectedImagActor ) );
   }
 
   return button;
 }
 
-CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& checkedImagePath )
+CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, const std::string& selectedImagePath )
 {
   CheckBoxButton button = Toolkit::CheckBoxButton::New();
 
@@ -114,15 +117,15 @@ CheckBoxButton CreateCheckBoxButton( const std::string& backgroundImagePath, con
     button.SetBackgroundImage( CreateAlignedImage( backgroundImagePath ) );
   }
 
-  if( !checkedImagePath.empty() )
+  if( !selectedImagePath.empty() )
   {
-    button.SetCheckedImage( CreateAlignedImage( checkedImagePath ) );
+    button.SetSelectedImage( CreateAlignedImage( selectedImagePath ) );
   }
 
   return button;
 }
 
-CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedImageActor )
+CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor selectedImageActor )
 {
   CheckBoxButton button = Toolkit::CheckBoxButton::New();
 
@@ -131,9 +134,9 @@ CheckBoxButton CreateCheckBoxButton( Actor backgroundImageActor, Actor checkedIm
     button.SetBackgroundImage( CreateAlignedImage( backgroundImageActor ) );
   }
 
-  if( checkedImageActor )
+  if( selectedImageActor )
   {
-    button.SetCheckedImage( CreateAlignedImage( checkedImageActor ) );
+    button.SetSelectedImage( CreateAlignedImage( selectedImageActor ) );
   }
 
   return button;