[Classes] [Prev] [Next] [Methods]

CDocument

Methods Index

Heritage
Description
Usage
Protected Data Members
Friends
Public Methods
Constructor and Destructor Methods
CDocument Utilities
Window Methods
Event and Application Command Methods
Protected Methods
CDocument Utilities
Overrides

CDocument


Heritage

Superclass: CBoss

Subclasses: None


Description

The CDocument class resides at the second layer of the XVT-Power++ application framework. Like CApplication, CDocument has access to the functions on the menubar: Open, Close, Print, Save, and so on. CDocument objects create and manage a common set of windows:

A CDocument object can display the same data in one or more windows-in both a spreadsheet and a graph, for example. A wire frame document maintains any data shared by its windows. Finally, a particular CDocument may handle events, such as menu commands, that one of its windows has received.


Usage

This is an abstract class from which application-specific documents derive their properties. The user-defined CApplication-derived class has the responsibility to instantiate one or more user-defined and derived CDocument objects.

Group your application windows by functionality or other similarities and use one CDocument object to create and manage those windows. To derive a class from CDocument, overload the BuildWindow method, which is a pure virtual. Put into this method the code to create the specific type of view for the data. Typically, you will also overload the constructor so that it calls the BuildWindow method and starts the window. Also, DoCommand is a very good method to overload.


Protected Data Members

RWOrdered* itsWindows; List of the document's windows
FILE_SPEC* itsXVTFilePointer; Pointer to document file
CEnvironment* itsEnvironment; Contains the environment (colors, fonts, pen width, and so on)
CApplication* itsApplication; Its creator
BOOLEAN itIsSaved; Whether the data needs to be saved

Friends

friend class CWindow; Allows windows to self-add and self-remove


Public Methods

Constructor and Destructor Methods

CDocument(CApplication* theapplication,
long theid = PWRIdBase);
CDocument(const CDocument& theDocument);
CDocument& operator= (const CDocument& theDocument);
virtual ~CDocument(void);

CDocument Utilities

BOOLEAN NeedsSaving(void) const;
void SetSave(BOOLEAN needsSaving);
virtual BOOLEAN IsEnvironmentShared(void) const;
virtual const CEnvironment* GetEnvironment(void) const;
virtual void SetEnvironment(
const CEnvironment& theNewEnvironment,
BOOLEAN isUpdate = FALSE);
virtual void DoSetEnvironment(
const CEnvironment& theEnvironment,
BOOLEAN isUpdate = FALSE);
virtual void ChangeFont(const CFont &theFont);
virtual PRINT_RCD* GetPrintRecord(void) const;

Window Methods

virtual void BuildWindow(void) = 0;
virtual void CloseAll(void);
virtual CWindow* FindWindow(
long theId = PWRIdBase) const;
int GetNumWindows(void);
const RWOrdered* GetWindows(void) const;

Event and Application Command Methods

virtual void DoCommand(long theCommand, 
void* theData=NULL);
virtual void DoKey(const CKey&);
virtual void DoTimer(long theTimerId);
virtual void DoUser(long theUserId, void* theData);
virtual BOOLEAN DoClose(void);

Override:

virtual BOOLEAN DoPageSetUp(void);
virtual BOOLEAN DoPrint(void);
virtual BOOLEAN DoOpen(void);
virtual BOOLEAN DoSave(void);
virtual BOOLEAN DoSaveAs(void);
virtual BOOLEAN DoNew(void);
virtual void DoMenuCommand(MENU_TAG theMenuItem,
BOOLEAN isShiftKey,
BOOLEAN isControlKey);
virtual void UpdateMenus(CMenuBar* theMenuBar);
virtual const RWOrdered* GetSubObjects(void) const;

Protected Methods

BOOLEAN IDocument();

CDocument Utilities

virtual BOOLEAN CloseWindow(CWindow *theWindow);
virtual void RemoveWindow(CWindow *theWindow);
virtual void AddWindow(CWindow * theWindow);

Overrides

You must override BuildWindow in order to attach windows to the document.



[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.