VPTissue Reference Manual
SimShell::Gui::HasUnsavedChangesPrompt Class Reference

HasUnsavedChanges with the ability of displaying a "save-discard-cancel" dialog to the user before closing, if there are unsaved changes. More...

#include <HasUnsavedChangesPrompt.h>

Inheritance diagram for SimShell::Gui::HasUnsavedChangesPrompt:
Inheritance graph
Collaboration diagram for SimShell::Gui::HasUnsavedChangesPrompt:
Collaboration graph

Public Member Functions

 HasUnsavedChangesPrompt (std::string &&title)
 
bool PromptClose (QWidget *parent=nullptr)
 Display dialog window containing a list (or tree) of widgets that contain unsaved changes. More...
 
- Public Member Functions inherited from SimShell::Gui::HasUnsavedChanges
 HasUnsavedChanges (std::string &&title)
 
virtual ~HasUnsavedChanges ()
 Virtual destructor.
 
ChildrenType::iterator begin ()
 Get iterator to first child.
 
ChildrenType::const_iterator begin () const
 Get iterator to first child.
 
ChildrenType::iterator end ()
 Get iterator to one position after last child.
 
ChildrenType::const_iterator end () const
 Get iterator to one position after last child.
 
void ForceClose ()
 Force this object and its children to go back to unopened state so it can be safely deleted.
 
const std::string & GetTitle ()
 Get title of this object.
 
bool IsClean () const
 
virtual bool IsOpened () const =0
 
bool Save ()
 Try to save this widget's (and its children's) changes. More...
 
bool SaveAndClose ()
 Try to save this object (and its children) and, if successful, close them all.
 

Additional Inherited Members

- Public Types inherited from SimShell::Gui::HasUnsavedChanges
typedef std::vector< HasUnsavedChanges * > ChildrenType
 
- Protected Member Functions inherited from SimShell::Gui::HasUnsavedChanges
void AddChild (ChildrenType::value_type &&v)
 Add child.
 
virtual void InternalForceClose ()=0
 Implementation should only close THIS widget, not its children.
 
virtual bool InternalIsClean () const =0
 The result should be true only if THIS widget is in clean state.
 
virtual void InternalPreForceClose ()
 Additional things to do before closing children of this widget.
 
virtual bool InternalSave ()=0
 Implementation should only save THIS widget. More...
 
void SetChildren (ChildrenType &&c)
 Set children.
 

Detailed Description

HasUnsavedChanges with the ability of displaying a "save-discard-cancel" dialog to the user before closing, if there are unsaved changes.

Definition at line 32 of file HasUnsavedChangesPrompt.h.

Member Function Documentation

bool SimShell::Gui::HasUnsavedChangesPrompt::PromptClose ( QWidget parent = nullptr)

Display dialog window containing a list (or tree) of widgets that contain unsaved changes.

The user can select which widgets to save and which to discard, or to cancel the close operation. If there are no unsaved changes (in this widget and in its children), then no dialog is displayed and the method immediately returns true.

Returns
Whether we are in unopened state, i.e. close operation was successful (regardless whether user saved or discarded changes)

Definition at line 33 of file HasUnsavedChangesPrompt.cpp.

References SimShell::Gui::SaveChangesDialog::Prompt().

Here is the call graph for this function:


The documentation for this class was generated from the following files: