From 27ca075d4cf6eebd9bb62458c951d59a102cacbf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 16 Oct 2020 02:07:10 +0200 Subject: [PATCH] Document return values of various close-related docview functions Make it explicit that they all return true if the view or document was effectively closed or false if closing it was vetoed. --- interface/wx/docview.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/interface/wx/docview.h b/interface/wx/docview.h index ed74d5d320..76b56045a6 100644 --- a/interface/wx/docview.h +++ b/interface/wx/docview.h @@ -922,6 +922,8 @@ public: /** Closes the view by calling OnClose(). If @a deleteWindow is @true, this function should delete the window associated with the view. + + @return @true if the view was closed */ virtual bool Close(bool deleteWindow = true); @@ -971,6 +973,9 @@ public: example, if your views all share the same window, you need to disassociate the window from the view and perhaps clear the window. If @a deleteWindow is @true, delete the frame associated with the view. + + Returning @false from this function prevents the view, and possibly the + document, from being closed. */ virtual bool OnClose(bool deleteWindow); @@ -1295,6 +1300,8 @@ public: Closes the document, by calling OnSaveModified() and then (if this returned @true) OnCloseDocument(). This does not normally delete the document object, use DeleteAllViews() to do this implicitly. + + @return @true if the document was closed */ virtual bool Close(); @@ -1463,6 +1470,12 @@ public: Notice that previous wxWidgets versions used to call this function also from OnNewDocument(), rather counter-intuitively. This is no longer the case since wxWidgets 2.9.0. + + Returning @false from this function prevents the document from closing. + The default implementation does this if the document is modified and + the user didn't confirm discarding the modifications to it. + + Return @true to allow the document to be closed. */ virtual bool OnCloseDocument();