83f66a11c898d3f5248cc557c21621d75c8de142
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Window.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI
28 {
29
30     using System;
31     using System.Runtime.InteropServices;
32     
33
34     /// <summary>
35     /// The window class is used internally for drawing.<br>
36     /// A Window has an orientation and indicator properties.<br>
37     /// </summary>
38     public class Window : BaseHandle
39     {
40         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
41
42         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
43         {
44             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
45         }
46
47         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)
48         {
49             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
50         }
51
52         ~Window()
53         {
54             DisposeQueue.Instance.Add(this);
55         }
56
57         /// <summary>
58         /// To make Window instance be disposed.
59         /// </summary>
60         public override void Dispose()
61         {
62             if (!Stage.IsInstalled())
63             {
64                 DisposeQueue.Instance.Add(this);
65                 return;
66             }
67
68             lock (this)
69             {
70                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
71                 {
72                     if (swigCMemOwn)
73                     {
74                         swigCMemOwn = false;
75                         NDalicPINVOKE.delete_Window(swigCPtr);
76                     }
77                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78                 }
79                 global::System.GC.SuppressFinalize(this);
80                 base.Dispose();
81             }
82         }
83
84         /// <summary>
85         /// Sets the focus acceptable flag of an window as true.
86         /// </summary>
87         public void SetAcceptFocus(bool accept)
88         {
89             NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept);
90             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91         }
92
93         /// <summary>
94         /// Retrieves whether the window is focus acceptable or not.
95         /// </summary>
96         public bool IsFocusAcceptable()
97         {
98             return NDalicPINVOKE.IsFocusAcceptable(swigCPtr);
99             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100         }
101
102         /// <summary>
103         /// Shows the window if it is hidden.
104         /// </summary>
105         public void Show()
106         {
107             NDalicPINVOKE.Show(swigCPtr);
108             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109         }
110
111         /// <summary>
112         /// Hides the window if it is showing.
113         /// </summary>
114         public void Hide()
115         {
116             NDalicPINVOKE.Hide(swigCPtr);
117             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118         }
119
120         /// <summary>
121         /// Retrieves whether the window is visible or not.
122         /// </summary>
123         /// <returns>true, if the windoe is visible</returns>
124         public bool IsVisible()
125         {
126             bool temp = NDalicPINVOKE.IsVisible(swigCPtr);
127             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128             return temp;
129         }
130
131         public class WindowFocusChangedEventArgs : EventArgs
132         {
133             public bool FocusGained
134             {
135                 get;
136                 set;
137             }
138         }
139
140         private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback;
141         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
142         private delegate void WindowFocusChangedEventCallbackType(bool focusGained);
143         private event EventHandler<WindowFocusChangedEventArgs> _windowFocusChangedEventHandler;
144
145         public event EventHandler<WindowFocusChangedEventArgs> WindowFocusChanged
146         {
147             add
148             {
149                 if (_windowFocusChangedEventHandler == null)
150                 {
151                     _windowFocusChangedEventCallback = OnWindowFocusedChanged;
152                     WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback);
153                 }
154
155                 _windowFocusChangedEventHandler += value;
156             }
157             remove
158             {
159                 _windowFocusChangedEventHandler -= value;
160
161                 if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false)
162                 {
163                     WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback);
164                 }
165             }
166         }
167
168         private void OnWindowFocusedChanged(bool focusGained)
169         {
170             WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs();
171
172             e.FocusGained = focusGained;
173
174             if (_windowFocusChangedEventHandler != null)
175             {
176                 _windowFocusChangedEventHandler(this, e);
177             }
178         }
179
180         public WindowFocusSignalType WindowFocusChangedSignal()
181         {
182             WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false);
183             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184             return ret;
185         }
186
187
188
189         /// <summary>
190         /// Creates an initialized handle to a new Window.
191         /// </summary>
192         /// <param name="windowPosition">The position and size of the Window</param>
193         /// <param name="name">The Window title</param>
194         /// <param name="isTransparent">Whether Window is transparent</param>
195         public Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true)
196         {
197             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198
199         }
200
201         /// <summary>
202         /// Creates an initialized handle to a new Window.
203         /// </summary>
204         /// <param name="windowPosition">The position and size of the Window</param>
205         /// <param name="name">The Window title</param>
206         public Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true)
207         {
208             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209
210         }
211
212         /// <summary>
213         /// Creates an initialized handle to a new Window.
214         /// </summary>
215         /// <param name="windowPosition">The position and size of the Window</param>
216         /// <param name="name">The Window title</param>
217         /// <param name="className">The Window class name</param>
218         /// <param name="isTransparent">Whether Window is transparent</param>
219         public Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true)
220         {
221             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
222
223         }
224
225         /// <summary>
226         /// Creates an initialized handle to a new Window.
227         /// </summary>
228         /// <param name="windowPosition">The position and size of the Window</param>
229         /// <param name="name">The Window title</param>
230         /// <param name="className">The Window class name</param>
231         public Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true)
232         {
233             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234
235         }
236         internal Window(Window handle) : this(NDalicPINVOKE.new_Window__SWIG_1(Window.getCPtr(handle)), true)
237         {
238             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
239         }
240
241         internal Window Assign(Window rhs)
242         {
243             Window ret = new Window(NDalicPINVOKE.Window_Assign(swigCPtr, Window.getCPtr(rhs)), false);
244             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245             return ret;
246         }
247
248         /// <summary>
249         /// This sets whether the indicator bar should be shown or not.
250         /// </summary>
251         /// <param name="visibleMode">Visible mode for indicator bar, Visible in default</param>
252         internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode)
253         {
254             NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode);
255             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256         }
257
258         /// <summary>
259         /// This sets the opacity mode of indicator bar.
260         /// </summary>
261         /// <param name="opacity">The opacity mode</param>
262         internal void SetIndicatorBgOpacity(Window.IndicatorBgOpacity opacity)
263         {
264             NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity);
265             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266         }
267
268         /// <summary>
269         /// This sets the orientation of indicator bar.<br>
270         /// It does not implicitly show the indicator if it is currently hidden.<br>
271         /// </summary>
272         /// <param name="orientation">The orientation</param>
273         internal void RotateIndicator(Window.WindowOrientation orientation)
274         {
275             NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation);
276             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277         }
278
279         internal void SetClass(string name, string klass)
280         {
281             NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass);
282             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283         }
284
285         /// <summary>
286         /// Raises window to the top of Window stack.
287         /// </summary>
288         public void Raise()
289         {
290             NDalicPINVOKE.Window_Raise(swigCPtr);
291             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292         }
293
294         /// <summary>
295         /// Lowers window to the bottom of Window stack.
296         /// </summary>
297         public void Lower()
298         {
299             NDalicPINVOKE.Window_Lower(swigCPtr);
300             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301         }
302
303         /// <summary>
304         /// Activates window to the top of Window stack even it is iconified.
305         /// </summary>
306         public void Activate()
307         {
308             NDalicPINVOKE.Window_Activate(swigCPtr);
309             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310         }
311
312         internal void AddAvailableOrientation(Window.WindowOrientation orientation)
313         {
314             NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation);
315             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316         }
317
318         internal void RemoveAvailableOrientation(Window.WindowOrientation orientation)
319         {
320             NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation);
321             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322         }
323
324         internal void SetPreferredOrientation(Window.WindowOrientation orientation)
325         {
326             NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation);
327             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
328         }
329
330         internal Window.WindowOrientation GetPreferredOrientation()
331         {
332             Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr);
333             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334             return ret;
335         }
336
337         internal DragAndDropDetector GetDragAndDropDetector()
338         {
339             DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true);
340             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
341             return ret;
342         }
343
344         internal Any GetNativeHandle()
345         {
346             Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true);
347             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
348             return ret;
349         }
350
351         /// <summary>
352         /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
353         /// </summary>
354         public enum WindowOrientation
355         {
356             Portrait = 0,
357             Landscape = 90,
358             PortraitInverse = 180,
359             LandscapeInverse = 270
360         }
361
362         /// <summary>
363         /// Enumeration for opacity of the indicator.
364         /// </summary>
365         internal enum IndicatorBgOpacity
366         {
367             Opaque = 100,
368             Translucent = 50,
369             Transparent = 0
370         }
371
372         /// <summary>
373         /// Enumeration for visible mode of the indicator.
374         /// </summary>
375         internal enum IndicatorVisibleMode
376         {
377             Invisible = 0,
378             Visible = 1,
379             Auto = 2
380         }
381
382     }
383
384 }