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