2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.ComponentModel;
24 /// The Elementary is a General Elementary,a VERY SIMPLE toolkit.
26 public static class Elementary
28 private static readonly string _themeFilePath = "/usr/share/elm-sharp/elm-sharp-theme.edj";
31 /// Gets or sets the configured finger size.
33 public static int FingerSize
37 return Interop.Elementary.elm_config_finger_size_get();
41 Interop.Elementary.elm_config_finger_size_set(value);
46 /// Gets or sets the enable status of the focus highlight animation
48 public static bool IsFocusHighlightAnimation
52 return Interop.Elementary.elm_config_focus_highlight_animate_get();
56 Interop.Elementary.elm_config_focus_highlight_animate_set(value);
61 /// Gets or sets the system mirrored mode.
62 /// This determines the default mirrored mode of widgets.
64 public static bool IsMirrored
68 return Interop.Elementary.elm_config_mirrored_get();
72 Interop.Elementary.elm_config_mirrored_set(value);
77 /// Gets or sets the enable status of the focus highlight.
79 public static bool CanFocusHighlight
83 return Interop.Elementary.elm_config_focus_highlight_enabled_get();
87 Interop.Elementary.elm_config_focus_highlight_enabled_set(value);
92 /// Gets or sets the base scale of the application.
94 public static double AppBaseScale
98 return Interop.Elementary.elm_app_base_scale_get();
102 Interop.Elementary.elm_app_base_scale_set(value);
107 /// Gets or sets the global scaling factor.
109 public static double Scale
113 return Interop.Elementary.elm_config_scale_get();
117 Interop.Elementary.elm_config_scale_set(value);
122 /// Gets or sets the amount of inertia a scroller imposes during region bring animations.
124 public static double BringInScrollFriction
128 return Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_get();
132 Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_set(value);
137 /// Initializes Elementary.
139 public static void Initialize()
141 Interop.Elementary.elm_init(0, null);
145 /// Shuts down Elementary.
147 public static void Shutdown()
149 Interop.Elementary.elm_shutdown();
153 /// Runs Elementary's main loop.
155 public static void Run()
157 Interop.Elementary.elm_run();
160 [EditorBrowsable(EditorBrowsableState.Never)]
161 public static void ThemeOverlay()
163 if (File.Exists(_themeFilePath))
165 AddThemeOverlay(_themeFilePath);
170 /// Prepends a theme overlay to the list of overlays
172 /// <param name="filePath">The Edje file path to be used.</param>
173 public static void AddThemeOverlay(string filePath)
175 Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, filePath);
179 /// Delete a theme overlay from the list of overlays
181 /// <param name="filePath">The name of the theme overlay.</param>
182 public static void DeleteThemeOverlay(string filePath)
184 Interop.Elementary.elm_theme_overlay_del(IntPtr.Zero, filePath);
190 public static void FreeTheme()
192 Interop.Elementary.elm_theme_free(IntPtr.Zero);
196 /// Set the theme search order for the given theme
198 /// <param name="theme">Theme search string</param>
199 /// <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>
200 public static void SetTheme(string theme)
202 Interop.Elementary.elm_theme_set(IntPtr.Zero, theme);
206 /// Flush the current theme.
208 public static void FlushTheme()
210 Interop.Elementary.elm_theme_flush(IntPtr.Zero);
214 /// This flushes all themes (default and specific ones).
216 public static void FlushAllThemes()
218 Interop.Elementary.elm_theme_full_flush();
222 /// Deletes a theme extension from the list of extensions.
224 /// <param name="item">The name of the theme extension.</param>
225 public static void DeleteThemeExtention(string item)
227 Interop.Elementary.elm_theme_extension_del(IntPtr.Zero, item);
230 [EditorBrowsable(EditorBrowsableState.Never)]
231 public static double GetSystemScrollFriction()
233 return BringInScrollFriction;
236 [EditorBrowsable(EditorBrowsableState.Never)]
237 public static void SetSystemScrollFriction(double timeSet)
239 BringInScrollFriction = timeSet;
242 [EditorBrowsable(EditorBrowsableState.Never)]
243 public static string GetProfile()
245 return Interop.Elementary.elm_config_profile_get();
248 [EditorBrowsable(EditorBrowsableState.Never)]
249 public static void SetScale(double scale)
254 [EditorBrowsable(EditorBrowsableState.Never)]
255 public static double GetScale()
261 /// Flush all caches.
262 /// 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.
264 public static void FlushAllCashe()
266 Interop.Elementary.elm_cache_all_flush();
270 /// Changes the language of the current application.
272 /// <param name="language">The language to set, must be the full name of the locale.</param>
273 public static void SetLanguage(string language)
275 Interop.Elementary.elm_language_set(language);
279 /// Sets a new policy's value (for a given policy group/identifier).
281 /// <param name="policy">The policy identifier</param>
282 /// <param name="value">The policy value, which depends on the identifier</param>
283 /// <returns></returns>
284 public static bool SetPolicy(uint policy, int value)
286 return Interop.Elementary.elm_policy_set(policy, value);
290 /// Reloads Elementary's configuration, bounded to the current selected profile.
292 public static void ReloadConfig()
294 Interop.Elementary.elm_config_reload();
298 /// Flushes all config settings and then applies those settings to all applications using elementary on the current display.
300 public static void FlushAllConfig()
302 Interop.Elementary.elm_config_all_flush();