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