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 public class Panes : Layout
28 SmartEvent _unpressed;
31 /// Creates and initializes a new instance of the Panes class.
33 /// <param name="parent">The EvasObject to which the new Panes will be attached as a child.</param>
34 public Panes(EvasObject parent) : base(parent)
36 _press = new SmartEvent(this, this.RealHandle, "press");
37 _unpressed = new SmartEvent(this, this.RealHandle, "unpress");
39 _press.On += (s, e) => Pressed?.Invoke(this, e);
40 _unpressed.On += (s, e) => Unpressed?.Invoke(this, e);
44 /// Pressed will be triggered when panes have been pressed (button isn't released yet).
46 public event EventHandler Pressed;
49 /// Unpressed will be triggered when panes are released after being pressed.
51 public event EventHandler Unpressed;
54 /// Sets or gets resize mode of a given Panes widget.
55 /// True means the left and right panes resize homogeneously.
61 return Interop.Elementary.elm_panes_fixed_get(RealHandle);
65 Interop.Elementary.elm_panes_fixed_set(RealHandle, value);
70 /// Sets or Gets the size proportion of the Panes widget's left side.
73 /// By default it's homogeneous, i.e., both sides have the same size.If something different is required,
74 /// it can be set with this function. For example, if the left content should be displayed over 75% of the panes size,
75 /// size should be passed as 0.75. This way, the right content is resized to 25% of the panes size.
76 /// If displayed vertically, left content is displayed at the top, and right content at the bottom.
77 /// This proportion changes when the user drags the panes bar.
79 /// The value is float type and between 0.0 and 1.0 representing the size proportion of the left side.
81 public double Proportion
85 return Interop.Elementary.elm_panes_content_left_size_get(RealHandle);
89 Interop.Elementary.elm_panes_content_left_size_set(RealHandle, value);
94 /// Sets or gets the orientation of a given Panes widget.
97 /// Use this function to change how your panes is to be disposed: vertically or horizontally.
98 /// Horizontal panes have "top" and "bottom" contents, vertical panes have "left" and "right" contents.
99 /// By default panes is in a vertical mode.
101 public bool IsHorizontal
105 return Interop.Elementary.elm_panes_horizontal_get(RealHandle);
109 Interop.Elementary.elm_panes_horizontal_set(RealHandle, value);
114 /// Sets or gets the absolute minimum size of panes widget's left side.
115 /// If displayed vertically, left content is displayed at top.
116 /// value representing minimum size of left side in pixels.
118 public int LeftMinimumSize
122 return Interop.Elementary.elm_panes_content_left_min_size_get(RealHandle);
126 Interop.Elementary.elm_panes_content_left_min_size_set(RealHandle, value);
131 /// Sets or gets the relative minimum size of panes widget's left side.
132 /// proportion of minimum size of left side.
133 /// If displayed vertically, left content is displayed at top.
134 /// value between 0.0 and 1.0 representing size proportion of minimum size of left side.
136 public double LeftMinimumRelativeSize
140 return Interop.Elementary.elm_panes_content_left_min_relative_size_get(RealHandle);
144 Interop.Elementary.elm_panes_content_left_min_relative_size_set(RealHandle, value);
149 /// Sets or gets the absolute minimum size of panes widget's right side.
150 /// If displayed vertically, right content is displayed at top.
151 /// value representing minimum size of right side in pixels.
153 public int RightMinimumSize
157 return Interop.Elementary.elm_panes_content_right_min_size_get(RealHandle);
161 Interop.Elementary.elm_panes_content_right_min_size_set(RealHandle, value);
166 /// Sets or gets the relative minimum size of panes widget's right side.
167 /// proportion of minimum size of right side.
168 /// If displayed vertically, right content is displayed at top.
169 /// value between 0.0 and 1.0 representing size proportion of minimum size of right side.
171 public double RightMinimumRelativeSize
175 return Interop.Elementary.elm_panes_content_right_min_relative_size_get(RealHandle);
179 Interop.Elementary.elm_panes_content_right_min_relative_size_set(RealHandle, value);
183 protected override IntPtr CreateHandle(EvasObject parent)
185 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
186 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
188 RealHandle = Interop.Elementary.elm_panes_add(handle);
189 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);