+ void AppWidgetExit()
+ {
+ widget_base_exit();
+ }
+
+ static int WidgetAppCreate( void *data )
+ {
+ widget_base_on_create();
+ return static_cast<int>( static_cast<Framework*>(data)->Create() );
+ }
+
+ static int WidgetAppTerminate( void *data )
+ {
+ Observer *observer = &static_cast<Framework*>(data)->mObserver;
+ observer->OnTerminate();
+
+ widget_base_on_terminate();
+ return 0;
+ }
+
+ int AppWidgetMain()
+ {
+ if( !IsWidgetFeatureEnabled() )
+ {
+ DALI_LOG_ERROR("widget feature is not supported");
+ return 0;
+ }
+
+ AppCore::AppAddEventHandler(&handlers[AppCore::LOW_BATTERY], AppCore::LOW_BATTERY, AppBatteryLow, mFramework);
+ AppCore::AppAddEventHandler(&handlers[AppCore::LOW_MEMORY], AppCore::LOW_MEMORY, AppMemoryLow, mFramework);
+ AppCore::AppAddEventHandler(&handlers[AppCore::DEVICE_ORIENTATION_CHANGED], AppCore::DEVICE_ORIENTATION_CHANGED, AppDeviceRotated, mFramework);
+ AppCore::AppAddEventHandler(&handlers[AppCore::LANGUAGE_CHANGED], AppCore::LANGUAGE_CHANGED, AppLanguageChanged, mFramework);
+ AppCore::AppAddEventHandler(&handlers[AppCore::REGION_FORMAT_CHANGED], AppCore::REGION_FORMAT_CHANGED, AppRegionChanged, mFramework);
+
+ widget_base_ops ops = widget_base_get_default_ops();
+
+ /* override methods */
+ ops.create = WidgetAppCreate;
+ ops.terminate = WidgetAppTerminate;
+ ops.init = AppInit;
+ ops.finish = AppFinish;
+ ops.run = AppRun;
+ ops.exit = AppExit;
+
+ int result = widget_base_init(ops, *mFramework->mArgc, *mFramework->mArgv, mFramework);
+
+ widget_base_fini();
+
+ return result;
+ }
+