/indra/newview/llappviewerlistener.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 61 lines · 23 code · 4 blank · 34 comment · 0 complexity · 754436e1a1082d196a808ce9e9d01555 MD5 · raw file

  1. /**
  2. * @file llappviewerlistener.cpp
  3. * @author Nat Goodspeed
  4. * @date 2009-06-23
  5. * @brief Implementation for llappviewerlistener.
  6. *
  7. * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  8. * Second Life Viewer Source Code
  9. * Copyright (C) 2010, Linden Research, Inc.
  10. *
  11. * This library is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU Lesser General Public
  13. * License as published by the Free Software Foundation;
  14. * version 2.1 of the License only.
  15. *
  16. * This library is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public
  22. * License along with this library; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. *
  25. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  26. * $/LicenseInfo$
  27. */
  28. // Precompiled header
  29. #include "llviewerprecompiledheaders.h"
  30. // associated header
  31. #include "llappviewerlistener.h"
  32. // STL headers
  33. // std headers
  34. // external library headers
  35. // other Linden headers
  36. #include "llappviewer.h"
  37. LLAppViewerListener::LLAppViewerListener(const LLAppViewerGetter& getter):
  38. LLEventAPI("LLAppViewer",
  39. "LLAppViewer listener to (e.g.) request shutdown"),
  40. mAppViewerGetter(getter)
  41. {
  42. // add() every method we want to be able to invoke via this event API.
  43. add("requestQuit",
  44. "Ask to quit nicely",
  45. &LLAppViewerListener::requestQuit);
  46. add("forceQuit",
  47. "Quit abruptly",
  48. &LLAppViewerListener::forceQuit);
  49. }
  50. void LLAppViewerListener::requestQuit(const LLSD& event)
  51. {
  52. mAppViewerGetter()->requestQuit();
  53. }
  54. void LLAppViewerListener::forceQuit(const LLSD& event)
  55. {
  56. mAppViewerGetter()->forceQuit();
  57. }