-<h2 class="pg">Using an Adaptor or EvasPlugin instead of the Application class</h2>
-
-If the application requires finer grained control, an Dali::Adaptor can be created instead. This allows the application writer to create other platform related functionality themselves (e.g managing the main loop, providing a surface to render to etc.).
-
-When using the Adaptor, the application writer can specify the use of normal window creation and drawing by using the New method with an appropriate Window.
-
-If the application writer wants Dali to draw to a specific surface then they need to create a Dali::RenderSurface instance and use the Adaptor constructor which takes the Dali::RenderSurface as the parameter.
-
-The only signal provided by the adaptors is a <i>surface resized signal</i>; the application writer will have to handle system signals like <i>initialise, pause, terminate </i> etc. themselves. It is also important that any calls to Dali are made in a thread-safe manner from your application when using the adaptor directly.
-
-An adaptor can be created as shown below:
-
-@code
-void CreateProgram(void* data)
-{
- // Start Adaptor
- Dali::Adaptor* adaptor = reinterpret_cast<Dali::Adaptor*>(data);
- adaptor->Start();
-
- // Create Dali components...
- // Can instantiate here, if required
-}
-
-int main ()
-{
- // Initialise platform
- MyPlatform.Init();
-
- // Create an 800 by 1280 window positioned at (0,0).
- Dali::PositionSize positionSize(0, 0, 800, 1280);
- Dali::Window window = Dali::Window::New( positionSize, "My Application" );
- Dali::Adaptor& adaptor = Dali::Adaptor::New( window );
-
- // Assuming second parameter takes in data which is passed back to the callback function
- MyPlatform.InitialisationConnection(&CreateProgram, &adaptor);
-
- // Start Main Loop of your platform
- MyPlatform.StartMainLoop();
-
- return 0;
-}
-@endcode
-
-A Dali::EvasPlugin instance can be created by EFL applications that wish to use Dali. Like the Adaptor, it also provides a means for initialising the resources required by the Dali::Core.
-
-The Dali::EvasPlugin emits several signals which the user can connect to. The user should not create any Dali objects in the main function and instead should connect to the Init signal of the EvasPlugin and create the Dali objects in the connected callback.
-
-A Dali::EvasPlugin can be used in an EFL application as shown below:
-
-@code
-void Created(EvasPlugin& evasPlugin)
-{
- // Create Dali components...
- // Can instantiate here, if required
-}
-
-void Resized(EvasPlugin& evasPlugin)
-{
- // Set size properties of Dali components
- // Set screen layout
-}
-
-int main (int argc, char **argv)
-{
- // Initialise Elementary
- elm_init(&argc, &argv);
-
- // Create an Evas Window
- Evas_Object* win = elm_win_add(...);
-
- // Get the actual window
- Evas* e = evas_object_evas_get(win);
-
- // Create the EvasPlugin and pass the actual window
- Dali::EvasPlugin evasPlugin = Dali::EvasPlugin(e);
-
- evasPlugin.SignalInit().Connect(&Created);
- evasPlugin.SignalResize().Connect(&Resized);
-
- // Retrieve the Evas_Object from the plugin and show it.
- Evas_Object* evasObject = evasPlugin.GetEvasObject();
- evas_object_show(evasObject);
-
- // add evasObject to layout such as elm_box
-
- // Start main loop
- elm_run();
-}
-@endcode
-