Update the refined dali c# application to support more argument options
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / manual / csharp / Tizen.Applications / DaliApplication.cs
1 // Copyright 2016 by Samsung Electronics, Inc.,
2 //
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
8 using System;
9 using Dali;
10
11 //------------------------------------------------------------------------------
12 // <manual-generated />
13 //
14 // This file can only run on Tizen target. You should compile it with hello-test.cs, and
15 // add tizen c# application related library as reference.
16 //------------------------------------------------------------------------------
17 namespace Tizen.Applications
18 {
19     /// <summary>
20     /// Represents an application that have UI screen. The DaliApplication class has a default stage.
21     /// </summary>
22     public class DaliApplication : CoreUIApplication
23     {
24         /// <summary>
25         /// The instance of the Dali Application.
26         /// </summary>
27         /// <remarks>
28         /// This application is created before OnCreate() or created event. And the DaliApplication will be terminated when this application is closed.
29         /// </remarks>
30         protected Dali.Application application;
31
32         /// <summary>
33         /// The instance of the Dali Application extension.
34         /// </summary>
35         protected Dali.ApplicationExtensions applicationExt;
36
37         /// <summary>
38         /// Store the stylesheet value.
39         /// </summary>
40         protected string m_stylesheet;
41
42         /// <summary>
43         /// Store the window mode value.
44         /// </summary>
45         protected Dali.Application.WINDOW_MODE m_windowMode;
46
47         /// <summary>
48         /// Store the app mode value.
49         /// </summary>
50         protected APP_MODE appMode;
51
52         /// <summary>
53         /// The instance of the Dali Stage.
54         /// </summary>
55         public Stage stage { get; private set; }
56
57         /// <summary>
58         /// The default constructor.
59         /// </summary>
60         public DaliApplication():base()
61         {
62             appMode = APP_MODE.DEFAULT;
63         }
64
65         /// <summary>
66         /// The constructor with stylesheet.
67         /// </summary>
68         public DaliApplication(string stylesheet):base()
69         {
70             //handle the stylesheet
71             appMode = APP_MODE.STYLESHEETONLY;
72             m_stylesheet = stylesheet;
73         }
74
75         /// <summary>
76         /// The constructor with stylesheet and window mode.
77         /// </summary>
78         public DaliApplication(string stylesheet, Dali.Application.WINDOW_MODE windowMode)
79             : base()
80         {
81             //handle the stylesheet and windowMode
82             appMode = APP_MODE.STYLESHEETWITHWINDOWMODE;
83             m_stylesheet = stylesheet;
84             m_windowMode = windowMode;
85         }
86
87         /// <summary>
88         /// Overrides this method if want to handle behavior before calling OnCreate().
89         /// stage property is initialized in this overrided method.
90         /// </summary>
91         protected override void OnPreCreate()
92         {
93             switch(appMode)
94             {
95                 case APP_MODE.DEFAULT:
96                     application = Dali.Application.NewApplication();
97                     break;
98                 case APP_MODE.STYLESHEETONLY:
99                     application = Dali.Application.NewApplication(m_stylesheet);
100                     break;
101                 case APP_MODE.STYLESHEETWITHWINDOWMODE:
102                     application = Dali.Application.NewApplication(m_stylesheet, m_windowMode);
103                     break;
104                 default:
105                     break;
106             }
107
108             applicationExt = new Dali.ApplicationExtensions(application);
109             applicationExt.Init();
110
111             stage = Stage.GetCurrent();
112             stage.SetBackgroundColor( NDalic.WHITE );
113         }
114
115         /// <summary>
116         /// Overrides this method if want to handle behavior.
117         /// </summary>
118         protected override void OnTerminate()
119         {
120             base.OnTerminate();
121             applicationExt.Terminate();
122         }
123
124         /// <summary>
125         /// Overrides this method if want to handle behavior.
126         /// </summary>
127         protected override void OnPause()
128         {
129             base.OnPause();
130             applicationExt.Pause();
131         }
132
133         /// <summary>
134         /// Overrides this method if want to handle behavior.
135         /// </summary>
136         protected override void OnResume()
137         {
138             base.OnResume();
139             applicationExt.Resume();
140         }
141
142         /// <summary>
143         /// Overrides this method if want to handle behavior.
144         /// </summary>
145         protected override void OnLocaleChanged(LocaleChangedEventArgs e)
146         {
147             base.OnLocaleChanged(e);
148             applicationExt.LanguageChange();
149         }
150
151         /// <summary>
152         /// The mode of creating Dali application.
153         /// </summary>
154         protected enum APP_MODE
155         {
156             DEFAULT = 0,
157             STYLESHEETONLY = 1,
158             STYLESHEETWITHWINDOWMODE = 2
159         }
160     }
161 }