/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace ElmSharp { /// /// Enumeration for the selection modes of GenItem. /// /// preview public enum GenItemSelectionMode { /// /// Default select mode. /// Default, /// /// Always select mode. /// Always, /// /// No select mode. /// None, /// /// No select mode with no finger size rule. /// DisplayOnly } /// /// It inherits . /// A base class for and . /// It contains the GenItem class and data to display the data. /// /// preview public abstract class GenItem : ItemObject { internal Interop.Elementary.Elm_Tooltip_Item_Content_Cb _tooltipCb; GetTooltipContentDelegate _tooltipContentDelegate = null; /// /// The delegate returning the tooltip contents. /// /// preview public delegate EvasObject GetTooltipContentDelegate(); internal GenItem(object data, GenItemClass itemClass) : base(IntPtr.Zero) { Data = data; ItemClass = itemClass; _tooltipCb = (d, obj, tooltip, item) => { return TooltipContentDelegate(); }; } internal GenItem(object data, GenItemClass itemClass, EvasObject parent) : base(IntPtr.Zero, parent) { Data = data; ItemClass = itemClass; _tooltipCb = (d, obj, tooltip, item) => { return TooltipContentDelegate(); }; } /// /// Gets the item class that defines how to display data. It returns type. /// /// preview public GenItemClass ItemClass { get; protected set; } /// /// Sets or gets the tooltip content delegate. /// /// preview public GetTooltipContentDelegate TooltipContentDelegate { get { return _tooltipContentDelegate; } set { _tooltipContentDelegate = value; UpdateTooltipDelegate(); } } /// /// It's an abstract property. /// /// preview public abstract GenItemSelectionMode SelectionMode { get; set; } /// /// Sets or gets the cursor to be shown when the mouse is over the gengrid item. /// /// preview public abstract string Cursor { get; set; } /// /// Sets or gets the style for this item cursor. /// /// preview public abstract string CursorStyle { get; set; } /// /// Sets or gets the cursor engine only usage for this item cursor. /// /// preview public abstract bool IsUseEngineCursor { get; set; } /// /// Gets the item data that is added through calling , , or methods. /// /// preview public object Data { get; protected set; } /// /// It's an abstract property. It's implemented by and . /// /// preview public abstract bool IsSelected { get; set; } /// /// It's an abstract property. It's implemented by and . /// /// preview public abstract string TooltipStyle { get; set; } /// /// Sets the tooltip text. /// /// The text to set. /// preview public abstract void SetTooltipText(string tooltip); /// /// Unsets the tooltip. /// /// preview public abstract void UnsetTooltip(); /// /// It's an abstract method. It's implemented by and . /// /// preview public abstract void Update(); /// /// The override method for deleting the item class and item data. It's called when the item is deleted. /// /// preview protected override void OnInvalidate() { ItemClass?.SendItemDeleted(Data); Data = null; ItemClass = null; } /// /// Abstract method for updating the tooltip content. /// /// preview protected abstract void UpdateTooltipDelegate(); } }