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