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.
18 using System.ComponentModel;
23 /// Enumeration for the selection mode of the toolbar.
25 /// <since_tizen> preview </since_tizen>
26 [Obsolete("This has been deprecated in API12")]
27 public enum ToolbarSelectionMode
30 /// Default select mode.
35 /// Always select mode.
45 /// No select mode with no finger size rule.
51 /// Enumeration for setting the toolbar items display behavior, it can be scrollable, can show a menu with exceeding items, or simply hide them.
53 /// <since_tizen> preview </since_tizen>
54 [Obsolete("This has been deprecated in API12")]
55 public enum ToolbarShrinkMode
58 /// Sets the minimum toolbar size to fit all the items.
63 /// Hides exceeding items.
68 /// Allows accessing exceeding items through a scroller.
73 /// Inserts a button to popup a menu with exceeding items.
78 /// Expands all items according to the size of the toolbar.
84 /// Enumeration for the icon lookup order of the toolbar.
86 /// <since_tizen> preview </since_tizen>
87 [Obsolete("This has been deprecated in API12")]
88 public enum ToolbarIconLookupOrder
91 /// Icon lookup order: freedesktop, theme.
96 /// Icon lookup order: theme, freedesktop.
101 /// Icon lookup order: freedesktop.
106 /// Icon lookup order: theme.
112 /// Event arguments for events of <see cref="ToolbarItem"/>.
115 /// Inherits EventArgs.
117 /// <since_tizen> preview </since_tizen>
118 [Obsolete("This has been deprecated in API12")]
119 public class ToolbarItemEventArgs : EventArgs
122 /// Gets the ToolbarItem.
124 /// <since_tizen> preview </since_tizen>
125 [Obsolete("This has been deprecated in API12")]
126 public ToolbarItem Item { get; private set; }
128 internal static ToolbarItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
130 ToolbarItem item = ItemObject.GetItemByHandle(info) as ToolbarItem;
131 return new ToolbarItemEventArgs { Item = item };
136 /// The Toolbar is a widget that displays a list of items inside a box.
138 /// <since_tizen> preview </since_tizen>
139 [Obsolete("This has been deprecated in API12")]
140 public class Toolbar : Widget
142 SmartEvent<ToolbarItemEventArgs> _clicked;
143 SmartEvent<ToolbarItemEventArgs> _selected;
144 SmartEvent<ToolbarItemEventArgs> _longpressed;
147 /// Creates and initializes a new instance of the Toolbar class.
149 /// <param name="parent">
150 /// A EvasObject to which the new Table instance will be attached.
152 /// <since_tizen> preview </since_tizen>
153 [Obsolete("This has been deprecated in API12")]
154 public Toolbar(EvasObject parent) : base(parent)
156 _selected = new SmartEvent<ToolbarItemEventArgs>(this, this.RealHandle, "selected", ToolbarItemEventArgs.CreateFromSmartEvent);
157 _selected.On += (s, e) =>
161 Selected?.Invoke(this, e);
162 e.Item.SendSelected();
165 _longpressed = new SmartEvent<ToolbarItemEventArgs>(this, this.RealHandle, "longpressed", ToolbarItemEventArgs.CreateFromSmartEvent);
166 _longpressed.On += (s, e) =>
168 e.Item?.SendLongPressed();
170 _clicked = new SmartEvent<ToolbarItemEventArgs>(this, this.RealHandle, "clicked", ToolbarItemEventArgs.CreateFromSmartEvent);
171 _clicked.On += (s, e) =>
173 e.Item?.SendClicked();
178 /// Selected will be triggered when toolbar has been selected.
180 /// <since_tizen> preview </since_tizen>
181 [Obsolete("This has been deprecated in API12")]
182 public event EventHandler<ToolbarItemEventArgs> Selected;
185 /// Sets or gets whether the layout of this toolbar is homogeneous.
187 /// <remarks>True for homogeneous, False for no homogeneous.</remarks>
188 /// <since_tizen> preview </since_tizen>
189 [Obsolete("This has been deprecated in API12")]
190 public bool Homogeneous
194 return Interop.Elementary.elm_toolbar_homogeneous_get(RealHandle);
198 Interop.Elementary.elm_toolbar_homogeneous_set(RealHandle, value);
203 /// Sets or gets the slection mode of a given Toolbar widget.
205 /// <since_tizen> preview </since_tizen>
206 [Obsolete("This has been deprecated in API12")]
207 public ToolbarSelectionMode SelectionMode
211 return (ToolbarSelectionMode)Interop.Elementary.elm_toolbar_select_mode_get(RealHandle);
215 Interop.Elementary.elm_toolbar_select_mode_set(RealHandle, (int)value);
220 /// Sets or gets the shrink mode of a given Toolbar widget.
222 /// <since_tizen> preview </since_tizen>
223 [Obsolete("This has been deprecated in API12")]
224 public ToolbarShrinkMode ShrinkMode
228 return (ToolbarShrinkMode)Interop.Elementary.elm_toolbar_shrink_mode_get(RealHandle);
232 Interop.Elementary.elm_toolbar_shrink_mode_set(RealHandle, (int)value);
237 /// Sets or gets the toolbar's current orientation.
239 /// <since_tizen> preview </since_tizen>
240 [Obsolete("This has been deprecated in API12")]
241 [EditorBrowsable(EditorBrowsableState.Never)]
242 public bool IsHorizontal
246 return Interop.Elementary.elm_toolbar_horizontal_get(RealHandle);
250 Interop.Elementary.elm_toolbar_horizontal_set(RealHandle, value);
255 /// Sets or gets the icon lookup order, for toolbar items' icons.
256 /// The default lookup order is ToolbarIocnLookupOrder.ThemeFreedesktop.
257 /// Icons added before calling this function will not be affected.
259 /// <since_tizen> preview </since_tizen>
260 [Obsolete("This has been deprecated in API12")]
261 public ToolbarIconLookupOrder IconLookupOrder
265 return (ToolbarIconLookupOrder)Interop.Elementary.elm_toolbar_icon_order_lookup_get(RealHandle);
269 Interop.Elementary.elm_toolbar_icon_order_lookup_set(RealHandle, (int)value);
274 /// Sets or gets the icon size of a given toolbar widget.
275 /// Default value is 32 pixels, to be used by toolbar items.
277 /// <since_tizen> preview </since_tizen>
278 [Obsolete("This has been deprecated in API12")]
283 return Interop.Elementary.elm_toolbar_icon_size_get(RealHandle);
287 Interop.Elementary.elm_toolbar_icon_size_set(RealHandle, value);
292 /// Gets the number of items in a Toolbar widget.
294 /// <since_tizen> preview </since_tizen>
295 [Obsolete("This has been deprecated in API12")]
296 public int ItemsCount
300 return Interop.Elementary.elm_toolbar_items_count(RealHandle);
305 /// Sets or gets the alignment of the items.
307 /// <remarks>The toolbar items alignment, a float between 0.0 and 1.0.</remarks>
308 /// <since_tizen> preview </since_tizen>
309 [Obsolete("This has been deprecated in API12")]
310 public double ItemAlignment
314 return Interop.Elementary.elm_toolbar_align_get(RealHandle);
318 Interop.Elementary.elm_toolbar_align_set(RealHandle, value);
323 /// Sets or gets the item's transverse expansion of a given Toolbar widget.
326 /// The transverse expansion of the item, true for on and false for off.
327 /// By default it's false.
329 /// <since_tizen> preview </since_tizen>
330 [Obsolete("This has been deprecated in API12")]
331 public bool TransverseExpansion
335 return Interop.Elementary.elm_toolbar_transverse_expanded_get(RealHandle);
339 Interop.Elementary.elm_toolbar_transverse_expanded_set(RealHandle, value);
344 /// Appends the ToolbarItem, which just contains label to the toolbar.
346 /// <param name="label">The label of the item.</param>
347 /// <returns>The new ToolbarItem which is appended to the toolbar.</returns>
348 /// <seealso cref="Append(string, string)"/>
349 /// <seealso cref="Prepend(string)"/>
350 /// <since_tizen> preview </since_tizen>
351 [Obsolete("This has been deprecated in API12")]
352 public ToolbarItem Append(string label)
354 return Append(label, null);
358 /// Appends the ToolbarItem, which contains label and icon to the toolbar.
360 /// <param name="label">The label of the item.</param>
361 /// <param name="icon">A string with the icon name or the absolute path of an image file.</param>
362 /// <returns>The new ToolbarItem which is appended to the toolbar.</returns>
363 /// <seealso cref="Append(string)"/>
364 /// <seealso cref="Prepend(string)"/>
365 /// <seealso cref="Prepend(string, string)"/>
366 /// <since_tizen> preview </since_tizen>
367 [Obsolete("This has been deprecated in API12")]
368 public ToolbarItem Append(string label, string icon)
370 ToolbarItem item = new ToolbarItem(label, icon, this);
371 item.Handle = Interop.Elementary.elm_toolbar_item_append(RealHandle, icon, label, null, (IntPtr)item.Id);
376 /// Prepends the ToolbarItem, which just contains label to the toolbar.
378 /// <param name="label">The label of the item.</param>
379 /// <returns>The new ToolbarItem which is prepended to the toolbar.</returns>
380 /// <seealso cref="Append(string)"/>
381 /// <seealso cref="Append(string, string)"/>
382 /// <seealso cref="Prepend(string, string)"/>
383 /// <since_tizen> preview </since_tizen>
384 [Obsolete("This has been deprecated in API12")]
385 public ToolbarItem Prepend(string label)
387 return Prepend(label, null);
391 /// Prepends the ToolbarItem, which contains label and icon to the toolbar.
393 /// <param name="label">The label of the item.</param>
394 /// <param name="icon">A string with the icon name or the absolute path of an image file.</param>
395 /// <returns>The new <see cref="ToolbarItem"/> which is prepended to the toolbar.</returns>
396 /// <seealso cref="Append(string)"/>
397 /// <seealso cref="Append(string, string)"/>
398 /// <seealso cref="Prepend(string)"/>
399 /// <since_tizen> preview </since_tizen>
400 [Obsolete("This has been deprecated in API12")]
401 public ToolbarItem Prepend(string label, string icon)
403 ToolbarItem item = new ToolbarItem(label, icon, this);
404 item.Handle = Interop.Elementary.elm_toolbar_item_prepend(RealHandle, icon, label, null, (IntPtr)item.Id);
409 /// Inserts a new item which just contains label into the toolbar object before item <paramref name="before"/>.
411 /// <param name="before">The toolbar item to insert before.</param>
412 /// <param name="label">The label of the item.</param>
413 /// <returns>The new <see cref="ToolbarItem"/> which is inserted into the toolbar.</returns>
414 /// <seealso cref="InsertBefore(ToolbarItem, string, string)"/>
415 /// <since_tizen> preview </since_tizen>
416 [Obsolete("This has been deprecated in API12")]
417 public ToolbarItem InsertBefore(ToolbarItem before, string label)
419 return InsertBefore(before, label, string.Empty);
423 /// Inserts a new item which contains label and icon into the toolbar object before item <paramref name="before"/>.
425 /// <param name="before">The toolbar item to insert before.</param>
426 /// <param name="label">The label of the item.</param>
427 /// <param name="icon">A string with the icon name or the absolute path of an image file.</param>
428 /// <returns>The new <see cref="ToolbarItem"/> which is inserted into the toolbar.</returns>
429 /// <seealso cref="InsertBefore(ToolbarItem, string)"/>
430 /// <since_tizen> preview </since_tizen>
431 [Obsolete("This has been deprecated in API12")]
432 public ToolbarItem InsertBefore(ToolbarItem before, string label, string icon)
434 ToolbarItem item = new ToolbarItem(label, icon, this);
435 item.Handle = Interop.Elementary.elm_toolbar_item_insert_before(RealHandle, before, icon, label, null, (IntPtr)item.Id);
440 /// Inserts a new item which contains label and icon into the toolbar object after item <paramref name="after"/>.
442 /// <param name="after">The toolbar item to insert after.</param>
443 /// <param name="label">The label of the item.</param>
444 /// <param name="icon">A string with the icon name or the absolute path of an image file.</param>
445 /// <returns>The new <see cref="ToolbarItem"/> which is inserted into the toolbar.</returns>
446 /// <since_tizen> preview </since_tizen>
447 [Obsolete("This has been deprecated in API12")]
448 public ToolbarItem InsertAfter(ToolbarItem after, string label, string icon)
450 ToolbarItem item = new ToolbarItem(label, icon, this);
451 item.Handle = Interop.Elementary.elm_toolbar_item_insert_after(RealHandle, after, icon, label, null, (IntPtr)item.Id);
456 /// Finds the item with that label in the toolbar.
458 /// <param name="label">The label of the item.</param>
459 /// <returns>The <see cref="ToolbarItem"/> into the toolbar.</returns>
460 /// <since_tizen> preview </since_tizen>
461 [Obsolete("This has been deprecated in API12")]
462 public ToolbarItem FindItemByLabel(string label)
464 IntPtr handle = Interop.Elementary.elm_toolbar_item_find_by_label(RealHandle, label);
465 return ItemObject.GetItemByHandle(handle) as ToolbarItem;
469 /// Gets the selected ToolbarItemItem of the toolbar.
471 /// <since_tizen> preview </since_tizen>
472 [Obsolete("This has been deprecated in API12")]
473 public ToolbarItem SelectedItem
477 IntPtr handle = Interop.Elementary.elm_toolbar_selected_item_get(RealHandle);
478 return ItemObject.GetItemByHandle(handle) as ToolbarItem;
483 /// Gets the first ToolbarItemItem of the toolbar.
485 /// <since_tizen> preview </since_tizen>
486 [Obsolete("This has been deprecated in API12")]
487 public ToolbarItem FirstItem
491 IntPtr handle = Interop.Elementary.elm_toolbar_first_item_get(RealHandle);
492 return ItemObject.GetItemByHandle(handle) as ToolbarItem;
497 /// Gets the last ToolbarItemItem of the toolbar.
499 /// <since_tizen> preview </since_tizen>
500 [Obsolete("This has been deprecated in API12")]
501 public ToolbarItem LastItem
505 IntPtr handle = Interop.Elementary.elm_toolbar_last_item_get(RealHandle);
506 return ItemObject.GetItemByHandle(handle) as ToolbarItem;
511 /// Creates a widget handle.
513 /// <param name="parent">Parent EvasObject.</param>
514 /// <returns>Handle IntPtr.</returns>
515 /// <since_tizen> preview </since_tizen>
516 [Obsolete("This has been deprecated in API12")]
517 protected override IntPtr CreateHandle(EvasObject parent)
519 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
520 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
522 RealHandle = Interop.Elementary.elm_toolbar_add(handle);
523 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);