PageRenderTime 94ms CodeModel.GetById 90ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llgroupiconctrl.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 86 lines | 33 code | 13 blank | 40 comment | 0 complexity | 77c18b28eefeec12cdeb071a22ab91bf MD5 | raw file
 1/** 
 2 * @file llgroupiconctrl.h
 3 * @brief LLGroupIconCtrl class declaration
 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_LLGROUPICONCTRL_H
28#define LL_LLGROUPICONCTRL_H
29
30#include "lliconctrl.h"
31
32#include "llgroupmgr.h"
33
34/**
35 * Extends IconCtrl to show group icon wherever it is needed.
36 * 
37 * It gets icon id by group id from the LLGroupMgr.
38 * If group data is not loaded yet it subscribes as LLGroupMgr observer and requests necessary data.
39 */
40class LLGroupIconCtrl
41	: public LLIconCtrl, public LLGroupMgrObserver
42{
43public:
44	struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params>
45	{
46		Optional <LLUUID> group_id;
47		Optional <bool> draw_tooltip;
48		Optional <std::string> default_icon_name;
49		Params();
50	};
51
52protected:
53	LLGroupIconCtrl(const Params&);
54	friend class LLUICtrlFactory;
55
56public:
57	virtual ~LLGroupIconCtrl();
58
59	/**
60	 * Determines group icon id by group id and sets it as icon value.
61	 *
62	 * Icon id is got from the appropriate LLGroupMgrGroupData specified by group UUID.
63	 * If necessary it requests necessary data from the LLGroupMgr.
64	 *
65	 * @params value - if LLUUID - it is processed as group id otherwise base method is called.
66	 */
67	virtual void setValue(const LLSD& value);
68
69	// LLGroupMgrObserver observer trigger
70	virtual void changed(LLGroupChange gc);
71
72	const std::string&	getGroupName() const { return mGroupName; }
73	void setDrawTooltip(bool value) { mDrawTooltip = value;}
74
75	const LLUUID&		getGroupId() const	{ return mGroupId; }
76
77protected:
78	LLUUID				mGroupId;
79	std::string			mGroupName;
80	bool				mDrawTooltip;
81	std::string			mDefaultIconName;
82
83	bool updateFromCache();
84};
85
86#endif  // LL_LLGROUPICONCTRL_H