2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 /// The Panes is a widget that adds a draggable bar between two contents.
23 /// When dragged this bar resizes contents' size.
25 /// <since_tizen> preview </since_tizen>
26 public class Panes : Layout
29 SmartEvent _unpressed;
32 /// Creates and initializes a new instance of the Panes class.
34 /// <param name="parent">The EvasObject to which the new Panes will be attached as a child.</param>
35 /// <since_tizen> preview </since_tizen>
36 public Panes(EvasObject parent) : base(parent)
38 _press = new SmartEvent(this, this.RealHandle, "press");
39 _unpressed = new SmartEvent(this, this.RealHandle, "unpress");
41 _press.On += (s, e) => Pressed?.Invoke(this, e);
42 _unpressed.On += (s, e) => Unpressed?.Invoke(this, e);
46 /// Pressed will be triggered when panes have been pressed (button isn't released yet).
48 /// <since_tizen> preview </since_tizen>
49 public event EventHandler Pressed;
52 /// Unpressed will be triggered when panes are released after being pressed.
54 /// <since_tizen> preview </since_tizen>
55 public event EventHandler Unpressed;
58 /// Sets or gets resize mode of a given Panes widget.
59 /// True means the left and right panes resize homogeneously.
61 /// <since_tizen> preview </since_tizen>
66 return Interop.Elementary.elm_panes_fixed_get(RealHandle);
70 Interop.Elementary.elm_panes_fixed_set(RealHandle, value);
75 /// Sets or Gets the size proportion of the Panes widget's left side.
78 /// By default it's homogeneous, i.e., both sides have the same size.If something different is required,
79 /// it can be set with this function. For example, if the left content should be displayed over 75% of the panes size,
80 /// size should be passed as 0.75. This way, the right content is resized to 25% of the panes size.
81 /// If displayed vertically, left content is displayed at the top, and right content at the bottom.
82 /// This proportion changes when the user drags the panes bar.
84 /// The value is float type and between 0.0 and 1.0 representing the size proportion of the left side.
86 /// <since_tizen> preview </since_tizen>
87 public double Proportion
91 return Interop.Elementary.elm_panes_content_left_size_get(RealHandle);
95 Interop.Elementary.elm_panes_content_left_size_set(RealHandle, value);
100 /// Sets or gets the orientation of a given Panes widget.
103 /// Use this function to change how your panes is to be disposed: vertically or horizontally.
104 /// Horizontal panes have "top" and "bottom" contents, vertical panes have "left" and "right" contents.
105 /// By default panes is in a vertical mode.
107 /// <since_tizen> preview </since_tizen>
108 public bool IsHorizontal
112 return Interop.Elementary.elm_panes_horizontal_get(RealHandle);
116 Interop.Elementary.elm_panes_horizontal_set(RealHandle, value);
121 /// Sets or gets the absolute minimum size of panes widget's left side.
122 /// If displayed vertically, left content is displayed at top.
123 /// value representing minimum size of left side in pixels.
125 /// <since_tizen> preview </since_tizen>
126 public int LeftMinimumSize
130 return Interop.Elementary.elm_panes_content_left_min_size_get(RealHandle);
134 Interop.Elementary.elm_panes_content_left_min_size_set(RealHandle, value);
139 /// Sets or gets the relative minimum size of panes widget's left side.
140 /// proportion of minimum size of left side.
141 /// If displayed vertically, left content is displayed at top.
142 /// value between 0.0 and 1.0 representing size proportion of minimum size of left side.
144 /// <since_tizen> preview </since_tizen>
145 public double LeftMinimumRelativeSize
149 return Interop.Elementary.elm_panes_content_left_min_relative_size_get(RealHandle);
153 Interop.Elementary.elm_panes_content_left_min_relative_size_set(RealHandle, value);
158 /// Sets or gets the absolute minimum size of panes widget's right side.
159 /// If displayed vertically, right content is displayed at top.
160 /// value representing minimum size of right side in pixels.
162 /// <since_tizen> preview </since_tizen>
163 public int RightMinimumSize
167 return Interop.Elementary.elm_panes_content_right_min_size_get(RealHandle);
171 Interop.Elementary.elm_panes_content_right_min_size_set(RealHandle, value);
176 /// Sets or gets the relative minimum size of panes widget's right side.
177 /// proportion of minimum size of right side.
178 /// If displayed vertically, right content is displayed at top.
179 /// value between 0.0 and 1.0 representing size proportion of minimum size of right side.
181 /// <since_tizen> preview </since_tizen>
182 public double RightMinimumRelativeSize
186 return Interop.Elementary.elm_panes_content_right_min_relative_size_get(RealHandle);
190 Interop.Elementary.elm_panes_content_right_min_relative_size_set(RealHandle, value);
195 /// Creates a widget handle.
197 /// <param name="parent">Parent EvasObject</param>
198 /// <returns>Handle IntPtr</returns>
199 /// <since_tizen> preview </since_tizen>
200 protected override IntPtr CreateHandle(EvasObject parent)
202 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
203 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
205 RealHandle = Interop.Elementary.elm_panes_add(handle);
206 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);