rainmeter-studio/RainmeterStudio.TextEditor/TextDocument.cs

74 lines
1.8 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
2014-07-29 16:42:52 +00:00
using System.ComponentModel;
using RainmeterStudio.Core.Model;
namespace RainmeterStudio.TextEditorPlugin
{
public class TextDocument : IDocument
{
2014-07-29 16:42:52 +00:00
private Reference _reference;
private bool _isDirty;
/// <summary>
/// Gets or sets the text associated with this document
/// </summary>
2014-09-08 19:53:00 +00:00
public string Text
2014-07-29 16:42:52 +00:00
{
2014-09-08 19:53:00 +00:00
get; set;
2014-07-29 16:42:52 +00:00
}
/// <summary>
/// Gets or sets the reference of this document
/// </summary>
public Reference Reference
{
get
{
2014-07-29 16:42:52 +00:00
return _reference;
}
2014-07-29 16:42:52 +00:00
set
{
_reference = value;
2014-07-29 16:42:52 +00:00
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("Reference"));
}
}
2014-07-29 16:42:52 +00:00
/// <summary>
/// Gets a property indicating if this file was modified and not saved
/// </summary>
public bool IsDirty
{
2014-07-29 16:42:52 +00:00
get
{
return _isDirty;
}
set
{
_isDirty = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("IsDirty"));
}
}
2014-07-29 16:42:52 +00:00
/// <summary>
/// Triggered when the value of a property changes
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Initializes the text document
/// </summary>
public TextDocument()
{
2014-09-08 19:53:00 +00:00
Text = String.Empty;
}
}
}