CMvcController Class

class CMvcController: public IEventRouter

This template is used to define controller classes that interact with a given type of model and viewport. The model class argument defines the type of model that this controller interacts with. The viewport class argument defines the type of viewport that this controller interacts with.

This class inherits the IMvcController_T template interface, and passes the model and viewport class arguments to that template.

Controllers support the IEventListener interface and also provide a mechanism for aggregating event listeners. The AddListener and RemoveListener methods allow event listener objects to be added to the controller. The controller then gives all of its listeners a chance to handle events that it receives.

Defined in: MvcController.h

Class Template Arguments

_Model

Type of model accessed by the controller.

_Viewport

Type of viewport accessed by the controller.

Class Members

CMvcController()

Controller constructor.

virtual ~CMvcController()

Controller destructor.

ListenerVector m_listeners

Array of event listeners.

ModelClass* m_pModel

Pointer to model associated with this controller.

ViewportClass* m_pViewport

Pointer to viewport associated with this controller.

virtual bool QueryGuid(REFGUID guid, void **ppvObj)

Retrieve a pointer to an interface supported by this object.

ULONG STDMETHODCALLTYPE AddRef()

Add a reference to this object.

ULONG STDMETHODCALLTYPE Release()

Release a reference to this object.

virtual void SetModel(ModelClass* pModel)

Assign a model to the controller.

virtual ModelClass* GetModel() const

Get a pointer to the model associated with this controller.

virtual void SetViewport(ViewportClass* pViewport)

Assign a viewport to the controller.

virtual ViewportClass* GetViewport() const

Get a pointer to the viewport associated with this controller.

virtual bool RouteEvent(IEvent* pIEvent)

Routes event objects to event listeners.

virtual bool AddListener(IEventListener* pIListener)

Add an event listener to the controller.

virtual bool RemoveListener(IEventListener* pIListener)

Remove an event listener from the controller.