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