2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
22 #include <dali/public-api/object/type-registry.h>
35 const Property::Index TextLabel::PROPERTY_TEXT( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX );
46 return Toolkit::TextLabel::New();
49 TypeRegistration mType( typeid(Toolkit::TextLabel), typeid(Toolkit::Control), Create );
51 PropertyRegistration property1( mType, "text", Toolkit::TextLabel::PROPERTY_TEXT, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty );
55 Toolkit::TextLabel TextLabel::New()
57 // Create the implementation, temporarily owned by this handle on stack
58 IntrusivePtr< TextLabel > impl = new TextLabel();
60 // Pass ownership to CustomActor handle
61 Toolkit::TextLabel handle( *impl );
63 // Second-phase init of the implementation
64 // This can only be done after the CustomActor connection has been made...
70 void TextLabel::SetRenderer( Text::RendererPtr renderer )
75 void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
77 Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
81 TextLabel& labelImpl( GetImpl( label ) );
84 case Toolkit::TextLabel::PROPERTY_TEXT:
86 labelImpl.mText = value.Get< std::string >();
88 // TODO - Update Model etc.
95 Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index index )
97 Property::Value value;
99 Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
103 TextLabel& labelImpl( GetImpl( label ) );
106 case Toolkit::TextLabel::PROPERTY_TEXT:
108 value = labelImpl.mText;
117 void TextLabel::OnInitialize()
121 TextLabel::TextLabel()
122 : Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) )
126 TextLabel::~TextLabel()
130 } // namespace Internal
132 } // namespace Toolkit