Tizen Native API  6.5
Dali::WidgetApplication Class Reference

An WidgetApplication class object should be created by every widget application that wishes to use Dali. More...

Inheritance diagram for Dali::WidgetApplication:
Dali::Application Dali::BaseHandle

Public Types

typedef Widget(* CreateWidgetFunction )(const std::string &)
 This is the typedef for Widget creator.

Public Member Functions

 WidgetApplication ()
 The default constructor.
 WidgetApplication (const WidgetApplication &widgetApplication)
 Copy Constructor.
WidgetApplicationoperator= (const WidgetApplication &widgetApplication)
 Assignment operator.
 ~WidgetApplication ()
 Destructor.
void RegisterWidgetCreatingFunction (const std::string &widgetName, CreateWidgetFunction createFunction)
 Register create function for widget.

Static Public Member Functions

static WidgetApplication New (int *argc, char **argv[], const std::string &stylesheet)
 This is the constructor for WidgetApplications with a name.

Detailed Description

An WidgetApplication class object should be created by every widget application that wishes to use Dali.

It provides a means for initializing the resources required by the Dali::Core.

The WidgetApplication class 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 WidgetApplication and create the Dali Widget object in the connected callback.

WidgetApplications should follow the example below:

 //Widget header which
 #include <my-widget.h>

 class ExampleController: public ConnectionTracker
 {
 public:
   ExampleController( Application& application )
   : mWidgetApplication( application )
   {
     mApplication.InitSignal().Connect( this, &ExampleController::Create );
   }

   static Widget CreateWidgetFunction(const std::string& widgetName)
   {
     MyWidget widget = MyWidget::New();
     return widget;
   }

   void Create( Application& application )
   {
     mApplication.RegisterWidgetCreatingFunction( "myWidget", &ExampleController::CreateWidgetFunction );
   }

 private:
   WidgetApplication& mWidgetApplication;
 };

 int main (int argc, char **argv)
 {
   WidgetApplication app = WidgetApplication::New(&argc, &argv);
   ExampleController example( app );
   app.MainLoop();
 }

If required, you can also connect class member functions to a signal:

 MyWidgetApplication app;
 app.ResumeSignal().Connect(&app, &MyWidgetApplication::Resume);
Since:
4.0, DALi version 1.3.5

Member Typedef Documentation

typedef Widget(* Dali::WidgetApplication::CreateWidgetFunction)(const std::string &)

This is the typedef for Widget creator.

Since:
4.0, DALi version 1.3.5

Constructor & Destructor Documentation

The default constructor.

Since:
4.0, DALi version 1.3.5

Copy Constructor.

Since:
4.0, DALi version 1.3.5
Parameters:
[in]widgetApplicationHandle to an object

Destructor.

Since:
4.0, DALi version 1.3.5

Member Function Documentation

static WidgetApplication Dali::WidgetApplication::New ( int *  argc,
char **  argv[],
const std::string &  stylesheet 
) [static]

This is the constructor for WidgetApplications with a name.

Since:
4.0, DALi version 1.3.5
Parameters:
[in,out]argcA pointer to the number of arguments
[in,out]argvA pointer to the argument list
[in]stylesheetThe path to user defined theme file
Returns:
A handle to the WidgetApplication
Note:
If the stylesheet is not specified, then the library's default stylesheet will not be overridden.

Reimplemented from Dali::Application.

WidgetApplication& Dali::WidgetApplication::operator= ( const WidgetApplication widgetApplication)

Assignment operator.

Since:
4.0, DALi version 1.3.5
Parameters:
[in]widgetApplicationHandle to an object
Returns:
A reference to this
void Dali::WidgetApplication::RegisterWidgetCreatingFunction ( const std::string &  widgetName,
CreateWidgetFunction  createFunction 
)

Register create function for widget.

Since:
4.0, DALi version 1.3.5
Parameters:
[in]widgetNameName of widget
[in]createFunctionFunction pointer for widget creation.