Vc++ 3


Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Vc++ 3

  1. 1. Visual C++ Programming Document View Architecture
  2. 2. Document-Centric Computing <ul><ul><li>Applications on most of the OS require the user to know which applications must be used to create documents of a specific type. </li></ul></ul><ul><ul><li>Earlier it was not feasible to create a document with data from different applications like a word document with an excel graph and PowerPoint presentation. </li></ul></ul><ul><ul><li>But now the user instead of concentrating on the type of application , has to worry only about the work to be done. </li></ul></ul><ul><ul><li>The OS maintains a database of information where all applications installed on the system are listed. </li></ul></ul><ul><ul><li>The various types of files that each application can deal with are also listed which makes it easier for the OS to locate the application that should be started when the user needs to work on a particular type of a document. </li></ul></ul>
  3. 3. Document-View Architecture <ul><li>MFC’s Document-View architecture provides the skeleton framework for developing applications , like editors, file viewers and database query front ends, that manage disk-based data. </li></ul><ul><li>The document and the view together form the basis of the application framework. </li></ul><ul><li>The document stores the data and manages printing the data and coordinates updating multiple views of the data. </li></ul><ul><li>The view displays the data and manages user interaction with it, including selection and editing. </li></ul>
  4. 4. Document-View Architecture(contd..) <ul><li>As the name suggests the Doc-View architecture adds two new objects to the MFC programs- document and view. </li></ul><ul><ul><li>A document class derived from CDocument. </li></ul></ul><ul><ul><li>A view class derived from CView. </li></ul></ul><ul><ul><li>A frame class derived from CFrameWnd. </li></ul></ul><ul><ul><li>A application class derived from CWinApp. </li></ul></ul>
  5. 5. Document <ul><li>The document is a data object. </li></ul><ul><li>All user interaction (like in a word processor) is with the document. </li></ul><ul><li>The document is a non-visual object, it cannot receive messages but can respond to the messages. </li></ul><ul><li>The document is responsible for the application’s data. It is a data source and is widely used in word processors , spreadsheets and server to networks providing information to programs. </li></ul><ul><li>Irrespective of the source, data management is encapsulated within the document object. </li></ul>
  6. 6. View <ul><li>The view provides a visual display of the data to the user in a window or on a printed page. </li></ul><ul><li>It handles the interaction between the document and the user. </li></ul><ul><li>All user interaction with the data in the document is through the interface presented by the view. It can receive messages. For eg-word processing. </li></ul><ul><li>It can be a simple window, an SDI, an MDI or a class derived from CFormView having the capabilities of a dialog box. </li></ul>
  7. 7. Frame <ul><li>The frame class contains the view and other user-interface elements like tool bars and menus. </li></ul><ul><li>The frame and the view are visual components. </li></ul>
  8. 8. Application <ul><li>It is a non-visual component like the document. </li></ul><ul><li>It is responsible for starting the application and interacting with the windows. </li></ul>
  9. 9. Document-View Architecture CView View Windows File Edit View Help CFrameView CDocument CWinApp
  10. 10. Document and View
  11. 11. Features of Doc-View Architecture <ul><li>Data is handled and displayed separately . </li></ul><ul><li>Multiple views of the same document can be obtained, such as both a spreadsheet and a chart view. The document/view model lets a separate view object represent each view of the data, while code common to all views (such as a calculation engine) can reside in the document. </li></ul><ul><li>The document also takes on the task of updating all views whenever the data changes. </li></ul><ul><li>The MFC document/view architecture makes it easy to support multiple views, multiple document types, splitter windows, and other valuable user-interface features. </li></ul>
  12. 12. Types <ul><li>There are two basic types of Document-View applications- </li></ul><ul><ul><li>Single Document Interface. </li></ul></ul><ul><ul><ul><li>SDI applications support a single type of document and a single view. </li></ul></ul></ul><ul><ul><ul><li>Only one document can be opened at any point of time. </li></ul></ul></ul><ul><ul><ul><li>It focuses on a particular task. The frame window is also the main frame window for the application. </li></ul></ul></ul><ul><ul><li>Multiple Document Interface </li></ul></ul><ul><ul><ul><li>Supports multiple documents. </li></ul></ul></ul>