using System;
using System.Drawing;
using System.Windows.Forms;
using DevComponents.DotNetBar.SuperGrid.Style;
namespace DevComponents.DotNetBar.SuperGrid
{
    ///
    /// IGridCellEditControl
    ///
    public interface IGridCellEditControl
    {
        #region Properties
        #region CanInterrupt
        ///
        /// Specifies whether the Grid can automatically interrupt the
        /// current NonModal cell edit operation when the mouse leaves the cell.
        /// 
        /// This is utilized in cases, such as the ButtonX editor, where multilevel
        /// controls may be involved. In the ButtonX case this specifically enables
        /// the mouse to to leave the main cell window and not be interrupted by the
        /// grid until the current operation is complete by the editor itself.
        /// 
        ///
        bool CanInterrupt { get; }
        #endregion
        #region CellEditMode
        ///
        /// Specifies the cell editor activation mode. There are three modes
        /// available for choice, and their usage depends upon the desired
        /// editor presentation, as well as how well the given underlying
        /// control interacts with the grid control.
        /// 
        /// The modes are as follows:
        /// 
        /// InPlace:
        /// Edit operations occur 'in place', always live, always
        /// in a state of interaction with the user. The CheckBoxEx,
        /// and ButtonX editors are examples of this.
        /// 
        /// Modal:
        /// Edit operations will be performed as a modal, widowed edit 
        /// controlled via calls to BeginEdit, EndEdit, and CancelEdit.
        /// The TextBoxEx and IntegerInput editors are examples of this.
        /// 
        /// NonModal:
        /// Edit operation will be performed as a nonNodal, windowed edit
        /// automatically invoked upon entry to the cell. The ButtonEx,
        /// BubbleBar, and TrackBar are examples of this. 
        /// 
        ///
        CellEditMode CellEditMode { get; }
        #endregion
        #region EditorCell
        ///
        /// Specifies the editor's current associated grid cell
        ///
        GridCell EditorCell { get; set; }
        #endregion
        #region EditorCellBitmap
        ///
        /// Called to get or set the editor's
        /// associated cell bitmap (internal use only)
        ///
        Bitmap EditorCellBitmap { get; set; }
        #endregion
        #region EditorFormattedValue
        ///
        /// Called to get the formatted editor value
        ///
        string EditorFormattedValue { get; }
        #endregion
        #region EditorPanel
        ///
        /// Called to get or set the editor's
        /// associated cell panel (internal use only)
        ///
        EditorPanel EditorPanel { get; set; }
        #endregion
        #region EditorValue
        ///
        /// Called to get or set the editor value
        ///
        object EditorValue { get; set;}
        #endregion
        #region EditorValueChanged
        ///
        /// Called to get or set whether the editor value has changed
        ///
        bool EditorValueChanged { get; set;}
        #endregion
        #region EditorValueType
        ///
        /// Called to get the editor's default value data type
        ///
        Type EditorValueType { get; }
        #endregion
        #region StretchBehavior
        ///
        /// Called to get the editor's desired 'stretch' behavior.
        /// 
        /// The StretchBehavior defines whether the editor wants to
        /// automatically have it's size stretched to fill the given cell.
        /// 
        /// Editors, such as ButtonX, want to fill the cell horizontally and
        /// vertically, whereas other editors, such as the Slider, may only
        /// want to stretch horizontally (or potentially not at all).
        ///
        StretchBehavior StretchBehavior { get; }
        #endregion
        #region SuspendUpdate
        ///
        /// Called to get or set whether updates to the grid
        /// state is suspended
        ///
        bool SuspendUpdate { get; set; }
        #endregion
        #region ValueChangeBehavior
        ///
        /// Called to get the behavior
        /// needed when a value changes in the editor.
        /// 
        /// For instance, CheckBoxEx value changes result in only requiring
        /// the cell to be redisplayed with the new state, whereas editors such
        /// as the TextBoxEx editor, may result in a new layout when the text changes.
        /// 
        ///
        ValueChangeBehavior ValueChangeBehavior { get; }
        #endregion
        #endregion
        #region CellRender
        ///
        ///  Called to initiate the actual rendering of the editor
        /// value into the grid cell.  In most cases this can be (and is)
        /// handled by a simple call to EditorCell.CellRender(this, graphics).
        /// If additional rendering is required by the editor, then the editor
        /// can completely render the cell contents itself (and never even call
        /// Editor.CellRender) or optionally perform additional rendering before
        /// or after the default cell rendering.
        ///
        ///
        void CellRender(Graphics g);
        #endregion
        #region CellKeyDown
        ///
        /// Called when a KeyDown occurs and the
        /// CellEditMode is InPlace (otherwise the key event is
        /// automatically directed straight to the editor control).
        /// 
        ///
        void CellKeyDown(KeyEventArgs e);
        #endregion
        #region Edit support
        #region BeginEdit
        ///
        /// Called when a Modal cell edit is about to be initiated.
        ///
        ///Signifies whether to select all editable content
        ///true to cancel the edit operation
        bool BeginEdit(bool selectAll);
        #endregion
        #region EndEdit
        ///
        /// Called when the edit operation is about to end. 
        ///
        ///true to cancel the operation.
        bool EndEdit();
        #endregion
        #region CancelEdit
        ///
        /// Called when the edit operation is being cancelled.
        ///
        ///true to cancel the operation.
        bool CancelEdit();
        #endregion
        #endregion
        #region GetProposedSize
        ///
        /// Called to retrieve the editors proposed size
        /// for the given cell, using the provided effective
        /// style and size constraint.
        ///
        ///Graphics object
        ///Associated grid cell
        ///Cell's effective style
        ///The constraining cell size
        ///
        Size GetProposedSize(Graphics g, GridCell cell, CellVisualStyle style, Size constraintSize);
        #endregion
        #region InitializeContext
        ///
        /// Called to initialize the editor's context
        /// environment (value, properties, style, etc)
        ///
        ///
        ///
        void InitializeContext(GridCell cell, CellVisualStyle style);
        #endregion
        #region Mouse support
        #region OnCellMouseMove
        ///
        /// Called when a MouseMove event occurs and the
        /// CellEditMode is InPlace (otherwise the event is
        /// automatically directed straight to the editor control).
        ///
        ///
        void OnCellMouseMove(MouseEventArgs e);
        #endregion
        #region OnCellMouseEnter
        /// 
        /// Called when a MouseEnter event occurs and the
        /// CellEditMode is InPlace (otherwise the event is
        /// automatically directed straight to the editor control).
        /// 
        /// 
        void OnCellMouseEnter(EventArgs e);
        #endregion
        #region OnCellMouseLeave
        ///
        /// Called when a MouseLeave event occurs and the
        /// CellEditMode is InPlace (otherwise the event is
        /// automatically directed straight to the editor control).
        ///
        ///
        void OnCellMouseLeave(EventArgs e);
        #endregion
        #region OnCellMouseUp
        /// 
        /// Called when a MouseUp event occurs and the
        /// CellEditMode is InPlace (otherwise the event is
        /// automatically directed straight to the editor control).
        /// 
        /// 
        void OnCellMouseUp(MouseEventArgs e);
        #endregion
        #region OnCellMouseDown
        /// 
        /// Called when a MouseDown event occurs and the
        /// CellEditMode is InPlace (otherwise the event is
        /// automatically directed straight to the editor control).
        /// 
        /// 
        void OnCellMouseDown(MouseEventArgs e);
        #endregion
        #endregion
        #region WantsInputKey
        ///
        /// Called to determine if the editor wants to process and
        /// handle the given key
        ///
        ///Key in question
        ///Whether the grid, by default, wants the key
        ///true is the control wants the key
        bool WantsInputKey(Keys key, bool gridWantsKey);
        #endregion
    }
    #region IGridCellConvertTo
    ///
    ///IGridCellConvertTo
    ///
    public interface IGridCellConvertTo
    {
        ///
        ///TryConvertTo
        ///
        ///Value to convert
        ///Data type to convert to
        ///Converted value
        ///
        bool TryConvertTo(object value, Type dataType, out object result);
    }
    #endregion
    #region IGridCellEditorFocus
    ///
    ///IGridCellEditorFocus
    ///
    public interface IGridCellEditorFocus
    {
        ///
        ///Indicates whether the editor has the input focus
        ///
        ///
        bool IsEditorFocused { get; }
        ///
        ///Gives the editor the input focus
        ///
        void FocusEditor();
    }
    #endregion
    #region enums
    #region CellEditMode
    ///
    /// Specifies the mode of cell editor activation
    ///
    public enum CellEditMode
    {
        ///
        /// Edit operation will be performed as a modal, widowed
        /// edit controlled via BeginEdit, EndEdit, and CancelEdit.
        ///
        Modal,
        ///
        /// Edit operation will be performed as a nonNodal, windowed
        /// edit automatically invoked upon entry to the cell.
        ///
        NonModal,
        ///
        /// Edit operation will be performed in-place, as a non-windowed
        /// edit automatically invoked upon entry to the cell.
        ///
        InPlace,
    }
    #endregion
    #region StretchBehavior
    /// 
    /// Defines how the editor is stretched to
    /// have it's size fill the given cell.
    /// 
    public enum StretchBehavior
    {
        ///
        /// No stretching to fill the cell
        ///
        None,
        ///
        /// Auto stretch horizontally only
        ///
        HorizontalOnly,
        ///
        /// Auto stretch vertically only
        ///
        VerticalOnly,
        ///
        /// Auto stretch both horizontally and vertically
        ///
        Both,
    }
    #endregion
    #region ValueChangeBehavior
    /// 
    /// Defines how the grid should respond to
    /// editor content / value changes
    /// 
    public enum ValueChangeBehavior
    {
        ///
        /// No action needed
        ///
        None,
        ///
        /// Grid layout needs invalidated
        ///
        InvalidateLayout,
        ///
        /// Cell needs rendered
        ///
        InvalidateRender,
    }
    #endregion
    #endregion
}