/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * The contents of this file are subject to the Netscape 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/NPL/
 *
 * 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 Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s): 
 */

#include "nsISupports.idl"
#include "nsIDialogParamBlock.idl"
#include "domstubs.idl"
%{C++
class nsIFactory;

#define NS_CommonDialog_CID \
{ 0xc01ad084, 0x4915, 0x11d3, { 0xb7, 0xa0, 0x85, 0xcf, 0x55, 0xc3, 0x52, 0x3c } }
%}

[scriptable, uuid(c01ad082-4915-11d3-b7a0-85cf55c3523c)]
interface nsICommonDialogs : nsISupports
{
%{C++
  enum {  eMsg =0, eCheckboxMsg =1, eIconURL =2 , eTitleMessage =3, eEditfield1Msg =4, eEditfield2Msg =5, eEditfield1Value = 6, eEditfield2Value = 7,
		eButton0Text = 8, eButton1Text = 9, eButton2Text =10, eButton3Text = 11,eDialogTitle = 12 };
enum { eButtonPressed = 0, eCheckboxState = 1, eNumberButtons = 2, eNumberEditfields =3, eEditField1Password =4 };
%}

			
    /**
     * Puts up an alert dialog with an OK button.
     */
    void Alert(in nsIDOMWindow inParent, in wstring inDialogTitle, in wstring inMsg);

    /**
     * Puts up a dialog with OK button, and
     * a message with a single checkbox.
     * @return the value of the checkbox.
     */
    void AlertCheck(in nsIDOMWindow inParent, in wstring inDialogTitle, in wstring inMsg,
                         in wstring inCheckMsg, inout boolean outCheckValue);

    /**
     * Puts up a dialog with OK and Cancel buttons.
     * @return true for OK, false for Cancel
     */
    boolean Confirm(in nsIDOMWindow inParent, in wstring inDialogTitle, in wstring inMsg);

    /**
     * Puts up a dialog with OK and Cancel buttons, and
     * a message with a single checkbox.
     * @return true for OK, false for Cancel
     */
    boolean ConfirmCheck(in nsIDOMWindow inParent, in wstring inDialogTitle, in wstring inMsg,
                         in wstring inCheckMsg,
                         inout boolean outCheckValue);

    /**
     * Puts up a text input dialog with OK and Cancel buttons.
     * @return true for OK, false for Cancel
     */
    boolean Prompt(in nsIDOMWindow inParent,in wstring inDialogTitle, in wstring inMsg,
                   in wstring inDefaultText, 
                   out wstring result);

    /**
     * Puts up a username/password dialog with OK and Cancel buttons.
     * @return true for OK, false for Cancel
     */
    boolean PromptUsernameAndPassword(in nsIDOMWindow inParent,
    								  in wstring inDialogTitle,
    								  in wstring inMsg,
                                      out wstring outUser, 
                                      out wstring outPassword);

    /**
     * Puts up a password dialog with OK and Cancel buttons.
     * @return true for OK, false for Cancel
     */
    boolean PromptPassword( in nsIDOMWindow inParent,
    						in wstring inDialogTitle,
    						in wstring inMsg, 
                           out wstring outPassword);
     /*
     	Puts up a dialog box which has a list box of strings. return true/false for OK/Cancel
     */                      
                           
    boolean Select( in nsIDOMWindow inParent,
    				in wstring inDialogTitle,
    				in wstring inMsg,
    				 in  PRUint32 inCount,
    				 [array,size_is(inCount) ] in wstring inList, 
                     out long outSelection );                       

    /**
     * Put up a universal dialog
     */
    void UniversalDialog
      (in nsIDOMWindow inParent,
      in wstring inTitleMessage,
      in wstring inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */
      in wstring inMsg, /* main message for dialog */
      in wstring inCheckboxMsg, /* message for checkbox */
      in wstring inButton0Text, /* text for first button */
      in wstring inButton1Text, /* text for second button */
      in wstring inButton2Text, /* text for third button */
      in wstring inButton3Text, /* text for fourth button */
      in wstring inEditfield1Msg, /*message for first edit field */
      in wstring inEditfield2Msg, /* message for second edit field */
      inout wstring inEditfield1Value, /* initial and final value for first edit field */
      inout wstring inEditfield2Value, /* initial and final value for second edit field */
      in wstring inIConURL, /* url of icon to be displayed in dialog */
      inout boolean outCheckboxState, /* initial and final state of check box */
      in PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */
      in PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */
      in PRInt32 inEditField1Password, /* is first edit field a password field */
      out PRInt32 outButtonPressed); /* number of button that was pressed (0 to 3) */

   /*
   	Core Dialog function
   */
   void DoDialog(in nsIDOMWindow inParent, in nsIDialogParamBlock ioParamBlock, in string inChromeURL );
};

%{C++
extern nsresult NS_NewCommonDialogsFactory(nsIFactory** aResult);
%}
