Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvModifiedFlagObserver Class Reference

Reports the modifications made to a document. More...

#include <ilviews/base/command.h>

Inheritance diagram for IlvModifiedFlagObserver:
IlvObserver

Public Member Functions

 IlvModifiedFlagObserver (IlvCommandHistory *h)
 Constructor. More...
 
virtual void flagChanged (IlBoolean b)
 Indicates whether the state of the document has changed. More...
 
void update (IlvObservable *, IlAny)
 Notifying member function called by observables. More...
 
- Public Member Functions inherited from IlvObserver
 IlvObserver ()
 Constructor. More...
 
virtual void attach (IlvObservable *o)
 Attach the observer to an observable. More...
 
virtual void detach (IlvObservable *o)
 Detach the observer from an observable. More...
 
IlBoolean observes (IlvObservable *o) const
 Tells if the observer is attached to a given observable. More...
 

Detailed Description

Reports the modifications made to a document.

Library: views

In many applications, an asterisk (*) is added to the title of a window to indicate that the document it contains is different from its image stored to a file, and that it needs to be saved when the user quits the application.
The class IlvModifiedFlagObserver defines an observer that reports any changes in the "modified" status of a document attached to an IlvCommandHistory object. This functionality is implemented by redefining the flagChanged method in a subclass. When the flagChanged method is called with IlTrue, the title of the window displaying the associated document is modified to include an asterisk. When it is called with IlFalse, the asterisk is removed.
This observer works by watching all the IlvCommand objects attached to a command history. If these commands are IlvPseudoCommand objects, they do not modify the document, and flagChanged is not affected.

See also
IlvCommand, IlvCommandHistory, IlvManager

Constructor & Destructor Documentation

◆ IlvModifiedFlagObserver()

IlvModifiedFlagObserver::IlvModifiedFlagObserver ( IlvCommandHistory h)

Constructor.

Parameters
hThe command history to which the observer will be attached to track any changes in its "modified" status.

Member Function Documentation

◆ flagChanged()

virtual void IlvModifiedFlagObserver::flagChanged ( IlBoolean  b)
virtual

Indicates whether the state of the document has changed.

You should implement this method in a subclass to define the visual cue that will reflect any modifications made to the document attached to the command history.

Parameters
bThe new value of the flag. Is IlFalse if the document has not changed, and IlTrue otherwise.

◆ update()

void IlvModifiedFlagObserver::update ( IlvObservable o,
IlAny  arg 
)
virtual

Notifying member function called by observables.

Must be defined in subclasses to implement the notification mechanism.

Parameters
oObservable whose state has changed.
argAny argument commonly agreed between the observer and the observable that should help the observer in determining what exactly in the state of the observable has changed.
See also
IlvActionMessage for an example of use of this parameter.

Reimplemented from IlvObserver.