PageRenderTime 114ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llui/llmodaldialog.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 83 lines | 37 code | 17 blank | 29 comment | 0 complexity | 0e38f0cf8a216783f5789dc94d3e4302 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llmodaldialog.h
  3. * @brief LLModalDialog base class
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLMODALDIALOG_H
  27. #define LL_LLMODALDIALOG_H
  28. #include "llfloater.h"
  29. #include "llframetimer.h"
  30. class LLModalDialog;
  31. // By default, a ModalDialog is modal, i.e. no other window can have focus
  32. // However, for the sake of code reuse and simplicity, if mModal == false,
  33. // the dialog behaves like a normal floater
  34. // https://wiki.lindenlab.com/mediawiki/index.php?title=LLModalDialog&oldid=81385
  35. class LLModalDialog : public LLFloater
  36. {
  37. public:
  38. LLModalDialog( const LLSD& key, BOOL modal = true );
  39. /*virtual*/ ~LLModalDialog();
  40. /*virtual*/ BOOL postBuild();
  41. /*virtual*/ void openFloater(const LLSD& key = LLSD());
  42. /*virtual*/ void onOpen(const LLSD& key);
  43. /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
  44. /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  45. /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  46. /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
  47. /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
  48. /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
  49. /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
  50. /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask );
  51. /*virtual*/ void setVisible(BOOL visible);
  52. /*virtual*/ void draw();
  53. BOOL isModal() const { return mModal; }
  54. void stopModal();
  55. static void onAppFocusLost();
  56. static void onAppFocusGained();
  57. static S32 activeCount() { return sModalStack.size(); }
  58. static void shutdownModals();
  59. protected:
  60. void centerOnScreen();
  61. private:
  62. LLFrameTimer mVisibleTime;
  63. const BOOL mModal;
  64. static std::list<LLModalDialog*> sModalStack; // Top of stack is currently being displayed
  65. };
  66. #endif // LL_LLMODALDIALOG_H