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
33 /// Do not show the focused region or item automatically
37 /// Bring in the focused region or item automatically which might invole the scrolling
43 /// The Elementary is a General Elementary,a VERY SIMPLE toolkit.
45 public static class Elementary
47 private static readonly string _themeFilePath = "/usr/share/elm-sharp/elm-sharp-theme.edj";
50 /// Gets or sets the configured finger size.
52 public static int FingerSize
56 return Interop.Elementary.elm_config_finger_size_get();
60 Interop.Elementary.elm_config_finger_size_set(value);
65 /// Gets or sets the enable status of the focus highlight animation
67 public static bool IsFocusHighlightAnimation
71 return Interop.Elementary.elm_config_focus_highlight_animate_get();
75 Interop.Elementary.elm_config_focus_highlight_animate_set(value);
80 /// Gets or sets the system mirrored mode.
81 /// This determines the default mirrored mode of widgets.
83 public static bool IsMirrored
87 return Interop.Elementary.elm_config_mirrored_get();
91 Interop.Elementary.elm_config_mirrored_set(value);
96 /// Gets or sets the enable status of the focus highlight.
98 public static bool CanFocusHighlight
102 return Interop.Elementary.elm_config_focus_highlight_enabled_get();
106 Interop.Elementary.elm_config_focus_highlight_enabled_set(value);
111 /// Gets or sets the base scale of the application.
113 public static double AppBaseScale
117 return Interop.Elementary.elm_app_base_scale_get();
121 Interop.Elementary.elm_app_base_scale_set(value);
126 /// Gets or sets the global scaling factor.
128 public static double Scale
132 return Interop.Elementary.elm_config_scale_get();
136 Interop.Elementary.elm_config_scale_set(value);
141 /// Gets or sets the amount of inertia a scroller imposes during region bring animations.
143 public static double BringInScrollFriction
147 return Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_get();
151 Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_set(value);
156 /// Gets of sets focus auto scroll mode.
158 public static FocusAutoScrollMode FocusAutoScrollMode
162 return (FocusAutoScrollMode)Interop.Elementary.elm_config_focus_autoscroll_mode_get();
166 Interop.Elementary.elm_config_focus_autoscroll_mode_set((Interop.Elementary.Elm_Focus_Autoscroll_Mode)value);
171 /// Initializes Elementary.
173 public static void Initialize()
175 Interop.Elementary.elm_init(0, null);
179 /// Shuts down Elementary.
181 public static void Shutdown()
183 Interop.Elementary.elm_shutdown();
187 /// Runs Elementary's main loop.
189 public static void Run()
191 Interop.Elementary.elm_run();
195 /// Prepends a theme overlay to the list of overlays.
197 [EditorBrowsable(EditorBrowsableState.Never)]
198 public static void ThemeOverlay()
200 if (File.Exists(_themeFilePath))
202 AddThemeOverlay(_themeFilePath);
207 /// Prepends a theme overlay to the list of overlays
209 /// <param name="filePath">The Edje file path to be used.</param>
210 public static void AddThemeOverlay(string filePath)
212 Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, filePath);
216 /// Delete a theme overlay from the list of overlays
218 /// <param name="filePath">The name of the theme overlay.</param>
219 public static void DeleteThemeOverlay(string filePath)
221 Interop.Elementary.elm_theme_overlay_del(IntPtr.Zero, filePath);
227 public static void FreeTheme()
229 Interop.Elementary.elm_theme_free(IntPtr.Zero);
233 /// Set the theme search order for the given theme
235 /// <param name="theme">Theme search string</param>
236 /// <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>
237 public static void SetTheme(string theme)
239 Interop.Elementary.elm_theme_set(IntPtr.Zero, theme);
243 /// Flush the current theme.
245 public static void FlushTheme()
247 Interop.Elementary.elm_theme_flush(IntPtr.Zero);
251 /// This flushes all themes (default and specific ones).
253 public static void FlushAllThemes()
255 Interop.Elementary.elm_theme_full_flush();
259 /// Deletes a theme extension from the list of extensions.
261 /// <param name="item">The name of the theme extension.</param>
262 public static void DeleteThemeExtention(string item)
264 Interop.Elementary.elm_theme_extension_del(IntPtr.Zero, item);
268 /// Gets the amount of inertia a scroller imposes during region bring animations.
270 /// <returns>The bring in scroll friction</returns>
271 [EditorBrowsable(EditorBrowsableState.Never)]
272 public static double GetSystemScrollFriction()
274 return BringInScrollFriction;
278 /// Sets the amount of inertia a scroller imposes during region bring animations.
280 /// <param name="timeSet">The bring in scroll friction</param>
281 [EditorBrowsable(EditorBrowsableState.Never)]
282 public static void SetSystemScrollFriction(double timeSet)
284 BringInScrollFriction = timeSet;
288 /// Gets Elementary's profile in use.
290 /// <returns>The profile name</returns>
291 [EditorBrowsable(EditorBrowsableState.Never)]
292 public static string GetProfile()
294 return Interop.Elementary.elm_config_profile_get();
298 /// Sets the global scaling factor.
299 /// This sets the globally configured scaling factor that is applied to all objects.
301 /// <param name="scale">The scaling factor to set</param>
302 [EditorBrowsable(EditorBrowsableState.Never)]
303 public static void SetScale(double scale)
309 /// Gets the global scaling factor.
310 /// This gets the globally configured scaling factor that is applied to all objects.
312 /// <returns>The scaling factor</returns>
313 [EditorBrowsable(EditorBrowsableState.Never)]
314 public static double GetScale()
320 /// Flush all caches.
321 /// 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.
323 public static void FlushAllCashe()
325 Interop.Elementary.elm_cache_all_flush();
329 /// Changes the language of the current application.
331 /// <param name="language">The language to set, must be the full name of the locale.</param>
332 public static void SetLanguage(string language)
334 Interop.Elementary.elm_language_set(language);
338 /// Sets a new policy's value (for a given policy group/identifier).
340 /// <param name="policy">The policy identifier</param>
341 /// <param name="value">The policy value, which depends on the identifier</param>
342 /// <returns></returns>
343 public static bool SetPolicy(uint policy, int value)
345 return Interop.Elementary.elm_policy_set(policy, value);
349 /// Reloads Elementary's configuration, bounded to the current selected profile.
351 public static void ReloadConfig()
353 Interop.Elementary.elm_config_reload();
357 /// Flushes all config settings and then applies those settings to all applications using elementary on the current display.
359 public static void FlushAllConfig()
361 Interop.Elementary.elm_config_all_flush();