Refactor Lifecycles
[platform/core/csapi/tizenfx.git] / Tizen.Applications / Tizen.UI / Window.cs
1 /// Copyright 2016 by Samsung Electronics, Inc.,
2 ///
3 /// This software is the confidential and proprietary information
4 /// of Samsung Electronics, Inc. ("Confidential Information"). You
5 /// shall not disclose such Confidential Information and shall use
6 /// it only in accordance with the terms of the license agreement
7 /// you entered into with Samsung.
8
9
10 using System;
11
12 namespace Tizen.UI
13 {
14     public class Window : IDisposable
15     {
16         private IntPtr _native_window = IntPtr.Zero;
17
18         public bool Visible
19         {
20             get
21             {
22                 return _native_window != IntPtr.Zero ? Interop.Window.evas_object_visible_get(_native_window) : false;
23             }
24         }
25         public Window()
26         {
27             _native_window = Interop.Window.elm_win_add(IntPtr.Zero, "Window", 0);
28         }
29
30         ~Window()
31         {
32             Dispose();
33         }
34
35         public void Show()
36         {
37             Interop.Window.evas_object_show(_native_window);
38         }
39
40         public void Hide()
41         {
42             Interop.Window.evas_object_hide(_native_window);
43         }
44
45         public void Active()
46         {
47             Interop.Window.elm_win_activate(_native_window);
48         }
49
50         public void InActive()
51         {
52             Interop.Window.elm_win_lower(_native_window);
53         }
54
55         public void Dispose()
56         {
57             if (_native_window != IntPtr.Zero)
58             {
59                 Interop.Window.evas_object_unref(_native_window);
60                 _native_window = IntPtr.Zero;
61             }
62         }
63     }
64 }