/* * 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 { 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 genitem class and data to display data. /// public abstract class GenItem : ItemObject { internal Interop.Elementary.Elm_Tooltip_Item_Content_Cb _tooltipCb; GetTooltipContentDelegate _tooltipContentDelegate = null; /// /// The delegate returning the tooltip contents. /// public delegate EvasObject GetTooltipContentDelegate(); internal GenItem(object data, GenItemClass itemClass) : base(IntPtr.Zero) { Data = data; ItemClass = itemClass; _tooltipCb = (d, obj, tooltip, item) => { return TooltipContentDelegate(); }; } /// /// Gets the item class that defines how to display data. It returns type. /// public GenItemClass ItemClass { get; protected set; } /// /// It's a abstract property. It's implemented by and . /// public GetTooltipContentDelegate TooltipContentDelegate { get { return _tooltipContentDelegate; } set { _tooltipContentDelegate = value; UpdateTooltipDelegate(); } } public abstract GenItemSelectionMode SelectionMode { get; set; } public abstract string Cursor { get; set; } public abstract string CursorStyle { get; set; } public abstract bool IsUseEngineCursor { get; set; } /// /// Gets item data that is added through calling , or methods. /// public object Data { get; protected set; } /// /// It's a abstract property. It's implemented by and . /// public abstract bool IsSelected { get; set; } /// /// It's a abstract property. It's implemented by and . /// public abstract string TooltipStyle { get; set; } public abstract void SetTooltipText(string tooltip); public abstract void UnsetTooltip(); /// /// It's a abstract method. It's implemented by and . /// public abstract void Update(); /// /// The override method for delete item class and item data. It's called when the item is deleting. /// protected override void OnInvalidate() { ItemClass?.SendItemDeleted(Data); Data = null; ItemClass = null; } protected abstract void UpdateTooltipDelegate(); } }