New with additional behavior flag for some Controls
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / text-controls / text-label.cpp
index e647d8a..6591d8d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
-const std::string TextLabel::RENDERING_BACKEND_PROPERTY_NAME("rendering-backend");
-const std::string TextLabel::TEXT_PROPERTY_NAME("text");
-const std::string TextLabel::MULTI_LINE_PROPERTY_NAME("multi-line");
-
 TextLabel TextLabel::New()
 {
   return Internal::TextLabel::New();
 }
 
-TextLabel::TextLabel()
+TextLabel TextLabel::New(const std::string& text)
+{
+  TextLabel label = Internal::TextLabel::New();
+  label.SetProperty(TextLabel::Property::TEXT, text);
+
+  return label;
+}
+
+TextLabel TextLabel::New(ControlBehaviour additionalBehaviour)
 {
+  return Internal::TextLabel::New(static_cast<Toolkit::Internal::Control::ControlBehaviour>(additionalBehaviour));
 }
 
-TextLabel::TextLabel( const TextLabel& handle )
-: Control( handle )
+TextLabel TextLabel::New(ControlBehaviour additionalBehaviour, const std::string& text)
 {
+  TextLabel label = Internal::TextLabel::New(static_cast<Toolkit::Internal::Control::ControlBehaviour>(additionalBehaviour));
+  label.SetProperty(TextLabel::Property::TEXT, text);
+
+  return label;
 }
 
-TextLabel& TextLabel::operator=( const TextLabel& handle )
+TextLabel::TextLabel()
 {
-  if( &handle != this )
-  {
-    Control::operator=( handle );
-  }
-  return *this;
 }
 
+TextLabel::TextLabel(const TextLabel& handle) = default;
+
+TextLabel::TextLabel(TextLabel&& rhs) = default;
+
+TextLabel& TextLabel::operator=(const TextLabel& handle) = default;
+
+TextLabel& TextLabel::operator=(TextLabel&& rhs) = default;
+
 TextLabel::~TextLabel()
 {
 }
 
-TextLabel TextLabel::DownCast( BaseHandle handle )
+TextLabel TextLabel::DownCast(BaseHandle handle)
 {
   return Control::DownCast<TextLabel, Internal::TextLabel>(handle);
 }
 
-TextLabel::TextLabel( Internal::TextLabel& implementation )
+TextLabel::TextLabel(Internal::TextLabel& implementation)
 : Control(implementation)
 {
 }
 
-TextLabel::TextLabel( Dali::Internal::CustomActor* internal )
-: Control( internal )
+TextLabel::TextLabel(Dali::Internal::CustomActor* internal)
+: Control(internal)
 {
-  VerifyCustomActorPointer<Internal::TextLabel>( internal );
+  VerifyCustomActorPointer<Internal::TextLabel>(internal);
 }
 
 } // namespace Toolkit