MvcController Class

class MvcController: public SECWndPlugIn, public IMvcMsgHandler

The controller interprets mouse and keyboard input, updating the information in the model as needed to reflect that input. The changes in the model are then displayed in the viewport.

A controller is a message handler that can plug into a window and listen to the events it receives. In response to those events, such as a mouse down or keypress, the controller calls the appropriate functions in the model and or viewport it controls.

Defined in: MvcController.h

Class Members

MvcController()

SAD! Retrieve a pointer to an interface supported by this object.

virtual BOOL  Create(CWnd* pWnd, MvcVisualComponent* pComp)

Create the controller on the specified visual component

virtual BOOL  PlugInTo(CWnd* pWnd, MvcVisualComponent* pVp)

Plugs the controller into the specified window and visual component

CWnd*  m_pWnd

Pointer to the window that this controller is plugged into

static MvcController*  m_psActiveCtlr

The single active controller. Only one controller can be active at a time.

inline CWnd*  GetWnd() const

Get a pointer to the window that this controller is plugged into

inline MvcVisualComponent*  GetComponent() const

Retrieve the visual part the agent acts upon

virtual void  SetComponent(MvcVisualComponent* pVp)

Retrieve the visual part the agent acts upon

virtual BOOL  OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)

A windows message is being delegated to this component for handling

virtual BOOL  OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)

The command message is being delegated to this component for handling

static MvcController*  GetActiveController()

Retrieve the single active controller in the system

static void  SetActiveController(MvcController* pWndCtlr)

Set the active controller throughout the system