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();
161 /// Prepends a theme overlay to the list of overlays.
163 [EditorBrowsable(EditorBrowsableState.Never)]
164 public static void ThemeOverlay()
166 if (File.Exists(_themeFilePath))
168 AddThemeOverlay(_themeFilePath);
173 /// Prepends a theme overlay to the list of overlays
175 /// <param name="filePath">The Edje file path to be used.</param>
176 public static void AddThemeOverlay(string filePath)
178 Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, filePath);
182 /// Delete a theme overlay from the list of overlays
184 /// <param name="filePath">The name of the theme overlay.</param>
185 public static void DeleteThemeOverlay(string filePath)
187 Interop.Elementary.elm_theme_overlay_del(IntPtr.Zero, filePath);
193 public static void FreeTheme()
195 Interop.Elementary.elm_theme_free(IntPtr.Zero);
199 /// Set the theme search order for the given theme
201 /// <param name="theme">Theme search string</param>
202 /// <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>
203 public static void SetTheme(string theme)
205 Interop.Elementary.elm_theme_set(IntPtr.Zero, theme);
209 /// Flush the current theme.
211 public static void FlushTheme()
213 Interop.Elementary.elm_theme_flush(IntPtr.Zero);
217 /// This flushes all themes (default and specific ones).
219 public static void FlushAllThemes()
221 Interop.Elementary.elm_theme_full_flush();
225 /// Deletes a theme extension from the list of extensions.
227 /// <param name="item">The name of the theme extension.</param>
228 public static void DeleteThemeExtention(string item)
230 Interop.Elementary.elm_theme_extension_del(IntPtr.Zero, item);
234 /// Gets the amount of inertia a scroller imposes during region bring animations.
236 /// <returns>The bring in scroll friction</returns>
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public static double GetSystemScrollFriction()
240 return BringInScrollFriction;
244 /// Sets the amount of inertia a scroller imposes during region bring animations.
246 /// <param name="timeSet">The bring in scroll friction</param>
247 [EditorBrowsable(EditorBrowsableState.Never)]
248 public static void SetSystemScrollFriction(double timeSet)
250 BringInScrollFriction = timeSet;
254 /// Gets Elementary's profile in use.
256 /// <returns>The profile name</returns>
257 [EditorBrowsable(EditorBrowsableState.Never)]
258 public static string GetProfile()
260 return Interop.Elementary.elm_config_profile_get();
264 /// Sets the global scaling factor.
265 /// This sets the globally configured scaling factor that is applied to all objects.
267 /// <param name="scale">The scaling factor to set</param>
268 [EditorBrowsable(EditorBrowsableState.Never)]
269 public static void SetScale(double scale)
275 /// Gets the global scaling factor.
276 /// This gets the globally configured scaling factor that is applied to all objects.
278 /// <returns>The scaling factor</returns>
279 [EditorBrowsable(EditorBrowsableState.Never)]
280 public static double GetScale()
286 /// Flush all caches.
287 /// 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.
289 public static void FlushAllCashe()
291 Interop.Elementary.elm_cache_all_flush();
295 /// Changes the language of the current application.
297 /// <param name="language">The language to set, must be the full name of the locale.</param>
298 public static void SetLanguage(string language)
300 Interop.Elementary.elm_language_set(language);
304 /// Sets a new policy's value (for a given policy group/identifier).
306 /// <param name="policy">The policy identifier</param>
307 /// <param name="value">The policy value, which depends on the identifier</param>
308 /// <returns></returns>
309 public static bool SetPolicy(uint policy, int value)
311 return Interop.Elementary.elm_policy_set(policy, value);
315 /// Reloads Elementary's configuration, bounded to the current selected profile.
317 public static void ReloadConfig()
319 Interop.Elementary.elm_config_reload();
323 /// Flushes all config settings and then applies those settings to all applications using elementary on the current display.
325 public static void FlushAllConfig()
327 Interop.Elementary.elm_config_all_flush();