3a223aeffc6215d15110f1eaec8c1419817dfdb4
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Panes.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace ElmSharp
20 {
21     public class Panes : Layout
22     {
23         SmartEvent _press;
24         SmartEvent _unpressed;
25         public Panes(EvasObject parent) : base(parent)
26         {
27             _press = new SmartEvent(this, this.RealHandle, "press");
28             _unpressed = new SmartEvent(this, this.RealHandle, "unpressed");
29
30             _press.On += (s, e) => Pressed?.Invoke(this, e);
31             _unpressed.On += (s, e) => Unpressed?.Invoke(this, e);
32         }
33
34         public event EventHandler Pressed;
35         public event EventHandler Unpressed;
36         public bool IsFixed
37         {
38             get
39             {
40                 return Interop.Elementary.elm_panes_fixed_get(RealHandle);
41             }
42             set
43             {
44                 Interop.Elementary.elm_panes_fixed_set(RealHandle, value);
45             }
46         }
47
48         public double Proportion
49         {
50             get
51             {
52                 return Interop.Elementary.elm_panes_content_left_size_get(RealHandle);
53             }
54             set
55             {
56                 Interop.Elementary.elm_panes_content_left_size_set(RealHandle, value);
57             }
58         }
59
60         public bool IsHorizontal
61         {
62             get
63             {
64                 return Interop.Elementary.elm_panes_horizontal_get(RealHandle);
65             }
66             set
67             {
68                 Interop.Elementary.elm_panes_horizontal_set(RealHandle, value);
69             }
70         }
71
72         protected override IntPtr CreateHandle(EvasObject parent)
73         {
74             IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
75             Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
76
77             RealHandle = Interop.Elementary.elm_panes_add(handle);
78             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
79
80             return handle;
81         }
82     }
83 }