VPTissue Reference Manual
|
Abstract class that represents the ability be in closed or opened state, and, if the latter, in clean or dirty state. More...
#include <HasUnsavedChanges.h>
Public Types | |
typedef std::vector< HasUnsavedChanges * > | ChildrenType |
Public Member Functions | |
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. | |
Protected Member Functions | |
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. | |
Abstract class that represents the ability be in closed or opened state, and, if the latter, in clean or dirty state.
There are methods for querying the state, and quietly saving or discarding (if in opened state).
Objects of this type can also have children of the same type, to represent a hierarchical tree of closed/opened/clean/dirty objects. Children of this object can only be in opened state if this object is in opened state. Therefore, this object can only be closed if all of its children are closed first. This has the consequence that if one of this object's children are in 'dirty' state, a user confirmation might be necessary before being able close this object.
Definition at line 39 of file HasUnsavedChanges.h.
SimShell::Gui::HasUnsavedChanges::HasUnsavedChanges | ( | std::string && | title | ) |
title | Title for this window. Displayed in "Save Changes?" dialog. |
Definition at line 27 of file HasUnsavedChanges.cpp.
|
protectedpure virtual |
Implementation should only save THIS widget.
The result should be true only if THIS widget is in clean state.
Implemented in SimPT_Shell::Gui::PTreeEditor, SimShell::Gui::PTreeEditorWindow, SimShell::Gui::HasUnsavedChangesDummy, SimShell::Gui::Controller::ProjectController, SimShell::Gui::Controller::WorkspaceController, SimShell::Gui::PTreeContainer, and SimShell::Gui::PTreeMenu.
Referenced by Save().
bool SimShell::Gui::HasUnsavedChanges::IsClean | ( | ) | const |
Definition at line 73 of file HasUnsavedChanges.cpp.
References InternalIsClean().
Referenced by SimShell::Gui::PTreeContainerPreferencesObserver::Update().
|
pure virtual |
Implemented in SimShell::Gui::HasUnsavedChangesDummy, SimShell::Gui::PTreeContainer, SimShell::Gui::Controller::ProjectController, SimShell::Gui::Controller::WorkspaceController, SimPT_Shell::Gui::PTreeEditor, SimShell::Gui::PTreeEditorWindow, SimShell::Gui::PTreeMenu, and SimPT_Editor::TissueEditor.
Referenced by ForceClose(), and Save().
bool SimShell::Gui::HasUnsavedChanges::Save | ( | ) |
Try to save this widget's (and its children's) changes.
Definition at line 85 of file HasUnsavedChanges.cpp.
References InternalSave(), and IsOpened().
Referenced by SaveAndClose().