Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | interface nsIURL; |
michael@0 | 10 | |
michael@0 | 11 | [scriptable, uuid(C3C28D92-A17F-43DF-976D-4EEAE6F995FC)] |
michael@0 | 12 | interface nsISound : nsISupports |
michael@0 | 13 | { |
michael@0 | 14 | void play(in nsIURL aURL); |
michael@0 | 15 | /** |
michael@0 | 16 | * for playing system sounds |
michael@0 | 17 | * |
michael@0 | 18 | * NS_SYSSOUND_* params are obsolete. The new events will not be supported by |
michael@0 | 19 | * this method. You should use playEventSound method instaed. |
michael@0 | 20 | */ |
michael@0 | 21 | void playSystemSound(in AString soundAlias); |
michael@0 | 22 | void beep(); |
michael@0 | 23 | |
michael@0 | 24 | /** |
michael@0 | 25 | * Not strictly necessary, but avoids delay before first sound. |
michael@0 | 26 | * The various methods on nsISound call Init() if they need to. |
michael@0 | 27 | */ |
michael@0 | 28 | void init(); |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * In some situations, playEventSound will be called. Then, each |
michael@0 | 32 | * implementations will play a system sound for the event if it's necessary. |
michael@0 | 33 | * |
michael@0 | 34 | * NOTE: Don't change these values because they are used in |
michael@0 | 35 | * nsPIPromptService.idl. So, if they are changed, that makes big impact for |
michael@0 | 36 | * the embedders. |
michael@0 | 37 | */ |
michael@0 | 38 | const unsigned long EVENT_NEW_MAIL_RECEIVED = 0; |
michael@0 | 39 | const unsigned long EVENT_ALERT_DIALOG_OPEN = 1; |
michael@0 | 40 | const unsigned long EVENT_CONFIRM_DIALOG_OPEN = 2; |
michael@0 | 41 | const unsigned long EVENT_PROMPT_DIALOG_OPEN = 3; |
michael@0 | 42 | const unsigned long EVENT_SELECT_DIALOG_OPEN = 4; |
michael@0 | 43 | const unsigned long EVENT_MENU_EXECUTE = 5; |
michael@0 | 44 | const unsigned long EVENT_MENU_POPUP = 6; |
michael@0 | 45 | const unsigned long EVENT_EDITOR_MAX_LEN = 7; |
michael@0 | 46 | void playEventSound(in unsigned long aEventId); |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | %{C++ |
michael@0 | 50 | |
michael@0 | 51 | /** |
michael@0 | 52 | * NS_SYSSOUND_* can be used for playSystemSound but they are obsolete. |
michael@0 | 53 | * Use nsISound::playEventSound instead. |
michael@0 | 54 | */ |
michael@0 | 55 | #define NS_SYSSOUND_PREFIX NS_LITERAL_STRING("_moz_") |
michael@0 | 56 | #define NS_SYSSOUND_MAIL_BEEP NS_LITERAL_STRING("_moz_mailbeep") |
michael@0 | 57 | #define NS_SYSSOUND_ALERT_DIALOG NS_LITERAL_STRING("_moz_alertdialog") |
michael@0 | 58 | #define NS_SYSSOUND_CONFIRM_DIALOG NS_LITERAL_STRING("_moz_confirmdialog") |
michael@0 | 59 | #define NS_SYSSOUND_PROMPT_DIALOG NS_LITERAL_STRING("_moz_promptdialog") |
michael@0 | 60 | #define NS_SYSSOUND_SELECT_DIALOG NS_LITERAL_STRING("_moz_selectdialog") |
michael@0 | 61 | #define NS_SYSSOUND_MENU_EXECUTE NS_LITERAL_STRING("_moz_menucommand") |
michael@0 | 62 | #define NS_SYSSOUND_MENU_POPUP NS_LITERAL_STRING("_moz_menupopup") |
michael@0 | 63 | |
michael@0 | 64 | #define NS_IsMozAliasSound(aSoundAlias) \ |
michael@0 | 65 | StringBeginsWith(aSoundAlias, NS_SYSSOUND_PREFIX) |
michael@0 | 66 | |
michael@0 | 67 | %} |