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 Button is a widget that works as a clickable input element to trigger events.
24 /// <since_tizen> preview </since_tizen>
25 [Obsolete("This has been deprecated in API12")]
26 public class Button : Layout
28 private SmartEvent _clicked;
29 private SmartEvent _repeated;
30 private SmartEvent _pressed;
31 private SmartEvent _released;
34 /// Creates and initializes a new instance of the Button class.
36 /// <param name="parent">
37 /// The EvasObject to which the new Button will be attached as a child.
39 /// <since_tizen> preview </since_tizen>
40 [Obsolete("This has been deprecated in API12")]
41 public Button(EvasObject parent) : base(parent)
43 _clicked = new SmartEvent(this, this.RealHandle, "clicked");
44 _repeated = new SmartEvent(this, this.RealHandle, "repeated");
45 _pressed = new SmartEvent(this, this.RealHandle, "pressed");
46 _released = new SmartEvent(this, this.RealHandle, "unpressed");
48 _clicked.On += (sender, e) =>
50 Clicked?.Invoke(this, EventArgs.Empty);
53 _repeated.On += (sender, e) =>
55 Repeated?.Invoke(this, EventArgs.Empty);
58 _pressed.On += (sender, e) =>
60 Pressed?.Invoke(this, EventArgs.Empty);
63 _released.On += (sender, e) =>
65 Released?.Invoke(this, EventArgs.Empty);
70 /// Clicked will be triggered when the button is clicked.
72 /// <since_tizen> preview </since_tizen>
73 [Obsolete("This has been deprecated in API12")]
74 public event EventHandler Clicked;
77 /// Repeated will be triggered when the button is pressed without releasing it.
79 /// <since_tizen> preview </since_tizen>
80 [Obsolete("This has been deprecated in API12")]
81 public event EventHandler Repeated;
84 /// Pressed will be triggered when the button is pressed.
86 /// <since_tizen> preview </since_tizen>
87 [Obsolete("This has been deprecated in API12")]
88 public event EventHandler Pressed;
91 /// Released will be triggered when the button is released after being pressed.
93 /// <since_tizen> preview </since_tizen>
94 [Obsolete("This has been deprecated in API12")]
95 public event EventHandler Released;
98 /// Sets or gets the autorepeat feature of a given Bbutton.
101 /// Autorepeat feature means the autorepeat event is generated when the button is kept pressed.
102 /// When set to false, no autorepeat is performed and the buttons will trigger the Clicked event when they are clicked.
103 /// When set to true, keeping a button pressed continuously will trigger the Repeated event until the button is released.
104 /// The time it takes until it starts triggering, repeated is given by AutoRepeatInitialTime,
105 /// and the time between each new emission is given by AutoRepeatGapTimeout.
107 /// <since_tizen> preview </since_tizen>
108 [Obsolete("This has been deprecated in API12")]
109 public bool AutoRepeat
113 return Interop.Elementary.elm_button_autorepeat_get(RealHandle);
117 Interop.Elementary.elm_button_autorepeat_set(RealHandle, value);
122 /// Sets or gets the initial timeout before the Repeat event is generated.
124 /// <since_tizen> preview </since_tizen>
125 [Obsolete("This has been deprecated in API12")]
126 public double AutoRepeatInitialTime
130 return Interop.Elementary.elm_button_autorepeat_initial_timeout_get(RealHandle);
134 Interop.Elementary.elm_button_autorepeat_initial_timeout_set(RealHandle, value);
139 /// Sets or gets the interval between each generated Repeat event.
141 /// <since_tizen> preview </since_tizen>
142 [Obsolete("This has been deprecated in API12")]
143 public double AutoRepeatGapTimeout
147 return Interop.Elementary.elm_button_autorepeat_gap_timeout_get(RealHandle);
151 Interop.Elementary.elm_button_autorepeat_gap_timeout_set(RealHandle, value);
156 /// Deletes the object Color class.
158 /// <param name="part">The Color class to be deleted.</param>
159 /// <since_tizen> preview </since_tizen>
160 [Obsolete("DeleteColorClass is obsolete, please use EdjeObject.DeleteColorClass(string)")]
161 public void DeleteColorClass(string part)
163 Interop.Elementary.edje_object_color_class_del(Handle, part);
167 /// Sets or gets the BackgroundColor of a given button in the normal and pressed status.
169 /// <since_tizen> preview </since_tizen>
170 [Obsolete("This has been deprecated in API12")]
171 public override Color BackgroundColor
177 EdjeObject.DeleteColorClass("button/bg");
178 EdjeObject.DeleteColorClass("button/bg_pressed");
179 EdjeObject.DeleteColorClass("button/bg_disabled");
183 SetPartColor("bg", value);
184 SetPartColor("bg_pressed", value);
185 SetPartColor("bg_disabled", value);
187 _backgroundColor = value;
192 /// Creates a widget handle.
194 /// <param name="parent">Parent EvasObject.</param>
195 /// <returns>Handle IntPtr.</returns>
196 /// <since_tizen> preview </since_tizen>
197 [Obsolete("This has been deprecated in API12")]
198 protected override IntPtr CreateHandle(EvasObject parent)
200 return Interop.Elementary.elm_button_add(parent.Handle);