PageRenderTime 8ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 1ms

/indra/newview/llchathistory.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 147 lines | 69 code | 17 blank | 61 comment | 0 complexity | 404f70291cc04b7b1eefa4377c6c92eb MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llchathistory.h
  3. * @brief LLTextEditor base class
  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 LLCHATHISTORY_H_
  27. #define LLCHATHISTORY_H_
  28. #include "lltexteditor.h"
  29. #include "lltextbox.h"
  30. #include "llviewerchat.h"
  31. //Chat log widget allowing addition of a message as a widget
  32. class LLChatHistory : public LLUICtrl
  33. {
  34. public:
  35. struct Params : public LLInitParam::Block<Params, LLTextEditor::Params>
  36. {
  37. //Message header filename
  38. Optional<std::string> message_header;
  39. //Message separator filename
  40. Optional<std::string> message_separator;
  41. //Text left padding from the scroll rect
  42. Optional<S32> left_text_pad;
  43. //Text right padding from the scroll rect
  44. Optional<S32> right_text_pad;
  45. //Widget left padding from the scroll rect
  46. Optional<S32> left_widget_pad;
  47. //Widget right padding from the scroll rect
  48. Optional<S32> right_widget_pad;
  49. //Separator top padding
  50. Optional<S32> top_separator_pad;
  51. //Separator bottom padding
  52. Optional<S32> bottom_separator_pad;
  53. //Header top padding
  54. Optional<S32> top_header_pad;
  55. //Header bottom padding
  56. Optional<S32> bottom_header_pad;
  57. Optional<LLTextBox::Params> more_chat_text;
  58. Params()
  59. : message_header("message_header"),
  60. message_separator("message_separator"),
  61. left_text_pad("left_text_pad"),
  62. right_text_pad("right_text_pad"),
  63. left_widget_pad("left_widget_pad"),
  64. right_widget_pad("right_widget_pad"),
  65. top_separator_pad("top_separator_pad"),
  66. bottom_separator_pad("bottom_separator_pad"),
  67. top_header_pad("top_header_pad"),
  68. bottom_header_pad("bottom_header_pad"),
  69. more_chat_text("more_chat_text")
  70. {}
  71. };
  72. protected:
  73. LLChatHistory(const Params&);
  74. friend class LLUICtrlFactory;
  75. /*virtual*/ void draw();
  76. /**
  77. * Redefinition of LLTextEditor::updateTextRect() to considerate text
  78. * left/right padding params.
  79. */
  80. //virtual void updateTextRect();
  81. /**
  82. * Builds a message separator.
  83. * @return pointer to LLView separator object.
  84. */
  85. LLView* getSeparator();
  86. /**
  87. * Builds a message header.
  88. * @return pointer to LLView header object.
  89. */
  90. LLView* getHeader(const LLChat& chat,const LLStyle::Params& style_params, const LLSD& args);
  91. void onClickMoreText();
  92. public:
  93. ~LLChatHistory();
  94. void initFromParams(const Params&);
  95. /**
  96. * Appends a widget message.
  97. * If last user appended message, concurs with current user,
  98. * separator is added before the message, otherwise header is added.
  99. * The args LLSD contains:
  100. * - use_plain_text_chat_history (bool) - whether to add message as plain text.
  101. * - owner_id (LLUUID) - the owner ID for object chat
  102. * @param chat - base chat message.
  103. * @param args - additional arguments
  104. * @param input_append_params - font style.
  105. */
  106. void appendMessage(const LLChat& chat, const LLSD &args = LLSD(), const LLStyle::Params& input_append_params = LLStyle::Params());
  107. /*virtual*/ void clear();
  108. private:
  109. std::string mLastFromName;
  110. LLUUID mLastFromID;
  111. LLDate mLastMessageTime;
  112. bool mIsLastMessageFromLog;
  113. //std::string mLastMessageTimeStr;
  114. std::string mMessageHeaderFilename;
  115. std::string mMessageSeparatorFilename;
  116. S32 mLeftTextPad;
  117. S32 mRightTextPad;
  118. S32 mLeftWidgetPad;
  119. S32 mRightWidgetPad;
  120. S32 mTopSeparatorPad;
  121. S32 mBottomSeparatorPad;
  122. S32 mTopHeaderPad;
  123. S32 mBottomHeaderPad;
  124. class LLLayoutPanel* mMoreChatPanel;
  125. LLTextBox* mMoreChatText;
  126. LLTextEditor* mEditor;
  127. typedef std::set<std::string> unread_chat_source_t;
  128. unread_chat_source_t mUnreadChatSources;
  129. };
  130. #endif /* LLCHATHISTORY_H_ */