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

/indra/newview/llgrouplist.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 114 lines | 64 code | 18 blank | 32 comment | 0 complexity | 4c644b3bbbd08c43a67b8202d45be8df MD5 | raw file
  1/** 
  2 * @file llgrouplist.h
  3 * @brief List of the groups the agent belongs to.
  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_LLGROUPLIST_H
 28#define LL_LLGROUPLIST_H
 29
 30#include "llevent.h"
 31#include "llflatlistview.h"
 32#include "llpanel.h"
 33#include "llpointer.h"
 34#include "llstyle.h"
 35#include "llgroupmgr.h"
 36
 37/**
 38 * Auto-updating list of agent groups.
 39 * 
 40 * Can use optional group name filter.
 41 * 
 42 * @see setNameFilter()
 43 */
 44class LLGroupList: public LLFlatListViewEx, public LLOldEvents::LLSimpleListener
 45{
 46	LOG_CLASS(LLGroupList);
 47public:
 48
 49	LLGroupList(const Params& p);
 50	virtual ~LLGroupList();
 51
 52	virtual void draw(); // from LLView
 53	/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView
 54
 55	void setNameFilter(const std::string& filter);
 56	void toggleIcons();
 57	bool getIconsVisible() const { return mShowIcons; }
 58
 59private:
 60	void setDirty(bool val = true)		{ mDirty = val; }
 61	void refresh();
 62	void addNewItem(const LLUUID& id, const std::string& name, const LLUUID& icon_id, EAddPosition pos = ADD_BOTTOM);
 63	bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); // called on agent group list changes
 64
 65	bool onContextMenuItemClick(const LLSD& userdata);
 66	bool onContextMenuItemEnable(const LLSD& userdata);
 67
 68	LLHandle<LLView>	mContextMenuHandle;
 69
 70	bool mShowIcons;
 71	bool mDirty;
 72	std::string mNameFilter;
 73};
 74
 75class LLButton;
 76class LLIconCtrl;
 77class LLTextBox;
 78
 79class LLGroupListItem : public LLPanel
 80	, public LLGroupMgrObserver
 81{
 82public:
 83	LLGroupListItem();
 84	~LLGroupListItem();
 85	/*virtual*/ BOOL postBuild();
 86	/*virtual*/ void setValue(const LLSD& value);
 87	void onMouseEnter(S32 x, S32 y, MASK mask);
 88	void onMouseLeave(S32 x, S32 y, MASK mask);
 89
 90	const LLUUID& getGroupID() const			{ return mGroupID; }
 91	const std::string& getGroupName() const		{ return mGroupName; }
 92
 93	void setName(const std::string& name, const std::string& highlight = LLStringUtil::null);
 94	void setGroupID(const LLUUID& group_id);
 95	void setGroupIconID(const LLUUID& group_icon_id);
 96	void setGroupIconVisible(bool visible);
 97
 98	virtual void changed(LLGroupChange gc);
 99private:
100	void setActive(bool active);
101	void onInfoBtnClick();
102	void onProfileBtnClick();
103
104	LLTextBox*	mGroupNameBox;
105	LLUUID		mGroupID;
106	LLIconCtrl* mGroupIcon;
107	LLButton*	mInfoBtn;
108
109	std::string	mGroupName;
110	LLStyle::Params mGroupNameStyle;
111
112	static S32	sIconWidth; // icon width + padding
113};
114#endif // LL_LLGROUPLIST_H