Esempio n. 1
0
void Application::_init(const StringW& appType)
{
  _uiEngine = NULL;

  if (appType.startsWith(Ascii8("UI")))
  {
#if defined(FOG_BUILD_UI)
    // Create the UIEngine by name.
    _uiEngine = createUIEngine(appType);
#else
    Logger::warning("Fog::Application", "_init",
      "Requested to create UI based application, but Fog/UI was disabled at compile-time.");
#endif
  }

  EventLoopImpl* eventLoopImpl = NULL;

#if defined(FOG_BUILD_UI)
  if (_uiEngine != NULL)
    eventLoopImpl = _uiEngine->_eventLoop._d->addRef();
#endif // FOG_BUILD_UI

  // Create EventLoop by of the required type.
  if (eventLoopImpl == NULL)
    eventLoopImpl = createEventLoop(appType);

  if (eventLoopImpl != NULL)
    _homeThread->_eventLoop.adopt(eventLoopImpl);

  // Set global application instance (singleton).
  if (_instance == NULL)
    _instance = this;
}