InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TranFxUIDialogObserver Class Reference
Inheritance diagram for TranFxUIDialogObserver:
CDialogObserverAbstractDialogObserverCObserverIObserverIPMUnknown

Public Member Functions

 TranFxUIDialogObserver (IPMUnknown *boss)
 
virtual ~TranFxUIDialogObserver ()
 
virtual void AutoAttach ()
 
virtual void AutoDetach ()
 
virtual void Update (const ClassID &theChange, ISubject *theSubject, const PMIID &protocol, void *changedBy)
 
- Public Member Functions inherited from CDialogObserver
 CDialogObserver (IPMUnknown *boss)
 
- Public Member Functions inherited from AbstractDialogObserver
 AbstractDialogObserver (IPMUnknown *boss)
 
- Public Member Functions inherited from CObserver
 CObserver (IPMUnknown *boss, PMIID interfaceID=IID_IOBSERVER)
 
IChangeManagerGetChangeManager () const
 
virtual void SetAttachIID (PMIID iid)
 
virtual PMIID GetAttachIID () const
 
virtual void SetEnabled (bool16 state)
 
virtual bool16 IsEnabled () const
 
virtual void LazyUpdate (ISubject *theSubject, const PMIID &protocol, const LazyNotificationData *data)
 

Additional Inherited Members

- Public Types inherited from IObserver
enum  { kDefaultIID = IID_IOBSERVER }
 
- Protected Member Functions inherited from CDialogObserver
virtual void CloseDialog (bool16 windowAlreadyClosed=kFalse)
 
virtual void FireOffEndDialogCmd (bool16 hitOK)
 
void SetDialogValidationStatusFailed (bool16 bStatus=kTrue)
 
void SetCloseOnCancel (bool16 shouldCloseOnCancel=kTrue)
 
- Protected Attributes inherited from CObserver
bool16 fDetachSubjectsOnDelete
 
PMIID fAttachIID
 
const UIDRef fThisRef
 
bool16 fEnabled
 

Detailed Description

Implements a dialog observer based on CDialogObserver

that handles widget changes made by the user in this

plug-in's previewable dialog.



Changes to the transparency effect are made

via the suite ITranFxSuite.



The description below talks about how commands get processed

in previewable dialogs. Note however that this dialog does not process

commands directly. Instead, it calls the suite that controls the

effect, ITranFXSuite, that in turn calls a facade, TranFxUtils,

that processes the commands. So the dialog works in tandem with

the suite and the commands that it processes. However, it is 

important to understand the special way in which commands are

handled during a previewable dialog, as given below.



Modal dialogs can have a preview checkbox.  The preview checkbox 

allows the user to see the immediate effect on the document of

modifying some dialog control.



A previewable dialog works like this. Typically it

is implemented more like a panel in that each control has an

observer that results in a command being processed to change something when

clicked. In this implementation we have one observer watching

all the widgets in the dialog for change. Each time a widget

changes we make a suite call that processes a command to make 

the requested change.



When the preview checkbox is turned off commands are buffered. 

When the preview checkbox is turned on buffered commands are 

processed. When the preview checkbox is turned off again the 

commands are undone. When the dialog is dismissed with the OK 

button buffered commands are processed.



Adding a preview checkbox to you modal dialog will give you:

<ul>

<li>buffering of commands when preview is not checked.

<li>undoing of previewed commands when the dialog is cancelled.

<li>grouping of commands into a single compound command.

<li>replacement of commands with the same ICommand::GetCreatorID.

i.e. if you process a command with the same creator id more than

once the previous command is undone and replaced by the new command.

So if you click 10 times to set the x offset to a different

value only the last set x offset command is processed. See 

the methods in TranFxUtils that gets called by ITranFxSuite

for examples of how this is done.

</ul>



A preview checkbox is created by an ODFRez statement like this:

<pre>

Note the preview button CheckBoxWidget ( kPreviewButtonWidgetID, // WidgetId kSysCheckBoxPMRsrcId, // RsrcId kBindNone, Frame(192,76,272,96) // Frame kTrue, // Visible kTrue, // Enabled TriStateControlAttributes kAlignLeft, // fAlignment CTextControlData "Pre&view" // Initial text )

You can have a preview checkbox but disable all of the processing described above simply by using replacing kPreviewButtonWidgetID with a WidgetID of your own. You would then have to implement your own command management using command sequences or whatever to achieve the result you want.

See Also
ITranFxSuite
TranFxUtils

Constructor & Destructor Documentation

TranFxUIDialogObserver::TranFxUIDialogObserver (IPMUnknownboss)

Constructor.

Parameters
bossinterface ptr from boss object on which this interface is aggregated.
virtual TranFxUIDialogObserver::~TranFxUIDialogObserver ()
inlinevirtual

Destructor.

Member Function Documentation

void TranFxUIDialogObserver::AutoAttach (void )
virtual

Called by the application to allow the observer to attach to the subjects to be observed, in this case the dialog's info button widget. If you want to observe other widgets on the dialog you could add them here.

Reimplemented from CDialogObserver.

void TranFxUIDialogObserver::AutoDetach (void )
virtual

Called by the application to allow the observer to detach from the subjects being observed.

Reimplemented from CDialogObserver.

void TranFxUIDialogObserver::Update (const ClassIDtheChange,
ISubjecttheSubject,
const PMIIDprotocol,
void * changedBy 
)
virtual

Called by the host when the observed object changes, in this case when the dialog's info button is clicked.

Parameters
theChangespecifies the class ID of the change to the subject. Frequently this is a command ID.
theSubjectpoints to the ISubject interface for the subject that has changed.
protocolspecifies the ID of the changed interface on the subject boss.
changedBypoints to additional data about the change. Often this pointer indicates the class ID of the command that has caused the change.

Reimplemented from CDialogObserver.