Dali::Integration::Log::Filter* gLogFilter = Dali::Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_STYLE_MONITOR");
#endif
-BaseHandle Create()
-{
- BaseHandle handle( StyleMonitor::Get() );
-
- if ( !handle && Adaptor::IsAvailable() )
- {
- Dali::SingletonService service( SingletonService::Get() );
- if ( service )
- {
- Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
- Dali::StyleMonitor styleMonitor = Dali::StyleMonitor( new StyleMonitor( adaptorImpl.GetPlatformAbstraction() ) );
- service.Register( typeid( styleMonitor ), styleMonitor );
- handle = styleMonitor;
- }
- }
-
- return handle;
-}
-TypeRegistration STYLE_MONITOR_TYPE( typeid(Dali::StyleMonitor), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
/**
* Use font client to get the system default font family
* @param[in] fontClient handle to font client
Dali::StyleMonitor styleMonitor;
Dali::SingletonService service( SingletonService::Get() );
- if ( service )
+ if( service )
{
// Check whether the singleton is already created
Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::StyleMonitor ) );
- if(handle)
+ if( handle )
{
// If so, downcast the handle
styleMonitor = Dali::StyleMonitor( dynamic_cast< StyleMonitor* >( handle.GetObjectPtr() ) );
}
+ else
+ {
+ styleMonitor = Dali::StyleMonitor( new StyleMonitor() );
+ service.Register( typeid( styleMonitor ), styleMonitor );
+ }
}
return styleMonitor;
}
-StyleMonitor::StyleMonitor(Integration::PlatformAbstraction& platformAbstraction)
-: mPlatformAbstraction(platformAbstraction),
- mDefaultFontSize(-1)
+StyleMonitor::StyleMonitor()
+: mDefaultFontSize(-1)
{
- mfontClient = TextAbstraction::FontClient::Get();
- GetSystemDefaultFontFamily( mfontClient, mDefaultFontFamily );
+ mFontClient = TextAbstraction::FontClient::Get();
+ GetSystemDefaultFontFamily( mFontClient, mDefaultFontFamily );
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "StyleMonitor::StyleMonitor::DefaultFontFamily(%s)\n", mDefaultFontFamily.c_str() );
- mDefaultFontSize = mPlatformAbstraction.GetDefaultFontSize();
+ mDefaultFontSize = mFontClient.GetDefaultFontSize();
}
StyleMonitor::~StyleMonitor()
{
case StyleChange::DEFAULT_FONT_CHANGE:
{
- GetSystemDefaultFontFamily( mfontClient, mDefaultFontFamily );
+ if ( mFontClient )
+ {
+ mFontClient.ResetSystemDefaults();
+ GetSystemDefaultFontFamily( mFontClient, mDefaultFontFamily );
+ }
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "StyleMonitor::StyleChanged::DefaultFontFamily(%s)\n", mDefaultFontFamily.c_str() );
break;
}
case StyleChange::DEFAULT_FONT_SIZE_CHANGE:
{
- mDefaultFontSize = mPlatformAbstraction.GetDefaultFontSize();
+ mDefaultFontSize = mFontClient.GetDefaultFontSize();
break;
}