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();
194 [EditorBrowsable(EditorBrowsableState.Never)]
195 public static void ThemeOverlay()
197 if (File.Exists(_themeFilePath))
199 AddThemeOverlay(_themeFilePath);
204 /// Prepends a theme overlay to the list of overlays
206 /// <param name="filePath">The Edje file path to be used.</param>
207 public static void AddThemeOverlay(string filePath)
209 Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, filePath);
213 /// Delete a theme overlay from the list of overlays
215 /// <param name="filePath">The name of the theme overlay.</param>
216 public static void DeleteThemeOverlay(string filePath)
218 Interop.Elementary.elm_theme_overlay_del(IntPtr.Zero, filePath);
224 public static void FreeTheme()
226 Interop.Elementary.elm_theme_free(IntPtr.Zero);
230 /// Set the theme search order for the given theme
232 /// <param name="theme">Theme search string</param>
233 /// <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>
234 public static void SetTheme(string theme)
236 Interop.Elementary.elm_theme_set(IntPtr.Zero, theme);
240 /// Flush the current theme.
242 public static void FlushTheme()
244 Interop.Elementary.elm_theme_flush(IntPtr.Zero);
248 /// This flushes all themes (default and specific ones).
250 public static void FlushAllThemes()
252 Interop.Elementary.elm_theme_full_flush();
256 /// Deletes a theme extension from the list of extensions.
258 /// <param name="item">The name of the theme extension.</param>
259 public static void DeleteThemeExtention(string item)
261 Interop.Elementary.elm_theme_extension_del(IntPtr.Zero, item);
264 [EditorBrowsable(EditorBrowsableState.Never)]
265 public static double GetSystemScrollFriction()
267 return BringInScrollFriction;
270 [EditorBrowsable(EditorBrowsableState.Never)]
271 public static void SetSystemScrollFriction(double timeSet)
273 BringInScrollFriction = timeSet;
276 [EditorBrowsable(EditorBrowsableState.Never)]
277 public static string GetProfile()
279 return Interop.Elementary.elm_config_profile_get();
282 [EditorBrowsable(EditorBrowsableState.Never)]
283 public static void SetScale(double scale)
288 [EditorBrowsable(EditorBrowsableState.Never)]
289 public static double GetScale()
295 /// Flush all caches.
296 /// 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.
298 public static void FlushAllCashe()
300 Interop.Elementary.elm_cache_all_flush();
304 /// Changes the language of the current application.
306 /// <param name="language">The language to set, must be the full name of the locale.</param>
307 public static void SetLanguage(string language)
309 Interop.Elementary.elm_language_set(language);
313 /// Sets a new policy's value (for a given policy group/identifier).
315 /// <param name="policy">The policy identifier</param>
316 /// <param name="value">The policy value, which depends on the identifier</param>
317 /// <returns></returns>
318 public static bool SetPolicy(uint policy, int value)
320 return Interop.Elementary.elm_policy_set(policy, value);
324 /// Reloads Elementary's configuration, bounded to the current selected profile.
326 public static void ReloadConfig()
328 Interop.Elementary.elm_config_reload();
332 /// Flushes all config settings and then applies those settings to all applications using elementary on the current display.
334 public static void FlushAllConfig()
336 Interop.Elementary.elm_config_all_flush();