using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace RainmeterStudio.Model
{
    public abstract class IDocumentEditor : IDisposable
    {
        #region Dirty flag
        private bool _dirty = false;
        /// 
        /// Gets a flag indicating if the active document is dirty (modified and not saved)
        /// 
        public virtual bool Dirty
        {
            get
            {
                return _dirty;
            }
            protected set
            {
                _dirty = value;
                if (DirtyChanged != null)
                    DirtyChanged(this, new EventArgs());
            }
        }
        /// 
        /// Triggered when the dirty flag changes
        /// 
        public event EventHandler DirtyChanged;
        #endregion
        #region Document
        /// 
        /// Gets the opened document
        /// 
        public abstract IDocument Document { get; }
        /// 
        /// Gets the title to be displayed in the title bar
        /// 
        public abstract string Title { get; }
        /// 
        /// Triggered when the title changes
        /// 
        public event EventHandler TitleChanged;
        #endregion
        #region EditorUI
        /// 
        /// Gets the editor UI
        /// 
        public abstract UIElement EditorUI { get; }
        #endregion
        #region Selection properties
        /// 
        /// Gets a value indicating if this editor uses the selection properties window
        /// 
        public virtual bool UsesSelectionProperties
        {
            get
            {
                return false;
            }
        }
        /// 
        /// Gets the name of the selected object
        /// 
        public virtual string SelectionName
        {
            get
            {
                return String.Empty;
            }
        }
        /// 
        /// Gets a list of properties for the currently selected object
        /// 
        public virtual IEnumerable SelectionProperties
        {
            get
            {
                yield break;
            }
        }
        /// 
        /// Triggered when the selected object changes (used to update properties)
        /// 
        public event EventHandler SelectionChanged;
        #endregion
        #region Toolbox
        /// 
        /// Gets a list of items to populate the toolbox
        /// 
        public virtual IEnumerable ToolboxItems
        {
            get
            {
                yield break;
            }
        }
        public event EventHandler ToolboxChanged;
        #endregion
        #region Dispose
        /// 
        /// Dispose
        /// 
        public virtual void Dispose()
        {
        }
        #endregion
    }
}