Merge "[Camera] Fix XML documentation warnings"
[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.ComponentModel;
19 using System.IO;
20
21 namespace ElmSharp
22 {
23     /// <summary>
24     /// Focus Autoscroll Mode
25     /// </summary>
26     public enum FocusAutoScrollMode
27     {
28         /// <summary>
29         /// Directly show the focused region or item automatically
30         /// </summary>
31         Show,
32
33         /// <summary>
34         /// Do not show the focused region or item automatically
35         /// </summary>
36         None,
37
38         /// <summary>
39         /// Bring in the focused region or item automatically which might invole the scrolling
40         /// </summary>
41         BringIn
42     }
43
44     /// <summary>
45     /// The Elementary is a General Elementary,a VERY SIMPLE toolkit.
46     /// </summary>
47     public static class Elementary
48     {
49         private static readonly string _themeFilePath = "/usr/share/elm-sharp/elm-sharp-theme.edj";
50
51         /// <summary>
52         /// Gets or sets the configured finger size.
53         /// </summary>
54         public static int FingerSize
55         {
56             get
57             {
58                 return Interop.Elementary.elm_config_finger_size_get();
59             }
60             set
61             {
62                 Interop.Elementary.elm_config_finger_size_set(value);
63             }
64         }
65
66         /// <summary>
67         /// Gets or sets the enable status of the focus highlight animation
68         /// </summary>
69         public static bool IsFocusHighlightAnimation
70         {
71             get
72             {
73                 return Interop.Elementary.elm_config_focus_highlight_animate_get();
74             }
75             set
76             {
77                 Interop.Elementary.elm_config_focus_highlight_animate_set(value);
78             }
79         }
80
81         /// <summary>
82         /// Gets or sets the system mirrored mode.
83         /// This determines the default mirrored mode of widgets.
84         /// </summary>
85         public static bool IsMirrored
86         {
87             get
88             {
89                 return Interop.Elementary.elm_config_mirrored_get();
90             }
91             set
92             {
93                 Interop.Elementary.elm_config_mirrored_set(value);
94             }
95         }
96
97         /// <summary>
98         /// Gets or sets the enable status of the focus highlight.
99         /// </summary>
100         public static bool CanFocusHighlight
101         {
102             get
103             {
104                 return Interop.Elementary.elm_config_focus_highlight_enabled_get();
105             }
106             set
107             {
108                 Interop.Elementary.elm_config_focus_highlight_enabled_set(value);
109             }
110         }
111
112         /// <summary>
113         /// Gets or sets the base scale of the application.
114         /// </summary>
115         public static double AppBaseScale
116         {
117             get
118             {
119                 return Interop.Elementary.elm_app_base_scale_get();
120             }
121             set
122             {
123                 Interop.Elementary.elm_app_base_scale_set(value);
124             }
125         }
126
127         /// <summary>
128         /// Gets or sets the global scaling factor.
129         /// </summary>
130         public static double Scale
131         {
132             get
133             {
134                 return Interop.Elementary.elm_config_scale_get();
135             }
136             set
137             {
138                 Interop.Elementary.elm_config_scale_set(value);
139             }
140         }
141
142         /// <summary>
143         /// Gets or sets the amount of inertia a scroller imposes during region bring animations.
144         /// </summary>
145         public static double BringInScrollFriction
146         {
147             get
148             {
149                 return Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_get();
150             }
151             set
152             {
153                 Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_set(value);
154             }
155         }
156
157         /// <summary>
158         /// Gets of sets focus auto scroll mode.
159         /// </summary>
160         public static FocusAutoScrollMode FocusAutoScrollMode
161         {
162             get
163             {
164                 return (FocusAutoScrollMode)Interop.Elementary.elm_config_focus_autoscroll_mode_get();
165             }
166             set
167             {
168                 Interop.Elementary.elm_config_focus_autoscroll_mode_set((Interop.Elementary.Elm_Focus_Autoscroll_Mode)value);
169             }
170         }
171
172         /// <summary>
173         /// Initializes Elementary.
174         /// </summary>
175         public static void Initialize()
176         {
177             Interop.Elementary.elm_init(0, null);
178         }
179
180         /// <summary>
181         /// Shuts down Elementary.
182         /// </summary>
183         public static void Shutdown()
184         {
185             Interop.Elementary.elm_shutdown();
186         }
187
188         /// <summary>
189         /// Runs Elementary's main loop.
190         /// </summary>
191         public static void Run()
192         {
193             Interop.Elementary.elm_run();
194         }
195
196         /// <summary>
197         /// Prepends a theme overlay to the list of overlays
198         /// </summary>
199         [EditorBrowsable(EditorBrowsableState.Never)]
200         public static void ThemeOverlay()
201         {
202             if (File.Exists(_themeFilePath))
203             {
204                 AddThemeOverlay(_themeFilePath);
205             }
206         }
207
208         /// <summary>
209         /// Prepends a theme overlay to the list of overlays
210         /// </summary>
211         /// <param name="filePath">The Edje file path to be used.</param>
212         public static void AddThemeOverlay(string filePath)
213         {
214             Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, filePath);
215         }
216
217         /// <summary>
218         /// Delete a theme overlay from the list of overlays
219         /// </summary>
220         /// <param name="filePath">The name of the theme overlay.</param>
221         public static void DeleteThemeOverlay(string filePath)
222         {
223             Interop.Elementary.elm_theme_overlay_del(IntPtr.Zero, filePath);
224         }
225
226         /// <summary>
227         /// Free a theme
228         /// </summary>
229         public static void FreeTheme()
230         {
231             Interop.Elementary.elm_theme_free(IntPtr.Zero);
232         }
233
234         /// <summary>
235         /// Set the theme search order for the given theme
236         /// </summary>
237         /// <param name="theme">Theme search string</param>
238         /// <remarks>This sets the search string for the theme in path-notation from first theme to search, to last, delimited by the : character. Example:"shiny:/path/to/file.edj:default"</remarks>
239         public static void SetTheme(string theme)
240         {
241             Interop.Elementary.elm_theme_set(IntPtr.Zero, theme);
242         }
243
244         /// <summary>
245         /// Flush the current theme.
246         /// </summary>
247         public static void FlushTheme()
248         {
249             Interop.Elementary.elm_theme_flush(IntPtr.Zero);
250         }
251
252         /// <summary>
253         /// This flushes all themes (default and specific ones).
254         /// </summary>
255         public static void FlushAllThemes()
256         {
257             Interop.Elementary.elm_theme_full_flush();
258         }
259
260         /// <summary>
261         /// Deletes a theme extension from the list of extensions.
262         /// </summary>
263         /// <param name="item">The name of the theme extension.</param>
264         public static void DeleteThemeExtention(string item)
265         {
266             Interop.Elementary.elm_theme_extension_del(IntPtr.Zero, item);
267         }
268
269         /// <summary>
270         /// Gets the amount of inertia a scroller imposes during region bring animations.
271         /// </summary>
272         [EditorBrowsable(EditorBrowsableState.Never)]
273         public static double GetSystemScrollFriction()
274         {
275             return BringInScrollFriction;
276         }
277
278         /// <summary>
279         /// Sets the amount of inertia a scroller imposes during region bring animations.
280         /// </summary>
281         [EditorBrowsable(EditorBrowsableState.Never)]
282         public static void SetSystemScrollFriction(double timeSet)
283
284         {
285             BringInScrollFriction = timeSet;
286         }
287
288         /// <summary>
289         /// Get Elementary's profile in use
290         /// </summary>
291         [EditorBrowsable(EditorBrowsableState.Never)]
292         public static string GetProfile()
293         {
294             return Interop.Elementary.elm_config_profile_get();
295         }
296
297         /// <summary>
298         /// Set the global scaling factor
299         /// </summary>
300         [EditorBrowsable(EditorBrowsableState.Never)]
301         public static void SetScale(double scale)
302         {
303             Scale = scale;
304         }
305
306         /// <summary>
307         /// Get the global scaling factor
308         /// </summary>
309         [EditorBrowsable(EditorBrowsableState.Never)]
310         public static double GetScale()
311         {
312             return Scale;
313         }
314
315         /// <summary>
316         /// Flush all caches.
317         /// Frees all data that was in cache and is not currently being used to reduce memory usage. This frees Edje's, Evas' and Eet's cache.
318         /// </summary>
319         public static void FlushAllCashe()
320         {
321             Interop.Elementary.elm_cache_all_flush();
322         }
323
324         /// <summary>
325         /// Changes the language of the current application.
326         /// </summary>
327         /// <param name="language">The language to set, must be the full name of the locale.</param>
328         public static void SetLanguage(string language)
329         {
330             Interop.Elementary.elm_language_set(language);
331         }
332
333         /// <summary>
334         /// Sets a new policy's value (for a given policy group/identifier).
335         /// </summary>
336         /// <param name="policy">The policy identifier</param>
337         /// <param name="value">The policy value, which depends on the identifier</param>
338         /// <returns></returns>
339         public static bool SetPolicy(uint policy, int value)
340         {
341             return Interop.Elementary.elm_policy_set(policy, value);
342         }
343
344         /// <summary>
345         /// Reload Elementary's configuration, bounded to current selected profile.
346         /// </summary>
347         [EditorBrowsable(EditorBrowsableState.Never)]
348         public static void ReloadConfig()
349         {
350             Interop.Elementary.elm_config_reload();
351         }
352
353         /// <summary>
354         /// Flushes all config settings and then applies those settings to all applications using elementary on the current display.
355         /// </summary>
356         public static void FlushAllConfig()
357         {
358             Interop.Elementary.elm_config_all_flush();
359         }
360     }
361 }