/indra/newview/llpanelavatartag.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 101 lines · 59 code · 14 blank · 28 comment · 3 complexity · 6d166bb79232bd77274e022efc0762cf MD5 · raw file

  1. /**
  2. * @file llpanelavatartag.cpp
  3. * @brief Avatar tag panel
  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. #include "llviewerprecompiledheaders.h"
  27. #include "llpanelavatartag.h"
  28. #include "lluictrlfactory.h"
  29. #include "llavatariconctrl.h"
  30. #include "lltextbox.h"
  31. LLPanelAvatarTag::LLPanelAvatarTag(const LLUUID& key, const std::string im_time)
  32. : LLPanel()
  33. , mAvatarId(LLUUID::null)
  34. // , mFadeTimer()
  35. {
  36. buildFromFile( "panel_avatar_tag.xml");
  37. setLeftButtonClickCallback(boost::bind(&LLPanelAvatarTag::onClick, this));
  38. setAvatarId(key);
  39. setTime(im_time);
  40. }
  41. LLPanelAvatarTag::~LLPanelAvatarTag()
  42. {
  43. // Name callbacks will be automatically disconnected since LLPanel is trackable
  44. }
  45. BOOL LLPanelAvatarTag::postBuild()
  46. {
  47. mIcon = getChild<LLAvatarIconCtrl>("avatar_tag_icon");
  48. mName = getChild<LLTextBox>("sender_tag_name");
  49. mTime = getChild<LLTextBox>("tag_time");
  50. return TRUE;
  51. }
  52. void LLPanelAvatarTag::draw()
  53. {
  54. }
  55. void LLPanelAvatarTag::setName(const std::string& name)
  56. {
  57. if (mName)
  58. mName->setText(name);
  59. }
  60. void LLPanelAvatarTag::setTime(const std::string& time)
  61. {
  62. if (mTime)
  63. mTime->setText(time);
  64. }
  65. void LLPanelAvatarTag::setAvatarId(const LLUUID& avatar_id)
  66. {
  67. mAvatarId = avatar_id;
  68. if (mIcon)
  69. {
  70. mIcon->setValue(avatar_id);
  71. }
  72. setName(std::string(mIcon->getFullName()));
  73. }
  74. boost::signals2::connection LLPanelAvatarTag::setLeftButtonClickCallback(
  75. const commit_callback_t& cb)
  76. {
  77. return setCommitCallback(cb);
  78. }
  79. BOOL LLPanelAvatarTag::handleMouseDown(S32 x, S32 y, MASK mask)
  80. {
  81. onCommit();
  82. return TRUE;
  83. }
  84. void LLPanelAvatarTag::onClick()
  85. {
  86. // Do the on click stuff.
  87. }