# DocumentApp

Derived from: public BApplication

Declared in: DocumentApp.h

Library: none

## Overview

Augments `BApplication` to provide facilities for registering windows and quitting when the last window closes. Also allows registration of "process holds" which will prevent the application from quitting until all worker threads holding such a hold have finished. When used with `FileDocumentWindow` while the application is quitting, it handles stalling and resuming the quit process without tying up the main application thread while child windows which have modified content prompt the user whether to Save, Don't Save, or Cancel.

## Constructor and Destructor

### DocumentApp()

          DocumentApp(const char* signature)

Creates a DocumentApp with the signature specified.

See also: the BApplication constructor

### ~DocumentApp()

          ~DocumentApp()

Does nothing

## Member Functions

### CancelQuitProcess()

          void CancelQuitProcess()

Cancels the quit process if the application is waiting for a window to get a response from the user to a Save, Don't Save, Camcel request.

### IsQuitInProgress()

          bool IsQuitInProgress()

Returns true if the application is waiting for the user to reply to a Save, Don't Save, Cancel request for one of its windows, but the application is in the process of quitting.

### QuitRequested()

          virtual bool QuitRequested()

Initiates the quit process so that when used with a `FileDocumentWindow`, even if the window returns false from QuitRequested, if the window returns false so as not to stall its message loop while waiting for the user to reply to a Save, Don't Save, Cancel request, if the user selects an option other than Cancel, the quit process will be resumed for the remaining windows, while if the user selects Cancel, the quit process will be terminated.

### RegisterWindow(), UnregisterWindow() , ProcessHold() , ProcessDone() , CountRegWindProcHolds()

          void RegisterWindow()
          void UnregisterWindow()
          void ProcessHold()
          void ProcessDone()
          int32 CountRegWindProcHolds()

RegisterWindow() or ProcessHold() informs the application that a window or background thread which should prevent the application from quitting has been created. When the last such window or process has called UnregisterWindow() or ProcessDone(), if there are no remaining windows or background threads, the application will quit. CoundRegWindProcHolds() returns the current number of registered windows and process holds.

By Brian Tietz

Copyright 2000

Bug reports (including documentation errors) and feature requests can be sent to briant@timelinevista.com.