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 /// Focus Autoscroll Mode
26 public enum FocusAutoScrollMode
29 /// Directly show the focused region or item automatically
34 /// Do not show the focused region or item automatically
39 /// Bring in the focused region or item automatically which might invole the scrolling
45 /// The Elementary is a General Elementary,a VERY SIMPLE toolkit.
47 public static class Elementary
49 private static readonly string _themeFilePath = "/usr/share/elm-sharp/elm-sharp-theme.edj";
52 /// Gets or sets the configured finger size.
54 public static int FingerSize
58 return Interop.Elementary.elm_config_finger_size_get();
62 Interop.Elementary.elm_config_finger_size_set(value);
67 /// Gets or sets the enable status of the focus highlight animation
69 public static bool IsFocusHighlightAnimation
73 return Interop.Elementary.elm_config_focus_highlight_animate_get();
77 Interop.Elementary.elm_config_focus_highlight_animate_set(value);
82 /// Gets or sets the system mirrored mode.
83 /// This determines the default mirrored mode of widgets.
85 public static bool IsMirrored
89 return Interop.Elementary.elm_config_mirrored_get();
93 Interop.Elementary.elm_config_mirrored_set(value);
98 /// Gets or sets the enable status of the focus highlight.
100 public static bool CanFocusHighlight
104 return Interop.Elementary.elm_config_focus_highlight_enabled_get();
108 Interop.Elementary.elm_config_focus_highlight_enabled_set(value);
113 /// Gets or sets the base scale of the application.
115 public static double AppBaseScale
119 return Interop.Elementary.elm_app_base_scale_get();
123 Interop.Elementary.elm_app_base_scale_set(value);
128 /// Gets or sets the global scaling factor.
130 public static double Scale
134 return Interop.Elementary.elm_config_scale_get();
138 Interop.Elementary.elm_config_scale_set(value);
143 /// Gets or sets the amount of inertia a scroller imposes during region bring animations.
145 public static double BringInScrollFriction
149 return Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_get();
153 Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_set(value);
158 /// Gets of sets focus auto scroll mode.
160 public static FocusAutoScrollMode FocusAutoScrollMode
164 return (FocusAutoScrollMode)Interop.Elementary.elm_config_focus_autoscroll_mode_get();
168 Interop.Elementary.elm_config_focus_autoscroll_mode_set((Interop.Elementary.Elm_Focus_Autoscroll_Mode)value);
173 /// Initializes Elementary.
175 public static void Initialize()
177 Interop.Elementary.elm_init(0, null);
181 /// Shuts down Elementary.
183 public static void Shutdown()
185 Interop.Elementary.elm_shutdown();
189 /// Runs Elementary's main loop.
191 public static void Run()
193 Interop.Elementary.elm_run();
197 /// Prepends a theme overlay to the list of overlays
199 [EditorBrowsable(EditorBrowsableState.Never)]
200 public static void ThemeOverlay()
202 if (File.Exists(_themeFilePath))
204 AddThemeOverlay(_themeFilePath);
209 /// Prepends a theme overlay to the list of overlays
211 /// <param name="filePath">The Edje file path to be used.</param>
212 public static void AddThemeOverlay(string filePath)
214 Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, filePath);
218 /// Delete a theme overlay from the list of overlays
220 /// <param name="filePath">The name of the theme overlay.</param>
221 public static void DeleteThemeOverlay(string filePath)
223 Interop.Elementary.elm_theme_overlay_del(IntPtr.Zero, filePath);
229 public static void FreeTheme()
231 Interop.Elementary.elm_theme_free(IntPtr.Zero);
235 /// Set the theme search order for the given theme
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)
241 Interop.Elementary.elm_theme_set(IntPtr.Zero, theme);
245 /// Flush the current theme.
247 public static void FlushTheme()
249 Interop.Elementary.elm_theme_flush(IntPtr.Zero);
253 /// This flushes all themes (default and specific ones).
255 public static void FlushAllThemes()
257 Interop.Elementary.elm_theme_full_flush();
261 /// Deletes a theme extension from the list of extensions.
263 /// <param name="item">The name of the theme extension.</param>
264 public static void DeleteThemeExtention(string item)
266 Interop.Elementary.elm_theme_extension_del(IntPtr.Zero, item);
270 /// Gets the amount of inertia a scroller imposes during region bring animations.
272 [EditorBrowsable(EditorBrowsableState.Never)]
273 public static double GetSystemScrollFriction()
275 return BringInScrollFriction;
279 /// Sets the amount of inertia a scroller imposes during region bring animations.
281 [EditorBrowsable(EditorBrowsableState.Never)]
282 public static void SetSystemScrollFriction(double timeSet)
285 BringInScrollFriction = timeSet;
289 /// Get Elementary's profile in use
291 [EditorBrowsable(EditorBrowsableState.Never)]
292 public static string GetProfile()
294 return Interop.Elementary.elm_config_profile_get();
298 /// Set the global scaling factor
300 [EditorBrowsable(EditorBrowsableState.Never)]
301 public static void SetScale(double scale)
307 /// Get the global scaling factor
309 [EditorBrowsable(EditorBrowsableState.Never)]
310 public static double GetScale()
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.
319 public static void FlushAllCashe()
321 Interop.Elementary.elm_cache_all_flush();
325 /// Changes the language of the current application.
327 /// <param name="language">The language to set, must be the full name of the locale.</param>
328 public static void SetLanguage(string language)
330 Interop.Elementary.elm_language_set(language);
334 /// Sets a new policy's value (for a given policy group/identifier).
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)
341 return Interop.Elementary.elm_policy_set(policy, value);
345 /// Reload Elementary's configuration, bounded to current selected profile.
347 [EditorBrowsable(EditorBrowsableState.Never)]
348 public static void ReloadConfig()
350 Interop.Elementary.elm_config_reload();
354 /// Flushes all config settings and then applies those settings to all applications using elementary on the current display.
356 public static void FlushAllConfig()
358 Interop.Elementary.elm_config_all_flush();