namespace
{
-const std::string DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[] =
+// Signals
+
+const char* const SIGNAL_TEXT_LOADING_FINISHED = "text-loading-finished";
+
+// Default property names
+
+const char* DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[] =
{
"text",
"font",
"shadow-size",
"text-color"
};
-const int DEFAULT_TEXT_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES ) / sizeof( std::string );
+const int DEFAULT_TEXT_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES ) / sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[0] );
const Property::Type DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[DEFAULT_TEXT_ACTOR_PROPERTY_COUNT] =
{
namespace Internal
{
-bool TextActor::mFirstInstance = true;
-Actor::DefaultPropertyLookup* TextActor::mDefaultTextActorPropertyLookup = NULL;
namespace
{
TypeRegistration mType( typeid(Dali::TextActor), typeid(Dali::RenderableActor), Create );
-SignalConnectorType s1( mType, Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED, &TextActor::DoConnectSignal );
+SignalConnectorType s1( mType, SIGNAL_TEXT_LOADING_FINISHED, &TextActor::DoConnectSignal );
}
actor->Initialize();
//create the attachment
- actor->mTextAttachment = TextAttachment::New( *actor->mNode, Integration::TextArray(), fontPtr );
+ actor->mTextAttachment = TextAttachment::New( *actor->mStage, *actor->mNode, Integration::TextArray(), fontPtr );
+ actor->Attach(*actor->mTextAttachment);
// Note: SetTextStyle() MUST be called before SetText(), to ensure
// that a single ResourceRequest for the glyphs is made. Calling
void TextActor::OnInitialize()
{
- if(TextActor::mFirstInstance)
- {
- mDefaultTextActorPropertyLookup = new DefaultPropertyLookup();
- const int start = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
- for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i )
- {
- (*mDefaultTextActorPropertyLookup)[DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[i]] = i + start;
- }
- TextActor::mFirstInstance = false ;
- }
}
TextActor::~TextActor()
{
mTextAttachment->ResetGradient();
}
+ TextChanged();
}
TextStyle TextActor::GetTextStyle() const
bool connected( true );
TextActor* textActor = dynamic_cast<TextActor*>(object);
- if( Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED == signalName )
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_TEXT_LOADING_FINISHED ) )
{
textActor->TextAvailableSignal().Connect( tracker, functor );
}
// emit text available signal
- mLoadingFinishedV2.Emit( Dali::TextActor( this ) );
+ mLoadingFinished.Emit( Dali::TextActor( this ) );
return true;
}
}
}
-const std::string& TextActor::GetDefaultPropertyName( Property::Index index ) const
+const char* TextActor::GetDefaultPropertyName( Property::Index index ) const
{
if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
{
}
else
{
- // index out-of-bounds
- static const std::string INVALID_PROPERTY_NAME;
- return INVALID_PROPERTY_NAME;
+ return NULL;
}
}
}
{
Property::Index index = Property::INVALID_INDEX;
- DALI_ASSERT_DEBUG( NULL != mDefaultTextActorPropertyLookup );
-
- // Look for name in current class' default properties
- DefaultPropertyLookup::const_iterator result = mDefaultTextActorPropertyLookup->find( name );
- if ( mDefaultTextActorPropertyLookup->end() != result )
+ // Look for name in default properties
+ for( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i )
{
- index = result->second;
+ if( 0 == strcmp( name.c_str(), DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[ i ] ) ) // dont want to convert rhs to string
+ {
+ index = i + DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
+ break;
+ }
}
- else
+
+ // If not found, check in base class
+ if( Property::INVALID_INDEX == index )
{
- // If not found, check in base class
index = RenderableActor::GetDefaultPropertyIndex( name );
}
}
else
{
- return true ;
+ return true;
}
}
}
else
{
- return false ;
+ return false;
}
}