/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1998
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Bill Law    law@netscape.com
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsIDownload.idl"

interface nsIDOMWindow;
interface nsIObserver;

/* nsIProgressDialog
 *
 * These objects are used to display progress notifications to the user.
 * They are displayed while files are being saved to disk, for example.
 * 
 * Typical usage is to:
 *   1. Create an instance, via the component manager CreateInstance()
 *      method.
 *   2. Set appropriate attributes that control the display and behavior
 *      of the dialog.
 *   3. Open the dialog.
 *   4. Send progress notifications to the dialog, via its
 *      nsIDownloadProgressListener methods.
 *   5. Close the dialog when the operation completes, or when the user
 *      closes it manually.
 *   6. Release the instance.  The instance will be referenced by
 *      the dialog itself, so it won't get freed until the dialog closes.
 *      The dialog will keep the instance alive, so typically one does
 *      not need to hold a reference to it.
 */

[scriptable, uuid(20e790a2-76c6-462d-851a-22ab6cbbe48b)]
interface nsIProgressDialog : nsIDownload {
   /**
    * Open the dialog
    *
    * @param aParent  Parent window; optional (if null, then
    *                 a top-level window is created)
    */
   void open( in nsIDOMWindow aParent );
   
   /**
    * Whether the download should be cancelled when the progress
    * dialog is closed using the standard OS close box.  This is
    * useful for showing the progress dialog as an information
    * window, which is what download manager does.
    */
   attribute PRBool cancelDownloadOnClose;

   /**
    * Observer for this dialog. If set, receives the following topics:
    *   oncancel - observer should cancel the transfer
    *   onpause  - observer should suspend the transfer
    *   onresume - observer should resume the suspended transfer
    * For each of those, the subject will be the nsIProgressDialog.
    */
   attribute nsIObserver observer;

  /**
   * The dialog object itself.  This might be null if the dialog isn't
   * open yet, or has been closed.
   */   
   attribute nsIDOMWindow dialog;
};


