OpendTect  6.6
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
NotSavedPrompter Class Reference
Inheritance diagram for NotSavedPrompter:
[legend]

Public Member Functions

 NotSavedPrompter ()
 
 ~NotSavedPrompter ()
 
void addObject (const char *str, const CallBack &savecb, bool issaveas, const void *dataptr)
 
void addObject (const uiString &str, const CallBack &savecb, bool issaveas, const void *dataptr)
 
bool doTrigger (uiParent *, bool withcancel, const uiString &actiontype)
 Invoke the system. Returns false if cancel has been pressed. More...
 
const void * getCurrentObjectData () const
 
uiParentgetParent ()
 
bool isSaveAs () const
 
int queueID () const
 
void reportSuccessfullSave ()
 
- Public Member Functions inherited from CallBacker
 CallBacker ()
 
 CallBacker (const CallBacker &)
 
virtual ~CallBacker ()
 
bool attachCB (const NotifierAccess &, const CallBack &, bool onlyifnew=false) const
 
bool attachCB (const NotifierAccess *notif, const CallBack &cb, bool onlyifnew=false) const
 
void detachAllNotifiers () const
 Call from the destructor of your inherited object. More...
 
void detachCB (const NotifierAccess &, const CallBack &) const
 
void detachCB (const NotifierAccess *notif, const CallBack &cb) const
 
virtual bool isCapsule () const
 
bool isNotifierAttached (const NotifierAccess *) const
 Only for debugging purposes, don't use. More...
 
void stopReceivingNotifications () const
 

Static Public Member Functions

static NotSavedPrompterNSP ()
 
- Static Public Member Functions inherited from CallBacker
static void createReceiverForCurrentThread ()
 
static void removeReceiverForCurrentThread ()
 

Public Attributes

Notifier< NotSavedPrompterpromptSaving
 

Protected Member Functions

void closeQueueCB (CallBacker *cb)
 

Protected Attributes

uiNotSavedDlgdlg_
 
ObjectSet< NotSavedPrompterData > objects_
 
int queueid_
 

Friends

class uiNotSavedDlg
 

Detailed Description

Presents a list of items that have not been saved, giving the user the opportunity to save them.

MyClass::MyClass()
{
mCB(this,MyClass,askSaveCB) );
}
MyClass::~MyClass()
{
mCB(this,MyClass,askSaveCB) );
}
void MyClass::askSaveCB( CallBacker* )
{
if ( not_saved )
{
BufferString str("Object type \"" );
str += name(); str += "\"";
PtrMan<IOObj> ioobj = IOM().get( mid );
const bool issaveas = (bool) ioobj;
NotSavedPrompter::NSP().addObject( new NotSavedPrompter::Data(
str.buf(), mCB(this,MyClass,saveCB()), issaveas, 0 ) );
}
}
void MyClass::saveCB( CallBacker* )
{
{
//Start dlg with uiparent and get new name
}
if ( successfulSave )
}
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
IOObj * get(const DBKey &) const
Next functions return a new (unmanaged) IOObj.
uiParent * getParent()
static NotSavedPrompter & NSP()
Notifier< NotSavedPrompter > promptSaving
Definition: uinotsaveddlg.h:78
void reportSuccessfullSave()
bool isSaveAs() const
void addObject(const uiString &str, const CallBack &savecb, bool issaveas, const void *dataptr)
void remove(const CallBack &) const
void notify(const CallBack &, bool first=false) const
Definition: ptrman.h:121
Definition: uiparent.h:26

<>

Constructor & Destructor Documentation

◆ NotSavedPrompter()

NotSavedPrompter::NotSavedPrompter ( )

◆ ~NotSavedPrompter()

NotSavedPrompter::~NotSavedPrompter ( )
inline

Member Function Documentation

◆ addObject() [1/2]

void NotSavedPrompter::addObject ( const char *  str,
const CallBack savecb,
bool  issaveas,
const void *  dataptr 
)

Lets the object know that you have an object that should be added to the list of unsaved objects. Normally called when triggered by promptSaving.

Parameters
strDescription of the object (e.g. "Horizon A")
savecbCallback that will save the object
issaveastrue if savecb will prompt user for a name
dataptrPointer that can be retrieved during savecb

◆ addObject() [2/2]

void NotSavedPrompter::addObject ( const uiString str,
const CallBack savecb,
bool  issaveas,
const void *  dataptr 
)

Lets the object know that you have an object that should be added to the list of unsaved objects. Normally called when triggered by promptSaving.

Parameters
strDescription of the object (e.g. "Horizon A")
savecbCallback that will save the object
issaveastrue if savecb will prompt user for a name
dataptrPointer that can be retrieved during savecb

◆ closeQueueCB()

void NotSavedPrompter::closeQueueCB ( CallBacker cb)
protected

◆ doTrigger()

bool NotSavedPrompter::doTrigger ( uiParent ,
bool  withcancel,
const uiString actiontype 
)

Invoke the system. Returns false if cancel has been pressed.

◆ getCurrentObjectData()

const void* NotSavedPrompter::getCurrentObjectData ( ) const
Returns
the dataptr of the currently active object.
Note
Only valid during a call from a cb given in addObject()

◆ getParent()

uiParent* NotSavedPrompter::getParent ( )
Returns
a pointer to the save-dialog, which can be used when creating a dialog in a callback given in addObject.
Note
Only valid during a call from a cb given in addObject()

◆ isSaveAs()

bool NotSavedPrompter::isSaveAs ( ) const
Returns
the issaveas status of the currently active object
Note
Only valid during a call from a cb given in addObject()

◆ NSP()

static NotSavedPrompter& NotSavedPrompter::NSP ( )
static

◆ queueID()

int NotSavedPrompter::queueID ( ) const
inline

When OK is pressed (i.e. not cancel), a queue is executed. If you want something to be executed, add it to this queue.

◆ reportSuccessfullSave()

void NotSavedPrompter::reportSuccessfullSave ( )

Let the dialog know that the current object was successfully saved.

Note
Only valid during a call from a cb given in addObject()

Friends And Related Function Documentation

◆ uiNotSavedDlg

friend class uiNotSavedDlg
friend

Member Data Documentation

◆ dlg_

uiNotSavedDlg* NotSavedPrompter::dlg_
protected

◆ objects_

ObjectSet<NotSavedPrompterData> NotSavedPrompter::objects_
protected

◆ promptSaving

Notifier<NotSavedPrompter> NotSavedPrompter::promptSaving

Will trigger from when users should save all unsaved objects, normally at survey change or shutdown.

◆ queueid_

int NotSavedPrompter::queueid_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2022