Skip to content

Commit

Permalink
Add HasUnsavedChanges property to DocumentPage
Browse files Browse the repository at this point in the history
  • Loading branch information
ievgen-baida committed Feb 29, 2024
1 parent 27238c3 commit 8a04ce0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Eto/Forms/Controls/DocumentPage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Eto.Forms;
namespace Eto.Forms;

/// <summary>
/// Control for a page in a <see cref="DocumentControl"/>
Expand Down Expand Up @@ -77,6 +77,16 @@ public bool Closable
set { Handler.Closable = value; }
}

/// <summary>
/// Gets or sets a value indicating whether this <see cref="T:Eto.Forms.DocumentPage"/> has unsaved changes.
/// </summary>
/// <value><c>true</c> if page has unsaved changes; otherwise, <c>false</c>.</value>
public bool HasUnsavedChanges
{
get { return Handler.HasUnsavedChanges; }
set { Handler.HasUnsavedChanges = value; }
}

/// <summary>
/// Gets or sets the image of the page.
/// </summary>
Expand Down Expand Up @@ -113,6 +123,12 @@ public string Text
/// <value><c>true</c> if closable; otherwise, <c>false</c>.</value>
bool Closable { get; set; }

/// <summary>
/// Gets or sets a value indicating whether this <see cref="T:Eto.Forms.DocumentPage"/> has unsaved changes.
/// </summary>
/// <value><c>true</c> if page has unsaved changes; otherwise, <c>false</c>.</value>
bool HasUnsavedChanges { get; set; }

/// <summary>
/// Gets or sets the image of the page.
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions src/Eto/Forms/ThemedControls/ThemedDocumentPageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class ThemedDocumentPageHandler : ThemedContainerHandler<Panel, DocumentP
bool closable;
string text;
Image image;
bool hasUnsavedChanges;

/// <summary>
/// Initializes a new instance of the <see cref="T:Eto.Forms.ThemedControls.ThemedDocumentPageHandler"/> class.
Expand Down Expand Up @@ -105,6 +106,21 @@ public string Text
}
}


/// <summary>
/// Gets or sets a value indicating whether this <see cref="T:Eto.Forms.ThemedControls.ThemedDocumentPageHandler"/> has unsaved changes.
/// </summary>
/// <value><c>true</c> if page has unsaved changes; otherwise, <c>false</c>.</value>
public bool HasUnsavedChanges
{
get { return hasUnsavedChanges; }
set
{
hasUnsavedChanges = value;
Update();
}
}

/// <summary>
/// Gets a value indicating whether <see cref="Control.PreLoad"/>/<see cref="Control.Load"/>/<see cref="Control.LoadComplete"/>/<see cref="Control.UnLoad"/>
/// events are propagated to the inner control
Expand Down

0 comments on commit 8a04ce0

Please sign in to comment.