Tizen Native API
5.5
|
An WidgetApplication class object should be created by every widget application that wishes to use Dali. More...
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. | |
WidgetApplication & | operator= (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. |
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);
typedef Widget(* Dali::WidgetApplication::CreateWidgetFunction)(const std::string &) |
This is the typedef for Widget creator.
The default constructor.
Dali::WidgetApplication::WidgetApplication | ( | const WidgetApplication & | widgetApplication | ) |
Copy Constructor.
[in] | widgetApplication | Handle to an object |
Destructor.
static WidgetApplication Dali::WidgetApplication::New | ( | int * | argc, |
char ** | argv[], | ||
const std::string & | stylesheet | ||
) | [static] |
This is the constructor for WidgetApplications with a name.
[in,out] | argc | A pointer to the number of arguments |
[in,out] | argv | A pointer to the argument list |
[in] | stylesheet | The path to user defined theme file |
Reimplemented from Dali::Application.
WidgetApplication& Dali::WidgetApplication::operator= | ( | const WidgetApplication & | widgetApplication | ) |
Assignment operator.
[in] | widgetApplication | Handle to an object |
void Dali::WidgetApplication::RegisterWidgetCreatingFunction | ( | const std::string & | widgetName, |
CreateWidgetFunction | createFunction | ||
) |
Register create function for widget.
[in] | widgetName | Name of widget |
[in] | createFunction | Function pointer for widget creation. |