//------------------------------------------------------------------------------ // // // This file was automatically generated by SWIG (http://www.swig.org). // Version 3.0.9 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. //------------------------------------------------------------------------------ namespace Tizen.NUI { using System; using System.Runtime.InteropServices; /// /// StyleManager informs applications of system theme change, /// and supports application theme change at runtime. /// Applies various styles to Controls using the properties system. /// On theme change, it automatically updates all controls, then raises /// a event to inform the application. /// /// If the application wants to customize the theme, RequestThemeChange /// needs to be called. /// It provides the path to the application resource root folder, /// from there the filename can an be specified along with /// any sub folders, e.g Images, Models etc. /// public class StyleManager : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; internal StyleManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.StyleManager_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StyleManager obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } ~StyleManager() { DisposeQueue.Instance.Add(this); } /// /// Dispose /// public override void Dispose() { if (!Stage.IsInstalled()) { DisposeQueue.Instance.Add(this); return; } lock (this) { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; NDalicPINVOKE.delete_StyleManager(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } global::System.GC.SuppressFinalize(this); base.Dispose(); } } /// /// Style changed event arguments /// public class StyleChangedEventArgs : EventArgs { private StyleManager _styleManager; private StyleChangeType _styleChange; /// /// StyleManager. /// public StyleManager StyleManager { get { return _styleManager; } set { _styleManager = value; } } /// /// StyleChange - contains Style change information (default font changed or /// default font size changed or theme has changed) /// public StyleChangeType StyleChange { get { return _styleChange; } set { _styleChange = value; } } } [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void StyleChangedCallbackDelegate(IntPtr styleManager, Tizen.NUI.StyleChangeType styleChange); private EventHandler _styleManagerStyleChangedEventHandler; private StyleChangedCallbackDelegate _styleManagerStyleChangedCallbackDelegate; /// /// Event for StyleChanged signal which can be used to subscribe/unsubscribe the /// event handler provided by the user. /// StyleChanged signal is is emitted after the style (e.g. theme/font change) has changed /// and the controls have been informed. /// public event EventHandler StyleChanged { add { if (_styleManagerStyleChangedEventHandler == null) { _styleManagerStyleChangedCallbackDelegate = (OnStyleChanged); StyleChangedSignal().Connect(_styleManagerStyleChangedCallbackDelegate); } _styleManagerStyleChangedEventHandler += value; } remove { _styleManagerStyleChangedEventHandler -= value; if (_styleManagerStyleChangedEventHandler == null && _styleManagerStyleChangedCallbackDelegate != null) { StyleChangedSignal().Disconnect(_styleManagerStyleChangedCallbackDelegate); } } } // Callback for StyleManager StyleChangedsignal private void OnStyleChanged(IntPtr styleManager, StyleChangeType styleChange) { StyleChangedEventArgs e = new StyleChangedEventArgs(); // Populate all members of "e" (StyleChangedEventArgs) with real data e.StyleManager = StyleManager.GetStyleManagerFromPtr(styleManager); e.StyleChange = styleChange; if (_styleManagerStyleChangedEventHandler != null) { //here we send all data to user event handlers _styleManagerStyleChangedEventHandler(this, e); } } internal static StyleManager GetStyleManagerFromPtr(global::System.IntPtr cPtr) { StyleManager ret = new StyleManager(cPtr, false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Creates a StyleManager handle. /// this can be initialized with StyleManager::Get(). /// public StyleManager() : this(NDalicPINVOKE.new_StyleManager(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Gets the singleton of StyleManager object. /// /// A handle to the StyleManager control public static StyleManager Get() { StyleManager ret = new StyleManager(NDalicPINVOKE.StyleManager_Get(), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Applies a new theme to the application. /// This will be merged on top of the default Toolkit theme. /// If the application theme file doesn't style all controls that the /// application uses, then the default Toolkit theme will be used /// instead for those controls. /// /// A relative path is specified for style theme public void ApplyTheme(string themeFile) { NDalicPINVOKE.StyleManager_ApplyTheme(swigCPtr, themeFile); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Applies the default Toolkit theme. /// public void ApplyDefaultTheme() { NDalicPINVOKE.StyleManager_ApplyDefaultTheme(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets a constant for use when building styles. /// /// The key of the constant /// The value of the constant public void SetStyleConstant(string key, PropertyValue value) { NDalicPINVOKE.StyleManager_SetStyleConstant(swigCPtr, key, PropertyValue.getCPtr(value)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Returns the style constant set for a specific key. /// /// The key of the constant /// The value of the constant if it exists /// public bool GetStyleConstant(string key, PropertyValue valueOut) { bool ret = NDalicPINVOKE.StyleManager_GetStyleConstant(swigCPtr, key, PropertyValue.getCPtr(valueOut)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Applies the specified style to the control. /// /// The control to which to apply the style /// The name of the JSON style file to apply /// The name of the style within the JSON file to apply public void ApplyStyle(View control, string jsonFileName, string styleName) { NDalicPINVOKE.StyleManager_ApplyStyle(swigCPtr, View.getCPtr(control), jsonFileName, styleName); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal StyleChangedSignal StyleChangedSignal() { StyleChangedSignal ret = new StyleChangedSignal(NDalicPINVOKE.StyleManager_StyleChangedSignal(swigCPtr), false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } } /// /// Types of style change. /// public enum StyleChangeType { DefaultFontChange, DefaultFontSizeChange, ThemeChange } }