Merge "C# CustomView Implementation (C++ wrappers, manual bindings, C# wrappers)...
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / automatic / csharp / StyleManager.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.9
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10
11 namespace Dali {
12
13 using System;
14 using System.Runtime.InteropServices;
15
16 public class StyleManager : BaseHandle {
17   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
18
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);
21   }
22
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;
25   }
26
27   ~StyleManager() {
28     Dispose();
29   }
30
31   public override void Dispose() {
32     lock(this) {
33       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
34         if (swigCMemOwn) {
35           swigCMemOwn = false;
36           NDalicPINVOKE.delete_StyleManager(swigCPtr);
37         }
38         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
39       }
40       global::System.GC.SuppressFinalize(this);
41       base.Dispose();
42     }
43   }
44
45
46
47 /**
48   * @brief Event arguments that passed via StyleChanged signal
49   *
50   */
51 public class StyleChangedEventArgs : EventArgs
52 {
53    private StyleManager _styleManager;
54    private Dali.StyleChangeType _styleChange;
55
56    /**
57      * @brief StyleManager - is the StyleManager that informs applications of system theme change,
58      * and supports application theme change at runtime.
59      *
60      */
61    public StyleManager StyleManager
62    {
63       get
64       {
65          return _styleManager;
66       }
67       set
68       {
69          _styleManager = value;
70       }
71    }
72
73    /**
74      * @brief StyleChange - contains Style change information (default font changed or
75      * default font size changed or theme has changed)
76      *
77      */
78    public Dali.StyleChangeType StyleChange
79    {
80       get
81       {
82          return _styleChange;
83       }
84       set
85       {
86          _styleChange = value;
87       }
88    }
89
90 }
91
92   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
93   private delegate void StyleChangedCallbackDelegate(IntPtr styleManager, Dali.StyleChangeType styleChange);
94   private DaliEventHandler<object,StyleChangedEventArgs> _styleManagerStyleChangedEventHandler;
95   private StyleChangedCallbackDelegate _styleManagerStyleChangedCallbackDelegate;
96
97   /**
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.
102     */
103   public event DaliEventHandler<object,StyleChangedEventArgs> StyleChanged
104   {
105      add
106      {
107         lock(this)
108         {
109            // Restricted to only one listener
110            if (_styleManagerStyleChangedEventHandler == null)
111            {
112               _styleManagerStyleChangedEventHandler += value;
113
114               _styleManagerStyleChangedCallbackDelegate = new StyleChangedCallbackDelegate(OnStyleChanged);
115               this.StyleChangedSignal().Connect(_styleManagerStyleChangedCallbackDelegate);
116            }
117         }
118      }
119
120      remove
121      {
122         lock(this)
123         {
124            if (_styleManagerStyleChangedEventHandler != null)
125            {
126               this.StyleChangedSignal().Disconnect(_styleManagerStyleChangedCallbackDelegate);
127            }
128
129            _styleManagerStyleChangedEventHandler -= value;
130         }
131      }
132   }
133
134   // Callback for StyleManager StyleChangedsignal
135   private void OnStyleChanged(IntPtr styleManager, Dali.StyleChangeType styleChange)
136   {
137      StyleChangedEventArgs e = new StyleChangedEventArgs();
138
139      // Populate all members of "e" (StyleChangedEventArgs) with real data
140      e.StyleManager = StyleManager.GetStyleManagerFromPtr( styleManager );
141      e.StyleChange = styleChange;
142
143      if (_styleManagerStyleChangedEventHandler != null)
144      {
145         //here we send all data to user event handlers
146         _styleManagerStyleChangedEventHandler(this, e);
147      }
148   }
149
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();
153       return ret;
154    }
155
156
157   public StyleManager() : this(NDalicPINVOKE.new_StyleManager(), true) {
158     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159   }
160
161   public static StyleManager Get() {
162     StyleManager ret = new StyleManager(NDalicPINVOKE.StyleManager_Get(), true);
163     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164     return ret;
165   }
166
167   public void ApplyTheme(string themeFile) {
168     NDalicPINVOKE.StyleManager_ApplyTheme(swigCPtr, themeFile);
169     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170   }
171
172   public void ApplyDefaultTheme() {
173     NDalicPINVOKE.StyleManager_ApplyDefaultTheme(swigCPtr);
174     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175   }
176
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();
180   }
181
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();
185     return ret;
186   }
187
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();
191   }
192
193   public StyleChangedSignal StyleChangedSignal() {
194     StyleChangedSignal ret = new StyleChangedSignal(NDalicPINVOKE.StyleManager_StyleChangedSignal(swigCPtr), false);
195     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196     return ret;
197   }
198
199 }
200
201 }