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 selection modes of GenItem.
24 /// <since_tizen> preview </since_tizen>
25 public enum GenItemSelectionMode
28 /// Default select mode.
33 /// Always select mode.
43 /// No select mode with no finger size rule.
49 /// It inherits <see cref="ItemObject"/>.
50 /// A base class for <see cref="GenGridItem"/> and <see cref="GenListItem"/>.
51 /// It contains the GenItem class and data to display the data.
53 /// <since_tizen> preview </since_tizen>
54 public abstract class GenItem : ItemObject
56 internal Interop.Elementary.Elm_Tooltip_Item_Content_Cb _tooltipCb;
57 GetTooltipContentDelegate _tooltipContentDelegate = null;
60 /// The delegate returning the tooltip contents.
62 /// <since_tizen> preview </since_tizen>
63 public delegate EvasObject GetTooltipContentDelegate();
65 internal GenItem(object data, GenItemClass itemClass) : base(IntPtr.Zero)
68 ItemClass = itemClass;
69 _tooltipCb = (d, obj, tooltip, item) => { return TooltipContentDelegate(); };
72 internal GenItem(object data, GenItemClass itemClass, EvasObject parent) : base(IntPtr.Zero, parent)
75 ItemClass = itemClass;
76 _tooltipCb = (d, obj, tooltip, item) => { return TooltipContentDelegate(); };
80 /// Gets the item class that defines how to display data. It returns <see cref="GenItemClass"/> type.
82 /// <since_tizen> preview </since_tizen>
83 public GenItemClass ItemClass { get; protected set; }
86 /// Sets or gets the tooltip content delegate.
88 /// <since_tizen> preview </since_tizen>
89 public GetTooltipContentDelegate TooltipContentDelegate
93 return _tooltipContentDelegate;
97 _tooltipContentDelegate = value;
98 UpdateTooltipDelegate();
103 /// It's an abstract property.
105 /// <since_tizen> preview </since_tizen>
106 public abstract GenItemSelectionMode SelectionMode { get; set; }
109 /// Sets or gets the cursor to be shown when the mouse is over the gengrid item.
111 /// <since_tizen> preview </since_tizen>
112 public abstract string Cursor { get; set; }
115 /// Sets or gets the style for this item cursor.
117 /// <since_tizen> preview </since_tizen>
118 public abstract string CursorStyle { get; set; }
121 /// Sets or gets the cursor engine only usage for this item cursor.
123 /// <since_tizen> preview </since_tizen>
124 public abstract bool IsUseEngineCursor { get; set; }
127 /// Gets the item data that is added through calling <see cref="GenGrid.Append(GenItemClass, object)"/>, <see cref="GenGrid.Prepend(GenItemClass, object)"/>, or <see cref="GenGrid.InsertBefore(GenItemClass, object, GenGridItem)"/> methods.
129 /// <since_tizen> preview </since_tizen>
130 public object Data { get; protected set; }
133 /// It's an abstract property. It's implemented by <see cref="GenGridItem.IsSelected"/> and <see cref="GenListItem.IsSelected"/>.
135 /// <since_tizen> preview </since_tizen>
136 public abstract bool IsSelected { get; set; }
139 /// It's an abstract property. It's implemented by <see cref="GenGridItem.TooltipStyle"/> and <see cref="GenListItem.TooltipStyle"/>.
141 /// <since_tizen> preview </since_tizen>
142 public abstract string TooltipStyle { get; set; }
145 /// Sets the tooltip text.
147 /// <param name="tooltip">The text to set.</param>
148 /// <since_tizen> preview </since_tizen>
149 public abstract void SetTooltipText(string tooltip);
152 /// Unsets the tooltip.
154 /// <since_tizen> preview </since_tizen>
155 public abstract void UnsetTooltip();
158 /// It's an abstract method. It's implemented by <see cref="GenGridItem.Update"/> and <see cref="GenListItem.Update"/>.
160 /// <since_tizen> preview </since_tizen>
161 public abstract void Update();
164 /// The override method for deleting the item class and item data. It's called when the item is deleted.
166 /// <since_tizen> preview </since_tizen>
167 protected override void OnInvalidate()
169 ItemClass?.SendItemDeleted(Data);
175 /// Abstract method for updating the tooltip content.
177 /// <since_tizen> preview </since_tizen>
178 protected abstract void UpdateTooltipDelegate();