PageRenderTime 52ms CodeModel.GetById 18ms app.highlight 7ms RepoModel.GetById 13ms app.codeStats 0ms

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