Dali::ImfManager ImfManager::Get()
{
  Dali::ImfManager manager;

  Dali::SingletonService service( SingletonService::Get() );
  if (! service )
  {
    return manager;
  }

  // Check whether the singleton is already created
  Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::ImfManager ) );
  if( handle )
  {
    // If so, downcast the handle
    manager = Dali::ImfManager( dynamic_cast< ImfManager* >( handle.GetObjectPtr() ) );
  }
  else if ( Adaptor::IsAvailable() )
  {
    // Create instance and register singleton only if the adaptor is available
    manager = Dali::ImfManager( new ImfManager() );
    service.Register( typeid( manager ), manager );
  }
  else
  {
    DALI_LOG_ERROR("Failed to get native window handle");
  }
  return manager;
}
Dali::StyleMonitor StyleMonitor::Get()
{
  Dali::StyleMonitor styleMonitor;

  if ( Adaptor::IsAvailable() )
  {
    // Check whether the singleton is already created
    Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Dali::StyleMonitor ) );
    if(handle)
    {
      // If so, downcast the handle
      styleMonitor = Dali::StyleMonitor( dynamic_cast< StyleMonitor* >( handle.GetObjectPtr() ) );
    }
  }

  return styleMonitor;
}
Beispiel #3
0
Dali::Clipboard Clipboard::Get()
{
  Dali::Clipboard clipboard;

  Dali::SingletonService service( SingletonService::Get() );
  if ( service )
  {
    // Check whether the singleton is already created
    Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::Clipboard ) );
    if(handle)
    {
      // If so, downcast the handle
      clipboard = Dali::Clipboard( dynamic_cast< Clipboard* >( handle.GetObjectPtr() ) );
    }
  }

  return clipboard;
}
Beispiel #4
0
AtlasGlyphManager AtlasGlyphManager::Get()
{
  AtlasGlyphManager manager;

  // Check whether the AtlasGlyphManager is already created
  SingletonService singletonService( SingletonService::Get() );
  if ( singletonService )
  {
    Dali::BaseHandle handle = singletonService.GetSingleton(typeid(AtlasGlyphManager));
    if(handle)
    {
      // If so, downcast the handle of singleton to AtlasGlyphManager
      manager = AtlasGlyphManager(dynamic_cast<Internal::AtlasGlyphManager*>(handle.GetObjectPtr()));
    }

    if(!manager)
    {
      // If not, create the AtlasGlyphManager and register it as a singleton
      manager = AtlasGlyphManager(new Internal::AtlasGlyphManager());
      singletonService.Register(typeid(manager), manager);
    }
  }
  return manager;
}
Dali::LifecycleController LifecycleController::Get()
{
  Dali::LifecycleController lifecycleController;

  Dali::SingletonService service( SingletonService::Get() );
  if ( service )
  {
    // Check whether the singleton is already created
    Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::LifecycleController ) );
    if(handle)
    {
      // If so, downcast the handle
      lifecycleController = Dali::LifecycleController( dynamic_cast< LifecycleController* >( handle.GetObjectPtr() ) );
    }
    else
    {
      lifecycleController = Dali::LifecycleController( new LifecycleController() );
      service.Register( typeid( lifecycleController ), lifecycleController );
    }
  }

  return lifecycleController;
}
Dali::ClipboardEventNotifier ClipboardEventNotifier::Get()
{
  Dali::ClipboardEventNotifier notifier;

  Dali::SingletonService service( SingletonService::Get() );
  if ( service )
  {
    // Check whether the singleton is already created
    Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::ClipboardEventNotifier ) );
    if(handle)
    {
      // If so, downcast the handle
      notifier = Dali::ClipboardEventNotifier( dynamic_cast< ClipboardEventNotifier* >( handle.GetObjectPtr() ) );
    }
    else
    {
      notifier = Dali::ClipboardEventNotifier( ClipboardEventNotifier::New() );
      service.Register( typeid( notifier ), notifier );
    }
  }

  return notifier;
}