CContainerView

Tip   Use ClassView to jump to the CContainerView member functions that are discussed in this section. Follow along by reading the code in ContainerView.cpp and comparing the member functions to their descriptions below.

Class CContainerView is derived from CView. The member CContainerItem* m_pSelection points to the currently selected OLE object. If no object is selected, its value is NULL.

CContainerView::OnDraw

The AppWizard-provided implementation of CContainerView::OnDraw relies on the simplifying assumption that there is only one object to be drawn, namely the sole m_pSelection object. Later you will replace this implementation with code that draws the multiple client items (embedded OLE objects) contained in the document.

CContainerView::IsSelected

The AppWizard-provided implementation of CContainerView::IsSelected returns TRUE if the specified CObject is the m_pSelection object. This code is used without changes for the Container application, which has a simple single-selection user interface. For an example of multiple selection, see the DRAWCLI sample application.

CContainerView::OnInsertObject

The AppWizard-provided implementation of CContainerView::OnInsertObject creates a standard COleInsertDialog object and displays the dialog box. OnInsertObject is the command handler for the Insert New Object command on the Edit menu. It then creates a COleClientItem-derived object and calls the CreateItem member function of the COleInsertDialog object to create the embedded object using the information specified by the user.

CContainerView::OnSetFocus

The AppWizard-provided implementation of CContainerView::OnSetFocus changes the focus from the view to an embedded OLE item if the embedded item is currently activated in place. This is exactly the implementation needed by Container and by most container applications.

CContainerView::OnSize

The AppWizard-provided implementation of CContainerView::OnSize determines if there is an OLE item (COleClientItem) currently activated in place. If so, the COleClientItem is notified that the clipping rectangle of the item has changed. This allows the server to know how much of the object is visible. When the size of the window changes, so does the size of the clipping rectangle. For example, the sample application HIERSVR uses this mechanism to implement scrolling and keyboard movement correctly.