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