From 8a04ce0485b987c67ca8ca753fb088c7cd702d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0evgen=20Baida?= Date: Tue, 16 Jan 2024 22:44:40 +0100 Subject: [PATCH] Add `HasUnsavedChanges` property to `DocumentPage` --- src/Eto/Forms/Controls/DocumentPage.cs | 18 +++++++++++++++++- .../ThemedDocumentPageHandler.cs | 16 ++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Eto/Forms/Controls/DocumentPage.cs b/src/Eto/Forms/Controls/DocumentPage.cs index b2699d228e..0408a7cf39 100644 --- a/src/Eto/Forms/Controls/DocumentPage.cs +++ b/src/Eto/Forms/Controls/DocumentPage.cs @@ -1,4 +1,4 @@ -namespace Eto.Forms; +namespace Eto.Forms; /// /// Control for a page in a @@ -77,6 +77,16 @@ public bool Closable set { Handler.Closable = value; } } + /// + /// Gets or sets a value indicating whether this has unsaved changes. + /// + /// true if page has unsaved changes; otherwise, false. + public bool HasUnsavedChanges + { + get { return Handler.HasUnsavedChanges; } + set { Handler.HasUnsavedChanges = value; } + } + /// /// Gets or sets the image of the page. /// @@ -113,6 +123,12 @@ public string Text /// true if closable; otherwise, false. bool Closable { get; set; } + /// + /// Gets or sets a value indicating whether this has unsaved changes. + /// + /// true if page has unsaved changes; otherwise, false. + bool HasUnsavedChanges { get; set; } + /// /// Gets or sets the image of the page. /// diff --git a/src/Eto/Forms/ThemedControls/ThemedDocumentPageHandler.cs b/src/Eto/Forms/ThemedControls/ThemedDocumentPageHandler.cs index 117986da26..73e2a6577f 100644 --- a/src/Eto/Forms/ThemedControls/ThemedDocumentPageHandler.cs +++ b/src/Eto/Forms/ThemedControls/ThemedDocumentPageHandler.cs @@ -9,6 +9,7 @@ public class ThemedDocumentPageHandler : ThemedContainerHandler /// Initializes a new instance of the class. @@ -105,6 +106,21 @@ public string Text } } + + /// + /// Gets or sets a value indicating whether this has unsaved changes. + /// + /// true if page has unsaved changes; otherwise, false. + public bool HasUnsavedChanges + { + get { return hasUnsavedChanges; } + set + { + hasUnsavedChanges = value; + Update(); + } + } + /// /// Gets a value indicating whether /// /// events are propagated to the inner control