1 //------------------------------------------------------------------------------
4 // This file was automatically generated by SWIG (http://www.swig.org).
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
14 using System.Runtime.InteropServices;
16 public class StyleManager : BaseHandle {
17 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
19 internal StyleManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.StyleManager_SWIGUpcast(cPtr), cMemoryOwn) {
20 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
23 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StyleManager obj) {
24 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
31 public override void Dispose() {
33 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
36 NDalicPINVOKE.delete_StyleManager(swigCPtr);
38 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
40 global::System.GC.SuppressFinalize(this);
48 * @brief Event arguments that passed via StyleChanged signal
51 public class StyleChangedEventArgs : EventArgs
53 private StyleManager _styleManager;
54 private Dali.StyleChangeType _styleChange;
57 * @brief StyleManager - is the StyleManager that informs applications of system theme change,
58 * and supports application theme change at runtime.
61 public StyleManager StyleManager
69 _styleManager = value;
74 * @brief StyleChange - contains Style change information (default font changed or
75 * default font size changed or theme has changed)
78 public Dali.StyleChangeType StyleChange
92 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
93 private delegate void StyleChangedCallbackDelegate(IntPtr styleManager, Dali.StyleChangeType styleChange);
94 private DaliEventHandler<object,StyleChangedEventArgs> _styleManagerStyleChangedEventHandler;
95 private StyleChangedCallbackDelegate _styleManagerStyleChangedCallbackDelegate;
98 * @brief Event for StyleChanged signal which can be used to subscribe/unsubscribe the
99 * event handler (in the type of StyleChangedEventHandler-DaliEventHandler<object,StyleChangedEventArgs>)
100 * provided by the user. StyleChanged signal is is emitted after the style (e.g. theme/font change) has changed
101 * and the controls have been informed.
103 public event DaliEventHandler<object,StyleChangedEventArgs> StyleChanged
109 // Restricted to only one listener
110 if (_styleManagerStyleChangedEventHandler == null)
112 _styleManagerStyleChangedEventHandler += value;
114 _styleManagerStyleChangedCallbackDelegate = new StyleChangedCallbackDelegate(OnStyleChanged);
115 this.StyleChangedSignal().Connect(_styleManagerStyleChangedCallbackDelegate);
124 if (_styleManagerStyleChangedEventHandler != null)
126 this.StyleChangedSignal().Disconnect(_styleManagerStyleChangedCallbackDelegate);
129 _styleManagerStyleChangedEventHandler -= value;
134 // Callback for StyleManager StyleChangedsignal
135 private void OnStyleChanged(IntPtr styleManager, Dali.StyleChangeType styleChange)
137 StyleChangedEventArgs e = new StyleChangedEventArgs();
139 // Populate all members of "e" (StyleChangedEventArgs) with real data
140 e.StyleManager = StyleManager.GetStyleManagerFromPtr( styleManager );
141 e.StyleChange = styleChange;
143 if (_styleManagerStyleChangedEventHandler != null)
145 //here we send all data to user event handlers
146 _styleManagerStyleChangedEventHandler(this, e);
150 public static StyleManager GetStyleManagerFromPtr(global::System.IntPtr cPtr) {
151 StyleManager ret = new StyleManager(cPtr, false);
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 public StyleManager() : this(NDalicPINVOKE.new_StyleManager(), true) {
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 public static StyleManager Get() {
162 StyleManager ret = new StyleManager(NDalicPINVOKE.StyleManager_Get(), true);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 public void ApplyTheme(string themeFile) {
168 NDalicPINVOKE.StyleManager_ApplyTheme(swigCPtr, themeFile);
169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172 public void ApplyDefaultTheme() {
173 NDalicPINVOKE.StyleManager_ApplyDefaultTheme(swigCPtr);
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 public void SetStyleConstant(string key, Property.Value value) {
178 NDalicPINVOKE.StyleManager_SetStyleConstant(swigCPtr, key, Property.Value.getCPtr(value));
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 public bool GetStyleConstant(string key, Property.Value valueOut) {
183 bool ret = NDalicPINVOKE.StyleManager_GetStyleConstant(swigCPtr, key, Property.Value.getCPtr(valueOut));
184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188 public void ApplyStyle(View control, string jsonFileName, string styleName) {
189 NDalicPINVOKE.StyleManager_ApplyStyle(swigCPtr, View.getCPtr(control), jsonFileName, styleName);
190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 public StyleChangedSignal StyleChangedSignal() {
194 StyleChangedSignal ret = new StyleChangedSignal(NDalicPINVOKE.StyleManager_StyleChangedSignal(swigCPtr), false);
195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();