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 /// Enumeration for the PanelDirection types.
24 /// <since_tizen> preview </since_tizen>
25 public enum PanelDirection
46 /// The Panel is a container that can contain subobjects.
48 /// <since_tizen> preview </since_tizen>
49 public class Panel : Layout
55 /// Creates and initializes a new instance of the Panel class.
57 /// <param name="parent">The EvasObject to which the new panel will be attached as a child.</param>
58 /// <since_tizen> preview </since_tizen>
59 public Panel(EvasObject parent) : base(parent)
61 _toggled = new SmartEvent(this, this.RealHandle, "toggled");
62 _scrolled = new SmartEvent(this, this.RealHandle, "scroll");
64 _toggled.On += (s, e) => Toggled?.Invoke(this, EventArgs.Empty);
65 _scrolled.On += (s, e) => Scrolled?.Invoke(this, EventArgs.Empty);
69 /// Sets or gets the hidden status of a given Panel widget.
71 /// <since_tizen> preview </since_tizen>
76 return !Interop.Elementary.elm_panel_hidden_get(RealHandle);
80 Interop.Elementary.elm_panel_hidden_set(RealHandle, !value);
85 /// Sets or gets the direction of a given Panel widget.
87 /// <since_tizen> preview </since_tizen>
88 public PanelDirection Direction
92 return (PanelDirection)Interop.Elementary.elm_panel_orient_get(RealHandle);
96 Interop.Elementary.elm_panel_orient_set(RealHandle, (int)value);
101 /// Toggled will be triggered when the panel is toggled.
103 /// <since_tizen> preview </since_tizen>
104 public event EventHandler Toggled;
107 /// Scrolled will be triggered when the panel has been scrolled. This event is emitted only when the panel is scrollable
109 /// <since_tizen> preview </since_tizen>
110 public event EventHandler Scrolled;
113 /// Enable or disable scrolling in the panel.
115 /// <param name="enable">
116 /// Bool value can be false or true.
118 /// <since_tizen> preview </since_tizen>
119 public void SetScrollable(bool enable)
121 Interop.Elementary.elm_panel_scrollable_set(RealHandle, enable);
125 /// Sets the scroll size of the panel.
127 /// <param name="ratio">
128 /// The size of the scroll area.
130 /// <since_tizen> preview </since_tizen>
131 public void SetScrollableArea(double ratio)
133 Interop.Elementary.elm_panel_scrollable_content_size_set(RealHandle, ratio);
137 /// Toggles the hidden state of the panel.
139 /// <since_tizen> preview </since_tizen>
142 Interop.Elementary.elm_panel_toggle(RealHandle);
146 /// Creates a widget handle.
148 /// <param name="parent">Parent EvasObject.</param>
149 /// <returns>Handle IntPtr.</returns>
150 /// <since_tizen> preview </since_tizen>
151 protected override IntPtr CreateHandle(EvasObject parent)
153 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
154 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
156 RealHandle = Interop.Elementary.elm_panel_add(handle);
157 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);