Window Utilities (WinUtils)
This section describes the utilities defined in the files WinUtils.h and WinUtils.cpp. When you're reopening a window at document-launch time, you can use these utilities to retrieve the window properties stored with the root frame of any persistently stored window.Retrieving Window Properties
When a saved document is opened, OpenDoc retrieves the root frame of each saved window and calls theOpenmethod of the part belonging to that frame, passing the frame. The part is responsible for recreating the platform window and creating anODWindowobject using theRegisterWindowForFramemethod.The properties of the window are saved in a storage unit referenced from the root frame. The utility functions
BeginGetWindowPropertiesandEndGetWindowPropertiescan be used to retrieve these properties without using the storage system API directly.Using the Window Utilities
The window utilities functions allow a part editor to obtain the properties necessary to create a window from the storage annotation on a root frame. TheBeginGetWindowPropertiesfunction returnskODTrueif the annotation exists and fills in thepropertiesstructure. TheEndGetWindPropertiesfunction releases the frame specified in thesourceFramefield of the structure.The following code fragment illustrates use of the window utilities:
WindowProperties props; ODWindow* window = kODNULL; if (BeginGetWindowProperties(ev, frame, &props)) { ODPlatformWindow platformWindow = NewCWindow(kODNULL, &(props.boundsRect), props.title, kODFalse, props.procID, (WindowPtr)-1L, props.hasCloseBox, props.refCon); window = fSession->GetWindowState(ev)-> RegisterWindowForFrame(ev, platformWindow, frame, props.isRootWindow,// keeps draft open kODTrue,// is resizable kODFalse,// is floating kODTrue,// shouldSave props.sourceFrame); EndGetWindowProperties(ev, &props); // release source frame }
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help