InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IObserver Class Referenceabstract

#include <IObserver.h>

Inheritance diagram for IObserver:
IPMUnknownCObserverAbstractDialogObserverActiveSelectionObserverCdlChtUIWidgetObserverCelPnlEditBoxObserverCusCondTxtTreeViewObserverCusDtLnkDocObserverCusDtLnkUITreeNodeObserverCusDtLnkUITreeObserverCustomHttpLinkUIObserverCustomHttpLinkUIPlaceButtonObserverCWidgetObserverDCLSizListBoxObserverGTTxtEdtGoToTextButtonObserverGTTxtEdtNewDeleteStoryObserverGTTxtEdtStoryObserverLnkWtchActiveContextObserverLnkWtchCacheManagerPicIcoRollOverButtonObserverPnlTrvNodeObserverPnlTrvTreeObserverPreflightCheckBoxObserverPreviewableColorListObserverPstLstDocObserverSelectionHighlightObserverSnipRunGoButtonObserverSnipRunPanelWidgetObserverSwatchesObserverTableCellObserverTblAttWidgetObserverTKIPanelWidgetObserverTKITreeWidgetObserverWLBCmpEyeballObserverWLBCmpListBoxObserverWLBCmpPenObserverXDocBkUIDialogObserver

Public Types

enum  { kDefaultIID = IID_IOBSERVER }
 

Public Member Functions

virtual void Update (const ClassID &theChange, ISubject *theSubject, const PMIID &protocol, void *changedBy)=0
 
virtual void AutoAttach ()=0
 
virtual void AutoDetach ()=0
 
virtual void SetAttachIID (PMIID iid)=0
 
virtual PMIID GetAttachIID () const =0
 
virtual void SetEnabled (bool16 state)=0
 
virtual bool16 IsEnabled () const =0
 
virtual void LazyUpdate (ISubject *theSubject, const PMIID &protocol, const LazyNotificationData *data)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

This interface provides a notification mechanism for objects that need to be 

informed of changes made to another object. An observer attaches to the subject interface (ISubject) on the object it wants to be notifed of when a change occurs. The observed object can be another boss object, or itself if the observer is interested in changes made to its own interfaces. An object is allowed to have multiple IObserver interfaces as long as each observer has a unique interface ID.

See Also
ISubject for documentation on the two types of notification available, regular notification and lazy notification.

Member Function Documentation

virtual PMIID IObserver::GetAttachIID () const
pure virtual

Get the interface ID of this observer.

Returns
the interface ID of this observer

Implemented in CObserver.

virtual bool16 IObserver::IsEnabled () const
pure virtual

Returns kTrue if this observer is enabled, kFalse otherwise

Implemented in CObserver.

virtual void IObserver::LazyUpdate (ISubjecttheSubject,
const PMIIDprotocol,
const LazyNotificationDatadata 
)
pure virtual

Lazy notification of a change in an observed subject; this method is called after the transaction in which the change was performed completes and after undo or redo.

Parameters
theSubjectis the subject that changed
protocolis the interface of the subject's boss that changed
datalazy notification data or nil. Observers must be able to handle a call that has nil data. In certain low memory conditions the lazy notification data passed to ISubject::ModelChange may not be passed on to observers. The observer must be able to work without data in which case the observer would usually refresh its entire state by re-examining all objects of interest. See LazyNotificationData for documentation.
See Also
ISubject::AttachObserver(IObserver*, const PMIID&, AttachmentType) to receive lazy notification attach to the subject by calling this method specifying an attachment type of lazy, or, both if you also want regular notification.
IObserver::Update for regular notification

Implemented in LnkWtchActiveContextObserver, CusDtLnkUITreeObserver, PnlTrvTreeObserver, IDHAObserver, LnkWtchCacheManager, CustSEObserver, CusDtLnkDocObserver, CObserver, and CusCondTxtTreeViewObserver.

virtual void IObserver::SetAttachIID (PMIID iid)
pure virtual

Set the interface ID of this observer; normally this is IID_IOBSERVER but if there are several observers on a boss they each need to have a different interface ID.

Parameters
iidis the interface ID of this observer

Implemented in CObserver.

virtual void IObserver::SetEnabled (bool16 state)
pure virtual

Enable or disable the observer; a disabled observer will not receive an update for a change.

Parameters
statekTrue to enable, kFalse to disable

Implemented in CObserver.

virtual void IObserver::Update (const ClassIDtheChange,
ISubjecttheSubject,
const PMIIDprotocol,
void * changedBy 
)
pure virtual
        Regular notification of a change in an observed subject; this method is called immediately after the

        change is made, it is not called on undo or redo.

Parameters
theChangerepresents the change to an object, often this is the ClassID of the command that made the change
theSubjectis the subject that changed
protocolis the interface of the subject's boss that changed
changedByis used to pass additional data about the change, often this is a pointer to the command that caused the change
See Also
ISubject::AttachObserver(IObserver*, const PMIID&, AttachmentType) to receive regular notification attach to the subject by calling this method specifying an attachment type of regular, or, both if you also want lazy notification. You can also receive regular notification by attaching to the subject using ISubject::AttachObserver(IObserver*,const PMIID&,const PMIID&).
IObserver::LazyUpdate for lazy notification

Implemented in SelectionHighlightObserver, TranFxUIDialogObserver, CusDtLnkUITreeObserver, PnlTrvTreeObserver, PstLstDocObserver, CustomHttpLinkUIPlaceButtonObserver, DCLSizListBoxObserver, PDFVTUIDialogObserver, PnlTrvNodeObserver, CusDtLnkUITreeNodeObserver, LnkWtchActiveContextObserver, PreviewableColorListObserver, GTTxtEdtStoryObserver, SnipRunPanelWidgetObserver, CustomHttpLinkUIObserver, LnkWtchCacheManager, WLBCmpListBoxObserver, SnipRunGoButtonObserver, WatermarkUIDialogObserver, BscSlDlgDialogObserver, IDHAObserver, XDocBkUIDialogObserver, BscSlDlgTabDialogObserver, WLBCmpEyeballObserver, WLBCmpPenObserver, BscL10NDialogObserver, CustSEObserver, TxtExpDialogObserver, BscDlgDialogObserver, CusDtLnkUIBrowsDialogObserver, GTTxtEdtNewDeleteStoryObserver, TblBscDialogObserver, GTTxtEdtGoToTextButtonObserver, PreflightCheckBoxObserver, CusDtLnkDocObserver, PicIcoRollOverButtonObserver, WFPDialogObserver, CdlChtUIWidgetObserver, ActiveSelectionObserver, TKIPanelWidgetObserver, TblAttWidgetObserver, TableCellObserver, CelPnlEditBoxObserver, SwatchesObserver, CusCondTxtTreeViewObserver, CDialogObserver, CSelectableDialogObserver, and TKITreeWidgetObserver.