PageRenderTime 21ms CodeModel.GetById 7ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llimfloater.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 182 lines | 92 code | 40 blank | 50 comment | 0 complexity | c309f5ed7033e5315dc46b26a3fde330 MD5 | raw file
  1/** 
  2 * @file llimfloater.h
  3 * @brief LLIMFloater class definition
  4 *
  5 * $LicenseInfo:firstyear=2009&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_IMFLOATER_H
 28#define LL_IMFLOATER_H
 29
 30#include "llinstantmessage.h"
 31#include "lllogchat.h"
 32#include "lltooldraganddrop.h"
 33#include "lltransientdockablefloater.h"
 34
 35class LLAvatarName;
 36class LLLineEditor;
 37class LLPanelChatControlPanel;
 38class LLChatHistory;
 39class LLInventoryItem;
 40class LLInventoryCategory;
 41
 42/**
 43 * Individual IM window that appears at the bottom of the screen,
 44 * optionally "docked" to the bottom tray.
 45 */
 46class LLIMFloater : public LLTransientDockableFloater
 47{
 48	LOG_CLASS(LLIMFloater);
 49public:
 50	LLIMFloater(const LLUUID& session_id);
 51
 52	virtual ~LLIMFloater();
 53	
 54	// LLView overrides
 55	/*virtual*/ BOOL postBuild();
 56	/*virtual*/ void setVisible(BOOL visible);
 57	/*virtual*/ BOOL getVisible();
 58	// Check typing timeout timer.
 59	/*virtual*/ void draw();
 60
 61	// LLFloater overrides
 62	/*virtual*/ void onClose(bool app_quitting);
 63	/*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
 64
 65	// Make IM conversion visible and update the message history
 66	static LLIMFloater* show(const LLUUID& session_id);
 67
 68	// Toggle panel specified by session_id
 69	// Returns true iff panel became visible
 70	static bool toggle(const LLUUID& session_id);
 71
 72	static LLIMFloater* findInstance(const LLUUID& session_id);
 73
 74	static LLIMFloater* getInstance(const LLUUID& session_id);
 75
 76	void sessionInitReplyReceived(const LLUUID& im_session_id);
 77
 78	// get new messages from LLIMModel
 79	void updateMessages();
 80	void reloadMessages();
 81	static void onSendMsg( LLUICtrl*, void*);
 82	void sendMsg();
 83
 84	// callback for LLIMModel on new messages
 85	// route to specific floater if it is visible
 86	static void newIMCallback(const LLSD& data);
 87
 88	// called when docked floater's position has been set by chiclet
 89	void setPositioned(bool b) { mPositioned = b; };
 90
 91	void onVisibilityChange(const LLSD& new_visibility);
 92	void processIMTyping(const LLIMInfo* im_info, BOOL typing);
 93	void processAgentListUpdates(const LLSD& body);
 94	void processSessionUpdate(const LLSD& session_update);
 95
 96	void updateChatHistoryStyle();
 97	static void processChatHistoryStyleUpdate(const LLSD& newvalue);
 98
 99	BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
100							   BOOL drop, EDragAndDropType cargo_type,
101							   void *cargo_data, EAcceptance *accept,
102							   std::string& tooltip_msg);
103
104	/**
105	 * Returns true if chat is displayed in multi tabbed floater
106	 *         false if chat is displayed in multiple windows
107	 */
108	static bool isChatMultiTab();
109
110	static void initIMFloater();
111
112	//used as a callback on receiving new IM message
113	static void sRemoveTypingIndicator(const LLSD& data);
114
115	static void onIMChicletCreated(const LLUUID& session_id);
116
117	virtual LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::IM; }
118
119protected:
120	/* virtual */
121	void	onClickCloseBtn();
122
123private:
124	// process focus events to set a currently active session
125	/* virtual */ void onFocusLost();
126	/* virtual */ void onFocusReceived();
127
128	// Update the window title, input field help text, etc.
129	void updateSessionName(const std::string& ui_title, const std::string& ui_label);
130	
131	// For display name lookups for IM window titles
132	void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
133	
134	BOOL dropCallingCard(LLInventoryItem* item, BOOL drop);
135	BOOL dropCategory(LLInventoryCategory* category, BOOL drop);
136
137	BOOL isInviteAllowed() const;
138	BOOL inviteToSession(const uuid_vec_t& agent_ids);
139	
140	static void		onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
141	static void		onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
142	static void		onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
143	void			setTyping(bool typing);
144	void			onSlide();
145	static void*	createPanelIMControl(void* userdata);
146	static void*	createPanelGroupControl(void* userdata);
147	static void* 	createPanelAdHocControl(void* userdata);
148
149	// Add the "User is typing..." indicator.
150	void addTypingIndicator(const LLIMInfo* im_info);
151
152	// Remove the "User is typing..." indicator.
153	void removeTypingIndicator(const LLIMInfo* im_info = NULL);
154
155	static void closeHiddenIMToasts();
156
157	static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response);
158
159	LLPanelChatControlPanel* mControlPanel;
160	LLUUID mSessionID;
161	S32 mLastMessageIndex;
162
163	EInstantMessage mDialog;
164	LLUUID mOtherParticipantUUID;
165	LLChatHistory* mChatHistory;
166	LLLineEditor* mInputEditor;
167	bool mPositioned;
168
169	std::string mSavedTitle;
170	LLUIString mTypingStart;
171	bool mMeTyping;
172	bool mOtherTyping;
173	bool mShouldSendTypingState;
174	LLFrameTimer mTypingTimer;
175	LLFrameTimer mTypingTimeoutTimer;
176
177	bool mSessionInitialized;
178	LLSD mQueuedMsgsForInit;
179};
180
181
182#endif  // LL_IMFLOATER_H