PageRenderTime 35ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/lltoastalertpanel.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 119 lines | 62 code | 20 blank | 37 comment | 0 complexity | 2160451675ac46f194996955a4d11b6b MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltoastalertpanel.h
  3. * @brief Panel for alert toasts.
  4. *
  5. * $LicenseInfo:firstyear=2001&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_TOASTALERTPANEL_H
  27. #define LL_TOASTALERTPANEL_H
  28. #include "lltoastpanel.h"
  29. #include "llfloater.h"
  30. #include "llui.h"
  31. #include "llnotificationptr.h"
  32. #include "llerror.h"
  33. class LLButton;
  34. class LLCheckBoxCtrl;
  35. class LLLineEditor;
  36. /**
  37. * Toast panel for alert notification.
  38. * Alerts notifications doesn't require user interaction.
  39. *
  40. * Replaces class LLAlertDialog.
  41. * https://wiki.lindenlab.com/mediawiki/index.php?title=LLAlertDialog&oldid=81388
  42. */
  43. class LLToastAlertPanel
  44. : public LLToastPanel
  45. {
  46. LOG_CLASS(LLToastAlertPanel);
  47. public:
  48. typedef bool (*display_callback_t)(S32 modal);
  49. class URLLoader
  50. {
  51. public:
  52. virtual void load(const std::string& url, bool force_open_externally = 0) = 0;
  53. virtual ~URLLoader()
  54. {
  55. }
  56. };
  57. static void setURLLoader(URLLoader* loader)
  58. {
  59. sURLLoader = loader;
  60. }
  61. public:
  62. // User's responsibility to call show() after creating these.
  63. LLToastAlertPanel( LLNotificationPtr notep, bool is_modal );
  64. virtual BOOL handleKeyHere(KEY key, MASK mask );
  65. virtual void draw();
  66. virtual void setVisible( BOOL visible );
  67. bool setCheckBox( const std::string&, const std::string& );
  68. void setCaution(BOOL val = TRUE) { mCaution = val; }
  69. // If mUnique==TRUE only one copy of this message should exist
  70. void setUnique(BOOL val = TRUE) { mUnique = val; }
  71. void setEditTextArgs(const LLSD& edit_args);
  72. void onClickIgnore(LLUICtrl* ctrl);
  73. void onButtonPressed(const LLSD& data, S32 button);
  74. private:
  75. static std::map<std::string, LLToastAlertPanel*> sUniqueActiveMap;
  76. virtual ~LLToastAlertPanel();
  77. // No you can't kill it. It can only kill itself.
  78. // Does it have a readable title label, or minimize or close buttons?
  79. BOOL hasTitleBar() const;
  80. private:
  81. static URLLoader* sURLLoader;
  82. static LLControlGroup* sSettings;
  83. struct ButtonData
  84. {
  85. LLButton* mButton;
  86. std::string mURL;
  87. U32 mURLExternal;
  88. };
  89. std::vector<ButtonData> mButtonData;
  90. S32 mDefaultOption;
  91. LLCheckBoxCtrl* mCheck;
  92. BOOL mCaution;
  93. BOOL mUnique;
  94. LLUIString mLabel;
  95. LLFrameTimer mDefaultBtnTimer;
  96. // For Dialogs that take a line as text as input:
  97. LLLineEditor* mLineEditor;
  98. };
  99. #endif // LL_TOASTALERTPANEL_H