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 /// <since_tizen> preview </since_tizen>
27 public enum FocusAutoScrollMode
30 /// Directly show the focused region or item automatically.
35 /// Do not show the focused region or item automatically.
40 /// Bring in the focused region or item automatically, which might involve the scrolling.
46 /// The Elementary is a general elementary, a VERY SIMPLE toolkit.
48 /// <since_tizen> preview </since_tizen>
49 public static class Elementary
51 private const string _themeFilePath = "/usr/share/elm-sharp/elm-sharp-theme.edj";
54 /// EvasObjectRealized will be triggered when the EvasObject is realized.
56 /// <since_tizen> preview </since_tizen>
57 public static event EventHandler EvasObjectRealized;
60 /// ItemObjectRealized will be triggered when the ItemObject is realized.
62 /// <since_tizen> preview </since_tizen>
63 public static event EventHandler ItemObjectRealized;
65 internal static void SendEvasObjectRealized(EvasObject obj)
67 EvasObjectRealized?.Invoke(obj, EventArgs.Empty);
70 internal static void SendItemObjectRealized(ItemObject obj)
72 ItemObjectRealized?.Invoke(obj, EventArgs.Empty);
76 /// Gets or sets the configured finger size.
78 /// <since_tizen> preview </since_tizen>
79 public static int FingerSize
83 return Interop.Elementary.elm_config_finger_size_get();
87 Interop.Elementary.elm_config_finger_size_set(value);
92 /// Gets or sets the enable status of the focus highlight animation.
94 /// <since_tizen> preview </since_tizen>
95 public static bool IsFocusHighlightAnimation
99 return Interop.Elementary.elm_config_focus_highlight_animate_get();
103 Interop.Elementary.elm_config_focus_highlight_animate_set(value);
108 /// Gets or sets the system mirrored mode.
109 /// This determines the default mirrored mode of widgets.
111 /// <since_tizen> preview </since_tizen>
112 public static bool IsMirrored
116 return Interop.Elementary.elm_config_mirrored_get();
120 Interop.Elementary.elm_config_mirrored_set(value);
125 /// Gets or sets the enable status of the focus highlight.
127 /// <since_tizen> preview </since_tizen>
128 public static bool CanFocusHighlight
132 return Interop.Elementary.elm_config_focus_highlight_enabled_get();
136 Interop.Elementary.elm_config_focus_highlight_enabled_set(value);
141 /// Gets or sets the base scale of the application.
143 /// <since_tizen> preview </since_tizen>
144 public static double AppBaseScale
148 return Interop.Elementary.elm_app_base_scale_get();
152 Interop.Elementary.elm_app_base_scale_set(value);
157 /// Gets or sets the global scaling factor.
159 /// <since_tizen> preview </since_tizen>
160 public static double Scale
164 return Interop.Elementary.elm_config_scale_get();
168 Interop.Elementary.elm_config_scale_set(value);
173 /// Gets or sets the amount of inertia, a scroller imposes during a region to bring animations.
175 /// <since_tizen> preview </since_tizen>
176 public static double BringInScrollFriction
180 return Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_get();
184 Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_set(value);
189 /// Gets or sets the focus on autoscroll mode.
191 /// <since_tizen> preview </since_tizen>
192 public static FocusAutoScrollMode FocusAutoScrollMode
196 return (FocusAutoScrollMode)Interop.Elementary.elm_config_focus_autoscroll_mode_get();
200 Interop.Elementary.elm_config_focus_autoscroll_mode_set((Interop.Elementary.Elm_Focus_Autoscroll_Mode)value);
205 /// Initializes Elementary.
207 /// <since_tizen> preview </since_tizen>
208 public static void Initialize()
210 Interop.Elementary.elm_init(0, null);
214 /// Shuts down Elementary.
216 /// <since_tizen> preview </since_tizen>
217 public static void Shutdown()
219 Interop.Elementary.elm_shutdown();
223 /// Runs the elementary's main loop.
225 /// <since_tizen> preview </since_tizen>
226 public static void Run()
228 Interop.Elementary.elm_run();
232 /// Prepends a theme overlay to the list of overlays.
234 /// <since_tizen> preview </since_tizen>
235 [EditorBrowsable(EditorBrowsableState.Never)]
236 public static void ThemeOverlay()
238 if (File.Exists(_themeFilePath))
240 AddThemeOverlay(_themeFilePath);
245 /// Prepends a theme overlay to the list of overlays.
247 /// <param name="filePath">The edje file path to be used.</param>
248 /// <since_tizen> preview </since_tizen>
249 public static void AddThemeOverlay(string filePath)
251 Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, filePath);
255 /// Deletes a theme overlay from the list of overlays.
257 /// <param name="filePath">The name of the theme overlay.</param>
258 /// <since_tizen> preview </since_tizen>
259 public static void DeleteThemeOverlay(string filePath)
261 Interop.Elementary.elm_theme_overlay_del(IntPtr.Zero, filePath);
267 /// <since_tizen> preview </since_tizen>
268 public static void FreeTheme()
270 Interop.Elementary.elm_theme_free(IntPtr.Zero);
274 /// Sets the theme search order for the given theme.
276 /// <param name="theme">Theme search string.</param>
277 /// <remarks>This sets the search string for the theme in path-notation from the first theme to search, to last, delimited by the : character. For example, "shiny:/path/to/file.edj:default".</remarks>
278 /// <since_tizen> preview </since_tizen>
279 public static void SetTheme(string theme)
281 Interop.Elementary.elm_theme_set(IntPtr.Zero, theme);
285 /// Flushes the current theme.
287 /// <since_tizen> preview </since_tizen>
288 public static void FlushTheme()
290 Interop.Elementary.elm_theme_flush(IntPtr.Zero);
294 /// This flushes all the themes (default and specific ones).
296 /// <since_tizen> preview </since_tizen>
297 public static void FlushAllThemes()
299 Interop.Elementary.elm_theme_full_flush();
303 /// Deletes a theme extension from the list of extensions.
305 /// <param name="item">The name of the theme extension.</param>
306 /// <since_tizen> preview </since_tizen>
307 public static void DeleteThemeExtention(string item)
309 Interop.Elementary.elm_theme_extension_del(IntPtr.Zero, item);
313 /// Gets the amount of inertia that a scroller imposes during region to bring animations.
315 /// <since_tizen> preview </since_tizen>
316 [EditorBrowsable(EditorBrowsableState.Never)]
317 public static double GetSystemScrollFriction()
319 return BringInScrollFriction;
323 /// Sets the amount of inertia that a scroller imposes during the region bring animations.
325 /// <since_tizen> preview </since_tizen>
326 [EditorBrowsable(EditorBrowsableState.Never)]
327 public static void SetSystemScrollFriction(double timeSet)
330 BringInScrollFriction = timeSet;
334 /// Gets the elementary's profile in use.
336 /// <since_tizen> preview </since_tizen>
337 [EditorBrowsable(EditorBrowsableState.Never)]
338 public static string GetProfile()
340 return Interop.Elementary.elm_config_profile_get();
344 /// Sets the global scaling factor.
346 /// <since_tizen> preview </since_tizen>
347 [EditorBrowsable(EditorBrowsableState.Never)]
348 public static void SetScale(double scale)
354 /// Gets the global scaling factor.
356 /// <since_tizen> preview </since_tizen>
357 [EditorBrowsable(EditorBrowsableState.Never)]
358 public static double GetScale()
364 /// Use FlushAllCache instead.
366 [Obsolete("use FlushAllCache instead")]
367 [EditorBrowsable(EditorBrowsableState.Never)]
368 public static void FlushAllCashe()
370 Interop.Elementary.elm_cache_all_flush();
374 /// Flushes all the cache.
375 /// 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.
377 /// <since_tizen> preview </since_tizen>
378 public static void FlushAllCache()
380 Interop.Elementary.elm_cache_all_flush();
384 /// Changes the language of the current application.
386 /// <param name="language">The language to set must be the full name of the locale.</param>
387 /// <since_tizen> preview </since_tizen>
388 public static void SetLanguage(string language)
390 Interop.Elementary.elm_language_set(language);
394 /// Sets a new policy's value (for a given policy group/identifier).
396 /// <param name="policy">The policy identifier.</param>
397 /// <param name="value">The policy value, which depends on the identifier.</param>
398 /// <returns></returns>
399 /// <since_tizen> preview </since_tizen>
400 public static bool SetPolicy(uint policy, int value)
402 return Interop.Elementary.elm_policy_set(policy, value);
406 /// Reloads the elementary's configuration, bounded to the current selected profile.
408 /// <since_tizen> preview </since_tizen>
409 [EditorBrowsable(EditorBrowsableState.Never)]
410 public static void ReloadConfig()
412 Interop.Elementary.elm_config_reload();
416 /// Flushes all the configuration settings, and then applies those settings to all applications using elementary on the current display.
418 /// <since_tizen> preview </since_tizen>
419 public static void FlushAllConfig()
421 Interop.Elementary.elm_config_all_flush();