![]() | InDesign SDK 20.5 |
#include <isignalmgr.h>

Public Types | |
| enum | { kDefaultIID = IID_ISIGNALMGR } |
Public Member Functions | |
| virtual void | Init (ServiceID serviceID)=0 |
| virtual void | Terminate ()=0 |
| virtual ServiceID | GetServiceID () const =0 |
| virtual int32 | CountResponders () const =0 |
| virtual int32 | CountUnsignaledResponders () const =0 |
| virtual ErrorCode | SignalNextResponder ()=0 |
| virtual ErrorCode | SignalResponder (ClassID actionClassID)=0 |
| virtual ErrorCode | SignalAllResponders (ServiceID serviceID, bool16 showProgress=kFalse)=0 |
Public Member Functions inherited from IPMUnknown | |
| virtual IPMUnknown * | QueryInterface (PMIID interfaceID) const =0 |
| virtual void | AddRef () const =0 |
| virtual void | Release () const =0 |
ISignalMgr is used to send a Signal.
The Signal/Responder protocol is used particularly for broadcasting model changes, but is used anytime the listener doesn't care what object changed, but is intererested in finding out about all changes of a certain class. ISignalMgr handles sending the message to the responders.
Responders implement a given ServiceID. The sender (usually a command) gets the signal mgr and sends the message. There is a single default implementation of ISignalMgr which is used to actually send the message; usually this is either attached to the command which is sending the message, or on a standalone boss. Either way works equally well.
To send a signal, typically you need code that does something like this:
#include "ISignalMgr.h"
InterfacePtr<ISignalMgr> signalMgr(this, UseDefaultIID()); signalMgr->Init(kMySignalServiceID); signalMgr->SignalAllResponders(kMySignalServiceID);
If you have data you want to pass along in the signal, you can supply it as a data interface if necessary. But if you are signalling on a command, and attach the signalmgr to the command, then this is typically not necessary because the responder is passed the signalmgr and can use it to query for the command's data interface directly.
If you need to control the loop yourself, you can do this by iterating the responders and terminating the signalmgr yourself. Typically this is not necessary.
| pure virtual |
Get the number of responders that will be called.
| pure virtual |
Get the number of responders that are not yet signaled
| pure virtual |
Get the ServiceID that this SignalMgr signals on. This is used so that client responders may have a single responder capable of handling more than one type of signal.
| pure virtual |
Initialize the signal mgr (should only get called once)
| serviceID | this tells the SignalMgr what responders to call |
| pure virtual |
Signal all responders. This initializes the SignalMgr, iterates through the responders, calling each one and aborting in case of error, then calls Terminate. It will optionally display a progress indicator.
| pure virtual |
Send a signal to the next responder. Callers should check the error code, and abort iteration in case of error!
| pure virtual |
Signal a specific responder. The responder may return an error. The error may be specific to the responder, but could also be either kUnknownResponderError or kResponderIsBusyError.
| pure virtual |
Call this when you are done with the SignalMgr. The Terminate function is used to handle errors. A responder may flag an error by setting the global error code. If a responder encounters an error, then iteration should be aborted, and Terminate should be called. Terminate will signal all the responders who have already been called, to let them know that an error occurred.