embedding/components/windowwatcher/public/nsIPromptService.idl

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIDOMWindow;
michael@0 9
michael@0 10 /**
michael@0 11 * This is the interface to the embeddable prompt service; the service that
michael@0 12 * implements nsIPrompt. Its interface is designed to be just nsIPrompt, each
michael@0 13 * method modified to take a parent window parameter.
michael@0 14 *
michael@0 15 * Accesskeys can be attached to buttons and checkboxes by inserting an &
michael@0 16 * before the accesskey character in the checkbox message or button title. For
michael@0 17 * a real &, use && instead. (A "button title" generally refers to the text
michael@0 18 * label of a button.)
michael@0 19 *
michael@0 20 * One note: in all cases, the parent window parameter can be null. However,
michael@0 21 * these windows are all intended to have parents. So when no parent is
michael@0 22 * specified, the implementation should try hard to find a suitable foster
michael@0 23 * parent.
michael@0 24 *
michael@0 25 * Implementations are free to choose how they present the various button
michael@0 26 * types. For example, while prompts that give the user a choice between OK
michael@0 27 * and Cancel are required to return a boolean value indicating whether or not
michael@0 28 * the user accepted the prompt (pressed OK) or rejected the prompt (pressed
michael@0 29 * Cancel), the implementation of this interface could very well speak the
michael@0 30 * prompt to the user instead of rendering any visual user-interface. The
michael@0 31 * standard button types are merely idioms used to convey the nature of the
michael@0 32 * choice the user is to make.
michael@0 33 *
michael@0 34 * Because implementations of this interface may loosely interpret the various
michael@0 35 * button types, it is advised that text messages passed to these prompts do
michael@0 36 * not refer to the button types by name. For example, it is inadvisable to
michael@0 37 * tell the user to "Press OK to proceed." Instead, such a prompt might be
michael@0 38 * rewritten to ask the user: "Would you like to proceed?"
michael@0 39 */
michael@0 40 [scriptable, uuid(1630C61A-325E-49ca-8759-A31B16C47AA5)]
michael@0 41 interface nsIPromptService : nsISupports
michael@0 42 {
michael@0 43 /**
michael@0 44 * Puts up an alert dialog with an OK button.
michael@0 45 *
michael@0 46 * @param aParent
michael@0 47 * The parent window or null.
michael@0 48 * @param aDialogTitle
michael@0 49 * Text to appear in the title of the dialog.
michael@0 50 * @param aText
michael@0 51 * Text to appear in the body of the dialog.
michael@0 52 */
michael@0 53 void alert(in nsIDOMWindow aParent,
michael@0 54 in wstring aDialogTitle,
michael@0 55 in wstring aText);
michael@0 56
michael@0 57 /**
michael@0 58 * Puts up an alert dialog with an OK button and a labeled checkbox.
michael@0 59 *
michael@0 60 * @param aParent
michael@0 61 * The parent window or null.
michael@0 62 * @param aDialogTitle
michael@0 63 * Text to appear in the title of the dialog.
michael@0 64 * @param aText
michael@0 65 * Text to appear in the body of the dialog.
michael@0 66 * @param aCheckMsg
michael@0 67 * Text to appear with the checkbox.
michael@0 68 * @param aCheckState
michael@0 69 * Contains the initial checked state of the checkbox when this method
michael@0 70 * is called and the final checked state after this method returns.
michael@0 71 */
michael@0 72 void alertCheck(in nsIDOMWindow aParent,
michael@0 73 in wstring aDialogTitle,
michael@0 74 in wstring aText,
michael@0 75 in wstring aCheckMsg,
michael@0 76 inout boolean aCheckState);
michael@0 77
michael@0 78 /**
michael@0 79 * Puts up a dialog with OK and Cancel buttons.
michael@0 80 *
michael@0 81 * @param aParent
michael@0 82 * The parent window or null.
michael@0 83 * @param aDialogTitle
michael@0 84 * Text to appear in the title of the dialog.
michael@0 85 * @param aText
michael@0 86 * Text to appear in the body of the dialog.
michael@0 87 *
michael@0 88 * @return true for OK, false for Cancel
michael@0 89 */
michael@0 90 boolean confirm(in nsIDOMWindow aParent,
michael@0 91 in wstring aDialogTitle,
michael@0 92 in wstring aText);
michael@0 93
michael@0 94 /**
michael@0 95 * Puts up a dialog with OK and Cancel buttons and a labeled checkbox.
michael@0 96 *
michael@0 97 * @param aParent
michael@0 98 * The parent window or null.
michael@0 99 * @param aDialogTitle
michael@0 100 * Text to appear in the title of the dialog.
michael@0 101 * @param aText
michael@0 102 * Text to appear in the body of the dialog.
michael@0 103 * @param aCheckMsg
michael@0 104 * Text to appear with the checkbox.
michael@0 105 * @param aCheckState
michael@0 106 * Contains the initial checked state of the checkbox when this method
michael@0 107 * is called and the final checked state after this method returns.
michael@0 108 *
michael@0 109 * @return true for OK, false for Cancel
michael@0 110 */
michael@0 111 boolean confirmCheck(in nsIDOMWindow aParent,
michael@0 112 in wstring aDialogTitle,
michael@0 113 in wstring aText,
michael@0 114 in wstring aCheckMsg,
michael@0 115 inout boolean aCheckState);
michael@0 116
michael@0 117 /**
michael@0 118 * Button Flags
michael@0 119 *
michael@0 120 * The following flags are combined to form the aButtonFlags parameter passed
michael@0 121 * to confirmEx. See confirmEx for more information on how the flags may be
michael@0 122 * combined.
michael@0 123 */
michael@0 124
michael@0 125 /**
michael@0 126 * Button Position Flags
michael@0 127 */
michael@0 128 const unsigned long BUTTON_POS_0 = 1;
michael@0 129 const unsigned long BUTTON_POS_1 = 1 << 8;
michael@0 130 const unsigned long BUTTON_POS_2 = 1 << 16;
michael@0 131
michael@0 132 /**
michael@0 133 * Button Title Flags (used to set the labels of buttons in the prompt)
michael@0 134 */
michael@0 135 const unsigned long BUTTON_TITLE_OK = 1;
michael@0 136 const unsigned long BUTTON_TITLE_CANCEL = 2;
michael@0 137 const unsigned long BUTTON_TITLE_YES = 3;
michael@0 138 const unsigned long BUTTON_TITLE_NO = 4;
michael@0 139 const unsigned long BUTTON_TITLE_SAVE = 5;
michael@0 140 const unsigned long BUTTON_TITLE_DONT_SAVE = 6;
michael@0 141 const unsigned long BUTTON_TITLE_REVERT = 7;
michael@0 142 const unsigned long BUTTON_TITLE_IS_STRING = 127;
michael@0 143
michael@0 144 /**
michael@0 145 * Button Default Flags (used to select which button is the default one)
michael@0 146 */
michael@0 147 const unsigned long BUTTON_POS_0_DEFAULT = 0;
michael@0 148 const unsigned long BUTTON_POS_1_DEFAULT = 1 << 24;
michael@0 149 const unsigned long BUTTON_POS_2_DEFAULT = 1 << 25;
michael@0 150
michael@0 151 /**
michael@0 152 * Causes the buttons to be initially disabled. They are enabled after a
michael@0 153 * timeout expires. The implementation may interpret this loosely as the
michael@0 154 * intent is to ensure that the user does not click through a security dialog
michael@0 155 * too quickly. Strictly speaking, the implementation could choose to ignore
michael@0 156 * this flag.
michael@0 157 */
michael@0 158 const unsigned long BUTTON_DELAY_ENABLE = 1 << 26;
michael@0 159
michael@0 160 /**
michael@0 161 * Selects the standard set of OK/Cancel buttons.
michael@0 162 */
michael@0 163 const unsigned long STD_OK_CANCEL_BUTTONS = (BUTTON_TITLE_OK * BUTTON_POS_0) +
michael@0 164 (BUTTON_TITLE_CANCEL * BUTTON_POS_1);
michael@0 165
michael@0 166 /**
michael@0 167 * Selects the standard set of Yes/No buttons.
michael@0 168 */
michael@0 169 const unsigned long STD_YES_NO_BUTTONS = (BUTTON_TITLE_YES * BUTTON_POS_0) +
michael@0 170 (BUTTON_TITLE_NO * BUTTON_POS_1);
michael@0 171
michael@0 172
michael@0 173 /**
michael@0 174 * Puts up a dialog with up to 3 buttons and an optional, labeled checkbox.
michael@0 175 *
michael@0 176 * @param aParent
michael@0 177 * The parent window or null.
michael@0 178 * @param aDialogTitle
michael@0 179 * Text to appear in the title of the dialog.
michael@0 180 * @param aText
michael@0 181 * Text to appear in the body of the dialog.
michael@0 182 * @param aButtonFlags
michael@0 183 * A combination of Button Flags.
michael@0 184 * @param aButton0Title
michael@0 185 * Used when button 0 uses TITLE_IS_STRING
michael@0 186 * @param aButton1Title
michael@0 187 * Used when button 1 uses TITLE_IS_STRING
michael@0 188 * @param aButton2Title
michael@0 189 * Used when button 2 uses TITLE_IS_STRING
michael@0 190 * @param aCheckMsg
michael@0 191 * Text to appear with the checkbox. Null if no checkbox.
michael@0 192 * @param aCheckState
michael@0 193 * Contains the initial checked state of the checkbox when this method
michael@0 194 * is called and the final checked state after this method returns.
michael@0 195 *
michael@0 196 * @return index of the button pressed.
michael@0 197 *
michael@0 198 * Buttons are numbered 0 - 2. The implementation can decide whether the
michael@0 199 * sequence goes from right to left or left to right. Button 0 is the
michael@0 200 * default button unless one of the Button Default Flags is specified.
michael@0 201 *
michael@0 202 * A button may use a predefined title, specified by one of the Button Title
michael@0 203 * Flags values. Each title value can be multiplied by a position value to
michael@0 204 * assign the title to a particular button. If BUTTON_TITLE_IS_STRING is
michael@0 205 * used for a button, the string parameter for that button will be used. If
michael@0 206 * the value for a button position is zero, the button will not be shown.
michael@0 207 *
michael@0 208 * In general, aButtonFlags is constructed per the following example:
michael@0 209 *
michael@0 210 * aButtonFlags = (BUTTON_POS_0) * (BUTTON_TITLE_AAA) +
michael@0 211 * (BUTTON_POS_1) * (BUTTON_TITLE_BBB) +
michael@0 212 * BUTTON_POS_1_DEFAULT;
michael@0 213 *
michael@0 214 * where "AAA" and "BBB" correspond to one of the button titles.
michael@0 215 */
michael@0 216 int32_t confirmEx(in nsIDOMWindow aParent,
michael@0 217 in wstring aDialogTitle,
michael@0 218 in wstring aText,
michael@0 219 in unsigned long aButtonFlags,
michael@0 220 in wstring aButton0Title,
michael@0 221 in wstring aButton1Title,
michael@0 222 in wstring aButton2Title,
michael@0 223 in wstring aCheckMsg,
michael@0 224 inout boolean aCheckState);
michael@0 225
michael@0 226 /**
michael@0 227 * Puts up a dialog with an edit field and an optional, labeled checkbox.
michael@0 228 *
michael@0 229 * @param aParent
michael@0 230 * The parent window or null.
michael@0 231 * @param aDialogTitle
michael@0 232 * Text to appear in the title of the dialog.
michael@0 233 * @param aText
michael@0 234 * Text to appear in the body of the dialog.
michael@0 235 * @param aValue
michael@0 236 * Contains the default value for the dialog field when this method
michael@0 237 * is called (null value is ok). Upon return, if the user pressed
michael@0 238 * OK, then this parameter contains a newly allocated string value.
michael@0 239 * Otherwise, the parameter's value is unmodified.
michael@0 240 * @param aCheckMsg
michael@0 241 * Text to appear with the checkbox. If null, check box will not be shown.
michael@0 242 * @param aCheckState
michael@0 243 * Contains the initial checked state of the checkbox when this method
michael@0 244 * is called and the final checked state after this method returns.
michael@0 245 *
michael@0 246 * @return true for OK, false for Cancel.
michael@0 247 */
michael@0 248 boolean prompt(in nsIDOMWindow aParent,
michael@0 249 in wstring aDialogTitle,
michael@0 250 in wstring aText,
michael@0 251 inout wstring aValue,
michael@0 252 in wstring aCheckMsg,
michael@0 253 inout boolean aCheckState);
michael@0 254
michael@0 255 /**
michael@0 256 * Puts up a dialog with an edit field, a password field, and an optional,
michael@0 257 * labeled checkbox.
michael@0 258 *
michael@0 259 * @param aParent
michael@0 260 * The parent window or null.
michael@0 261 * @param aDialogTitle
michael@0 262 * Text to appear in the title of the dialog.
michael@0 263 * @param aText
michael@0 264 * Text to appear in the body of the dialog.
michael@0 265 * @param aUsername
michael@0 266 * Contains the default value for the username field when this method
michael@0 267 * is called (null value is ok). Upon return, if the user pressed OK,
michael@0 268 * then this parameter contains a newly allocated string value.
michael@0 269 * Otherwise, the parameter's value is unmodified.
michael@0 270 * @param aPassword
michael@0 271 * Contains the default value for the password field when this method
michael@0 272 * is called (null value is ok). Upon return, if the user pressed OK,
michael@0 273 * then this parameter contains a newly allocated string value.
michael@0 274 * Otherwise, the parameter's value is unmodified.
michael@0 275 * @param aCheckMsg
michael@0 276 * Text to appear with the checkbox. If null, check box will not be shown.
michael@0 277 * @param aCheckState
michael@0 278 * Contains the initial checked state of the checkbox when this method
michael@0 279 * is called and the final checked state after this method returns.
michael@0 280 *
michael@0 281 * @return true for OK, false for Cancel.
michael@0 282 */
michael@0 283 boolean promptUsernameAndPassword(in nsIDOMWindow aParent,
michael@0 284 in wstring aDialogTitle,
michael@0 285 in wstring aText,
michael@0 286 inout wstring aUsername,
michael@0 287 inout wstring aPassword,
michael@0 288 in wstring aCheckMsg,
michael@0 289 inout boolean aCheckState);
michael@0 290
michael@0 291 /**
michael@0 292 * Puts up a dialog with a password field and an optional, labeled checkbox.
michael@0 293 *
michael@0 294 * @param aParent
michael@0 295 * The parent window or null.
michael@0 296 * @param aDialogTitle
michael@0 297 * Text to appear in the title of the dialog.
michael@0 298 * @param aText
michael@0 299 * Text to appear in the body of the dialog.
michael@0 300 * @param aPassword
michael@0 301 * Contains the default value for the password field when this method
michael@0 302 * is called (null value is ok). Upon return, if the user pressed OK,
michael@0 303 * then this parameter contains a newly allocated string value.
michael@0 304 * Otherwise, the parameter's value is unmodified.
michael@0 305 * @param aCheckMsg
michael@0 306 * Text to appear with the checkbox. If null, check box will not be shown.
michael@0 307 * @param aCheckState
michael@0 308 * Contains the initial checked state of the checkbox when this method
michael@0 309 * is called and the final checked state after this method returns.
michael@0 310 *
michael@0 311 * @return true for OK, false for Cancel.
michael@0 312 */
michael@0 313 boolean promptPassword(in nsIDOMWindow aParent,
michael@0 314 in wstring aDialogTitle,
michael@0 315 in wstring aText,
michael@0 316 inout wstring aPassword,
michael@0 317 in wstring aCheckMsg,
michael@0 318 inout boolean aCheckState);
michael@0 319
michael@0 320 /**
michael@0 321 * Puts up a dialog box which has a list box of strings from which the user
michael@0 322 * may make a single selection.
michael@0 323 *
michael@0 324 * @param aParent
michael@0 325 * The parent window or null.
michael@0 326 * @param aDialogTitle
michael@0 327 * Text to appear in the title of the dialog.
michael@0 328 * @param aText
michael@0 329 * Text to appear in the body of the dialog.
michael@0 330 * @param aCount
michael@0 331 * The length of the aSelectList array parameter.
michael@0 332 * @param aSelectList
michael@0 333 * The list of strings to display.
michael@0 334 * @param aOutSelection
michael@0 335 * Contains the index of the selected item in the list when this
michael@0 336 * method returns true.
michael@0 337 *
michael@0 338 * @return true for OK, false for Cancel.
michael@0 339 */
michael@0 340 boolean select(in nsIDOMWindow aParent,
michael@0 341 in wstring aDialogTitle,
michael@0 342 in wstring aText,
michael@0 343 in uint32_t aCount,
michael@0 344 [array, size_is(aCount)] in wstring aSelectList,
michael@0 345 out long aOutSelection);
michael@0 346 };

mercurial