vc++ 3

12
Visual C++ Programming Visual C++ Programming Document View Architecture

Upload: raman-rv

Post on 18-Nov-2014

848 views

Category:

Education


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Vc++ 3

Visual C++ ProgrammingVisual C++ Programming

Document View Architecture

Page 2: Vc++ 3

Document-Centric Computing Document-Centric Computing • Applications on most of the OS require the user to know

which applications must be used to create documents of a specific type.

• 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.

• But now the user instead of concentrating on the type of application , has to worry only about the work to be done.

• The OS maintains a database of information where all applications installed on the system are listed.

• 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.

Page 3: Vc++ 3

Document-View ArchitectureDocument-View Architecture

• 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.

• The document and the view together form the basis of the application framework.

• The document stores the data and manages printing the data and coordinates updating multiple views of the data.

• The view displays the data and manages user interaction with it, including selection and editing.

Page 4: Vc++ 3

Document-View Architecture(contd..)Document-View Architecture(contd..)

• As the name suggests the Doc-View architecture adds two new objects to the MFC programs-document and view.– A document class derived from CDocument.– A view class derived from CView.– A frame class derived from CFrameWnd.– A application class derived from CWinApp.

Page 5: Vc++ 3

DocumentDocument

• The document is a data object.• All user interaction (like in a word processor) is with

the document.• The document is a non-visual object, it cannot receive

messages but can respond to the messages.• 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.

• Irrespective of the source, data management is encapsulated within the document object.

Page 6: Vc++ 3

ViewView

• The view provides a visual display of the data to the user in a window or on a printed page.

• It handles the interaction between the document and the user.

• 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.

• It can be a simple window, an SDI, an MDI or a class derived from CFormView having the capabilities of a dialog box.

Page 7: Vc++ 3

FrameFrame

• The frame class contains the view and other user-interface elements like tool bars and menus.

• The frame and the view are visual components.

Page 8: Vc++ 3

ApplicationApplication

• It is a non-visual component like the document.

• It is responsible for starting the application and interacting with the windows.

Page 9: Vc++ 3

Document-View ArchitectureDocument-View Architecture

CView

WindowsWindows

File Edit View Help File Edit View Help

CFrameView

CDocument

CWinApp

View

Page 10: Vc++ 3

Document and ViewDocument and View

Page 11: Vc++ 3

Features of Doc-View ArchitectureFeatures of Doc-View Architecture• Data is handled and displayed separately .• 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.

• The document also takes on the task of updating all views whenever the data changes.

• The MFC document/view architecture makes it easy to support multiple views, multiple document types, splitter windows, and other valuable user-interface features.

Page 12: Vc++ 3

TypesTypes

• There are two basic types of Document-View applications-– Single Document Interface.• SDI applications support a single type of document and

a single view.• Only one document can be opened at any point of

time.• It focuses on a particular task. The frame window is

also the main frame window for the application.– Multiple Document Interface• Supports multiple documents.