1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/nsISound.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +interface nsIURL; 1.13 + 1.14 +[scriptable, uuid(C3C28D92-A17F-43DF-976D-4EEAE6F995FC)] 1.15 +interface nsISound : nsISupports 1.16 +{ 1.17 + void play(in nsIURL aURL); 1.18 + /** 1.19 + * for playing system sounds 1.20 + * 1.21 + * NS_SYSSOUND_* params are obsolete. The new events will not be supported by 1.22 + * this method. You should use playEventSound method instaed. 1.23 + */ 1.24 + void playSystemSound(in AString soundAlias); 1.25 + void beep(); 1.26 + 1.27 + /** 1.28 + * Not strictly necessary, but avoids delay before first sound. 1.29 + * The various methods on nsISound call Init() if they need to. 1.30 + */ 1.31 + void init(); 1.32 + 1.33 + /** 1.34 + * In some situations, playEventSound will be called. Then, each 1.35 + * implementations will play a system sound for the event if it's necessary. 1.36 + * 1.37 + * NOTE: Don't change these values because they are used in 1.38 + * nsPIPromptService.idl. So, if they are changed, that makes big impact for 1.39 + * the embedders. 1.40 + */ 1.41 + const unsigned long EVENT_NEW_MAIL_RECEIVED = 0; 1.42 + const unsigned long EVENT_ALERT_DIALOG_OPEN = 1; 1.43 + const unsigned long EVENT_CONFIRM_DIALOG_OPEN = 2; 1.44 + const unsigned long EVENT_PROMPT_DIALOG_OPEN = 3; 1.45 + const unsigned long EVENT_SELECT_DIALOG_OPEN = 4; 1.46 + const unsigned long EVENT_MENU_EXECUTE = 5; 1.47 + const unsigned long EVENT_MENU_POPUP = 6; 1.48 + const unsigned long EVENT_EDITOR_MAX_LEN = 7; 1.49 + void playEventSound(in unsigned long aEventId); 1.50 +}; 1.51 + 1.52 +%{C++ 1.53 + 1.54 +/** 1.55 + * NS_SYSSOUND_* can be used for playSystemSound but they are obsolete. 1.56 + * Use nsISound::playEventSound instead. 1.57 + */ 1.58 +#define NS_SYSSOUND_PREFIX NS_LITERAL_STRING("_moz_") 1.59 +#define NS_SYSSOUND_MAIL_BEEP NS_LITERAL_STRING("_moz_mailbeep") 1.60 +#define NS_SYSSOUND_ALERT_DIALOG NS_LITERAL_STRING("_moz_alertdialog") 1.61 +#define NS_SYSSOUND_CONFIRM_DIALOG NS_LITERAL_STRING("_moz_confirmdialog") 1.62 +#define NS_SYSSOUND_PROMPT_DIALOG NS_LITERAL_STRING("_moz_promptdialog") 1.63 +#define NS_SYSSOUND_SELECT_DIALOG NS_LITERAL_STRING("_moz_selectdialog") 1.64 +#define NS_SYSSOUND_MENU_EXECUTE NS_LITERAL_STRING("_moz_menucommand") 1.65 +#define NS_SYSSOUND_MENU_POPUP NS_LITERAL_STRING("_moz_menupopup") 1.66 + 1.67 +#define NS_IsMozAliasSound(aSoundAlias) \ 1.68 + StringBeginsWith(aSoundAlias, NS_SYSSOUND_PREFIX) 1.69 + 1.70 +%}