nsISound.idl 2.5 KB

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