Tizen Native API

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

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

Public Types

enum  WINDOW_MODE
 Decides whether a Dali application window is opaque or transparent. More...
typedef Signal< void(Application &) > AppSignalType
 Application lifecycle signal and system signal callback type.
typedef Signal< void(Application
&, void *) 
AppControlSignalType )
 Application control signal callback type.

Public Member Functions

 Application ()
 Construct an empty handle.
 Application (const Application &application)
 Copy Constructor.
Applicationoperator= (const Application &applicaton)
 Assignment operator.
 ~Application ()
 Destructor.
void MainLoop ()
 This starts the application.
void MainLoop (Configuration::ContextLoss configuration)
 This starts the application, and allows the app to choose a different configuration.
void Lower ()
 This lowers the application to bottom without actually quitting it.
void Quit ()
 This quits the application. Tizen applications should use Lower to improve re-start performance unless they need to Quit completely.
bool AddIdle (CallbackBase *callback)
 Ensures that the function passed in is called from the main loop when it is idle.
Window GetWindow ()
 Retrieves the window used by the Application class.
void ReplaceWindow (PositionSize windowPosition, const std::string &name)
 Replace the current window.
void SetViewMode (ViewMode viewMode)
 Set the viewing mode for the application.
ViewMode GetViewMode () const
 Get the current viewing mode.
void SetStereoBase (float stereoBase)
 Set the stereo base (eye separation) for Stereoscopic 3D.
float GetStereoBase () const
 Get the stereo base (eye separation) for Stereoscopic 3D.
AppSignalTypeInitSignal ()
 The user should connect to this signal to determine when they should initialise their application.
AppSignalTypeTerminateSignal ()
 The user should connect to this signal to determine when they should terminate their application.
AppSignalTypePauseSignal ()
 The user should connect to this signal if they need to perform any special activities when the application is about to be paused.
AppSignalTypeResumeSignal ()
 The user should connect to this signal if they need to perform any special activities when the application has resumed.
AppSignalTypeResetSignal ()
 This signal is sent when the system requires the user to reinitialise itself.
AppSignalTypeResizeSignal ()
 This signal is emitted when the window the application is rendering on is resized.
AppControlSignalTypeAppControlSignal ()
 This signal is emitted when another application sends a launch request to the application.
AppSignalTypeLanguageChangedSignal ()
 This signal is emitted when the language is changed on the device.
AppSignalTypeRegionChangedSignal ()
 This signal is emitted when the region of the device is changed.
AppSignalTypeBatteryLowSignal ()
 This signal is emitted when the battery level of the device is low.
AppSignalTypeMemoryLowSignal ()
 This signal is emitted when the memory level of the device is low.

Static Public Member Functions

static Application New ()
 This is the constructor for applications without an argument list.
static Application New (int *argc, char **argv[])
 This is the constructor for applications.
static Application New (int *argc, char **argv[], const std::string &stylesheet)
 This is the constructor for applications with a name.
static Application New (int *argc, char **argv[], const std::string &stylesheet, WINDOW_MODE windowMode)
 This is the constructor for applications with a name.

Detailed Description

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

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

The Application 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 Application and create the Dali objects in the connected callback.

Applications should follow the example below:

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

   void Create( Application& application )
   {
     // Create Dali components...
   }
  ...
 private:
   Application& mApplication;
 };

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

This class accepts command line arguments as well. The following options are supported:

     --no-vsync       Disable VSync on Render
  -w|--width          Stage Width
  -h|--height         Stage Height
  -d|--dpi            Emulated DPI
     --help           Help

When the above options are found, they are stripped from argv, and argc is updated appropriately.

Since :
2.4

Member Typedef Documentation

Application control signal callback type.

Since :
2.4

Application lifecycle signal and system signal callback type.

Since :
2.4

Member Enumeration Documentation

Decides whether a Dali application window is opaque or transparent.

Since :
2.4
Enumerator:
OPAQUE 

The window will be opaque.

Since :
2.4
TRANSPARENT 

The window transparency will match the alpha value set in Dali::Stage::SetBackgroundcolor()

Since :
2.4

Constructor & Destructor Documentation

Construct an empty handle.

Since :
2.4
Dali::Application::Application ( const Application application)

Copy Constructor.

Since :
2.4

Destructor.

This is non-virtual since derived Handle types must not contain data or virtual methods.

Since :
2.4

Member Function Documentation

Ensures that the function passed in is called from the main loop when it is idle.

Since :
2.4
Parameters:
[in]callbackThe function to call.
Returns:
true if added successfully, false otherwise
Note:
Function must be called from main event thread only

A callback of the following type may be used:

   void MyFunction();
Note:
Ownership of the callback is passed onto this class.

This signal is emitted when another application sends a launch request to the application.

When the application is launched, this signal is emitted after the main loop of the application starts up. The passed parameter describes the launch request and contains the information about why the application is launched.

Since :
2.4

This signal is emitted when the battery level of the device is low.

Since :
2.4

Get the stereo base (eye separation) for Stereoscopic 3D.

Since :
2.4
Returns:
The stereo base (eye separation) for Stereoscopic 3D

Get the current viewing mode.

Since :
2.4
Returns:
The current viewing mode.

Retrieves the window used by the Application class.

The application writer can use the window to change indicator and orientation properties.

Since :
2.4
Returns:
A handle to the window

The user should connect to this signal to determine when they should initialise their application.

Since :
2.4

This signal is emitted when the language is changed on the device.

Since :
2.4

This lowers the application to bottom without actually quitting it.

Since :
2.4

This starts the application.

Choosing this form of main loop indicates that the default application configuration of APPLICATION_HANDLES_CONTEXT_LOSS is used. On platforms where context loss can occur, the application is responsible for tearing down and re-loading UI. The application should listen to Stage::ContextLostSignal and Stage::ContextRegainedSignal.

Since :
2.4

This starts the application, and allows the app to choose a different configuration.

If the application plans on using the ReplaceSurface or ReplaceWindow API, then this will trigger context loss & regain. The application should listen to Stage::ContextLostSignal and Stage::ContextRegainedSignal.

Since :
2.4

This signal is emitted when the memory level of the device is low.

Since :
2.4
static Application Dali::Application::New ( ) [static]

This is the constructor for applications without an argument list.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/display
static Application Dali::Application::New ( int *  argc,
char **  argv[] 
) [static]

This is the constructor for applications.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/display
Parameters:
[in,out]argcA pointer to the number of arguments
[in,out]argvA pointer the the argument list
static Application Dali::Application::New ( int *  argc,
char **  argv[],
const std::string &  stylesheet 
) [static]

This is the constructor for applications with a name.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/display
Parameters:
[in,out]argcA pointer to the number of arguments
[in,out]argvA pointer the the argument list
[in]stylesheetThe path to user defined theme file
static Application Dali::Application::New ( int *  argc,
char **  argv[],
const std::string &  stylesheet,
WINDOW_MODE  windowMode 
) [static]

This is the constructor for applications with a name.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/display
Parameters:
[in,out]argcA pointer to the number of arguments
[in,out]argvA pointer the the argument list
[in]stylesheetThe path to user defined theme file
[in]windowModeA member of WINDOW_MODE
Application& Dali::Application::operator= ( const Application applicaton)

Assignment operator.

Since :
2.4

The user should connect to this signal if they need to perform any special activities when the application is about to be paused.

Since :
2.4

This quits the application. Tizen applications should use Lower to improve re-start performance unless they need to Quit completely.

Since :
2.4

This signal is emitted when the region of the device is changed.

Since :
2.4
void Dali::Application::ReplaceWindow ( PositionSize  windowPosition,
const std::string &  name 
)

Replace the current window.

This will force context loss. If you plan on using this API in your application, then you should configure it to prevent discard behaviour when handling the Init signal.

Since :
2.4
Parameters:
[in]windowPositionThe position and size parameters of the new window
[in]nameThe name of the new window

This signal is sent when the system requires the user to reinitialise itself.

Since :
2.4

This signal is emitted when the window the application is rendering on is resized.

Since :
2.4

The user should connect to this signal if they need to perform any special activities when the application has resumed.

Since :
2.4
void Dali::Application::SetStereoBase ( float  stereoBase)

Set the stereo base (eye separation) for Stereoscopic 3D.

Since :
2.4
Parameters:
[in]stereoBaseThe stereo base (eye separation) for Stereoscopic 3D

Set the viewing mode for the application.

Since :
2.4
Parameters:
[in]viewModeThe new viewing mode.

The user should connect to this signal to determine when they should terminate their application.

Since :
2.4