/indra/newview/llsyswellwindow.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 236 lines · 130 code · 50 blank · 56 comment · 0 complexity · 7484c78cd9e417b5b8cbff39daf3e5b3 MD5 · raw file

  1. /**
  2. * @file llsyswellwindow.h
  3. * @brief // TODO
  4. *
  5. * $LicenseInfo:firstyear=2003&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_LLSYSWELLWINDOW_H
  27. #define LL_LLSYSWELLWINDOW_H
  28. #include "llsyswellitem.h"
  29. #include "lltransientdockablefloater.h"
  30. #include "llbutton.h"
  31. #include "llscreenchannel.h"
  32. #include "llscrollcontainer.h"
  33. #include "llimview.h"
  34. #include "boost/shared_ptr.hpp"
  35. class LLAvatarName;
  36. class LLFlatListView;
  37. class LLChiclet;
  38. class LLIMChiclet;
  39. class LLScriptChiclet;
  40. class LLSysWellChiclet;
  41. class LLSysWellWindow : public LLTransientDockableFloater
  42. {
  43. public:
  44. LLSysWellWindow(const LLSD& key);
  45. ~LLSysWellWindow();
  46. BOOL postBuild();
  47. // other interface functions
  48. // check is window empty
  49. bool isWindowEmpty();
  50. // Operating with items
  51. void removeItemByID(const LLUUID& id);
  52. // Operating with outfit
  53. virtual void setVisible(BOOL visible);
  54. void adjustWindowPosition();
  55. /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
  56. // override LLFloater's minimization according to EXT-1216
  57. /*virtual*/ void setMinimized(BOOL minimize);
  58. /*virtual*/ void handleReshape(const LLRect& rect, bool by_user);
  59. void onStartUpToastClick(S32 x, S32 y, MASK mask);
  60. void setSysWellChiclet(LLSysWellChiclet* chiclet);
  61. // size constants for the window and for its elements
  62. static const S32 MAX_WINDOW_HEIGHT = 200;
  63. static const S32 MIN_WINDOW_WIDTH = 318;
  64. protected:
  65. // init Window's channel
  66. virtual void initChannel();
  67. const std::string NOTIFICATION_WELL_ANCHOR_NAME;
  68. const std::string IM_WELL_ANCHOR_NAME;
  69. virtual const std::string& getAnchorViewName() = 0;
  70. void reshapeWindow();
  71. void releaseNewMessagesState();
  72. // pointer to a corresponding channel's instance
  73. LLNotificationsUI::LLScreenChannel* mChannel;
  74. LLFlatListView* mMessageList;
  75. /**
  76. * Reference to an appropriate Well chiclet to release "new message" state. EXT-3147
  77. */
  78. LLSysWellChiclet* mSysWellChiclet;
  79. bool mIsReshapedByUser;
  80. };
  81. /**
  82. * Class intended to manage incoming notifications.
  83. *
  84. * It contains a list of notifications that have not been responded to.
  85. */
  86. class LLNotificationWellWindow : public LLSysWellWindow
  87. {
  88. public:
  89. LLNotificationWellWindow(const LLSD& key);
  90. static LLNotificationWellWindow* getInstance(const LLSD& key = LLSD());
  91. /*virtual*/ BOOL postBuild();
  92. /*virtual*/ void setVisible(BOOL visible);
  93. // Operating with items
  94. void addItem(LLSysWellItem::Params p);
  95. // Closes all notifications and removes them from the Notification Well
  96. void closeAll();
  97. protected:
  98. /*virtual*/ const std::string& getAnchorViewName() { return NOTIFICATION_WELL_ANCHOR_NAME; }
  99. private:
  100. // init Window's channel
  101. void initChannel();
  102. void clearScreenChannels();
  103. void onStoreToast(LLPanel* info_panel, LLUUID id);
  104. // connect counter and list updaters to the corresponding signals
  105. void connectListUpdaterToSignal(std::string notification_type);
  106. // Handlers
  107. void onItemClick(LLSysWellItem* item);
  108. void onItemClose(LLSysWellItem* item);
  109. // ID of a toast loaded by user (by clicking notification well item)
  110. LLUUID mLoadedToastId;
  111. };
  112. /**
  113. * Class intended to manage incoming messages in IM chats.
  114. *
  115. * It contains a list list of all active IM sessions.
  116. */
  117. class LLIMWellWindow : public LLSysWellWindow, LLIMSessionObserver, LLInitClass<LLIMWellWindow>
  118. {
  119. public:
  120. LLIMWellWindow(const LLSD& key);
  121. ~LLIMWellWindow();
  122. static LLIMWellWindow* getInstance(const LLSD& key = LLSD());
  123. static LLIMWellWindow* findInstance(const LLSD& key = LLSD());
  124. static void initClass() { getInstance(); }
  125. /*virtual*/ BOOL postBuild();
  126. // LLIMSessionObserver observe triggers
  127. /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id);
  128. /*virtual*/ void sessionRemoved(const LLUUID& session_id);
  129. /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id);
  130. void addObjectRow(const LLUUID& notification_id, bool new_message = false);
  131. void removeObjectRow(const LLUUID& notification_id);
  132. void addIMRow(const LLUUID& session_id);
  133. bool hasIMRow(const LLUUID& session_id);
  134. void closeAll();
  135. protected:
  136. /*virtual*/ const std::string& getAnchorViewName() { return IM_WELL_ANCHOR_NAME; }
  137. private:
  138. LLChiclet * findIMChiclet(const LLUUID& sessionId);
  139. LLChiclet* findObjectChiclet(const LLUUID& notification_id);
  140. void addIMRow(const LLUUID& sessionId, S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId);
  141. void delIMRow(const LLUUID& sessionId);
  142. bool confirmCloseAll(const LLSD& notification, const LLSD& response);
  143. void closeAllImpl();
  144. /**
  145. * Scrolling row panel.
  146. */
  147. class RowPanel: public LLPanel
  148. {
  149. public:
  150. RowPanel(const LLSysWellWindow* parent, const LLUUID& sessionId, S32 chicletCounter,
  151. const std::string& name, const LLUUID& otherParticipantId);
  152. virtual ~RowPanel();
  153. void onMouseEnter(S32 x, S32 y, MASK mask);
  154. void onMouseLeave(S32 x, S32 y, MASK mask);
  155. BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  156. BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
  157. private:
  158. static const S32 CHICLET_HPAD = 10;
  159. void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
  160. void onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param);
  161. void onClosePanel();
  162. public:
  163. LLIMChiclet* mChiclet;
  164. private:
  165. LLButton* mCloseBtn;
  166. const LLSysWellWindow* mParent;
  167. };
  168. class ObjectRowPanel: public LLPanel
  169. {
  170. public:
  171. ObjectRowPanel(const LLUUID& notification_id, bool new_message = false);
  172. virtual ~ObjectRowPanel();
  173. /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
  174. /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
  175. /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  176. /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
  177. private:
  178. void onClosePanel();
  179. void initChiclet(const LLUUID& notification_id, bool new_message = false);
  180. public:
  181. LLIMChiclet* mChiclet;
  182. private:
  183. LLButton* mCloseBtn;
  184. };
  185. };
  186. #endif // LL_LLSYSWELLWINDOW_H