Merge "Add comments for SmartEvent" into tizen
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Elementary.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18 using System.IO;
19
20 namespace ElmSharp
21 {
22     /// <summary>
23     /// The Elementary is a General Elementary,a VERY SIMPLE toolkit.
24     /// </summary>
25     public static class Elementary
26     {
27         private static readonly string _themeFilePath = "/usr/share/elm-sharp/elm-sharp-theme.edj";
28
29         /// <summary>
30         /// Initializes Elementary.
31         /// </summary>
32         public static void Initialize()
33         {
34             Interop.Elementary.elm_init(0, null);
35         }
36
37         /// <summary>
38         /// Shuts down Elementary.
39         /// </summary>
40         public static void Shutdown()
41         {
42             Interop.Elementary.elm_shutdown();
43         }
44
45         /// <summary>
46         /// Runs Elementary's main loop.
47         /// </summary>
48         public static void Run()
49         {
50             Interop.Elementary.elm_run();
51         }
52
53         /// <summary>
54         /// Prepends a theme overlay to the list of overlays.
55         /// </summary>
56         public static void ThemeOverlay()
57         {
58             if (File.Exists(_themeFilePath))
59             {
60                 Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, _themeFilePath);
61             }
62         }
63
64         /// <summary>
65         /// Gets the amount of inertia a scroller imposes during region bring animations.
66         /// </summary>
67         /// <returns>The bring in scroll friction</returns>
68         public static double GetSystemScrollFriction()
69         {
70             return Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_get();
71         }
72
73         /// <summary>
74         /// Sets the amount of inertia a scroller imposes during region bring animations.
75         /// </summary>
76         /// <param name="timeSet">The bring in scroll friction</param>
77         public static void SetSystemScrollFriction(double timeSet)
78         {
79             Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_set(timeSet);
80         }
81
82         /// <summary>
83         /// Gets Elementary's profile in use.
84         /// </summary>
85         /// <returns>The profile name</returns>
86         public static string GetProfile()
87         {
88             return Interop.Elementary.elm_config_profile_get();
89         }
90
91         /// <summary>
92         /// Sets the global scaling factor.
93         /// This sets the globally configured scaling factor that is applied to all objects.
94         /// </summary>
95         /// <param name="scale">The scaling factor to set</param>
96         public static void SetScale(double scale)
97         {
98             Interop.Elementary.elm_config_scale_set(scale);
99         }
100
101         /// <summary>
102         /// Gets the global scaling factor.
103         /// This gets the globally configured scaling factor that is applied to all objects.
104         /// </summary>
105         /// <returns>The scaling factor</returns>
106         public static double GetScale()
107         {
108             return Interop.Elementary.elm_config_scale_get();
109         }
110     }
111 }