PageRenderTime 25ms CodeModel.GetById 10ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/llpanelmarketplaceoutboxinventory.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 156 lines | 82 code | 32 blank | 42 comment | 4 complexity | 3201e259e868e0ed37ef80e296acca3e MD5 | raw file
  1/** 
  2 * @file llpanelmarketplaceoutboxinventory.cpp
  3 * @brief LLOutboxInventoryPanel  class definition
  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 "llpanelmarketplaceoutboxinventory.h"
 30
 31#include "llfolderview.h"
 32#include "llfoldervieweventlistener.h"
 33#include "llinventorybridge.h"
 34#include "llinventoryfunctions.h"
 35#include "llpanellandmarks.h"
 36#include "llplacesinventorybridge.h"
 37#include "lltrans.h"
 38#include "llviewerfoldertype.h"
 39
 40
 41//
 42// statics
 43//
 44
 45static LLDefaultChildRegistry::Register<LLOutboxInventoryPanel> r1("outbox_inventory_panel");
 46static LLDefaultChildRegistry::Register<LLOutboxFolderViewFolder> r2("outbox_folder_view_folder");
 47
 48
 49//
 50// LLOutboxInventoryPanel Implementation
 51//
 52
 53LLOutboxInventoryPanel::LLOutboxInventoryPanel(const LLOutboxInventoryPanel::Params& p)
 54	: LLInventoryPanel(p)
 55{
 56}
 57
 58LLOutboxInventoryPanel::~LLOutboxInventoryPanel()
 59{
 60}
 61
 62// virtual
 63void LLOutboxInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params)
 64{
 65	// Determine the root folder in case specified, and
 66	// build the views starting with that folder.
 67	
 68	LLUUID root_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
 69	
 70	if (root_id == LLUUID::null)
 71	{
 72		llwarns << "Outbox inventory panel has no root folder!" << llendl;
 73		root_id = LLUUID::generateNewID();
 74	}
 75	
 76	LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_CATEGORY,
 77																	LLAssetType::AT_CATEGORY,
 78																	LLInventoryType::IT_CATEGORY,
 79																	this,
 80																	NULL,
 81																	root_id);
 82	
 83	mFolderRoot = createFolderView(new_listener, params.use_label_suffix());
 84}
 85
 86LLFolderViewFolder * LLOutboxInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge)
 87{
 88	LLOutboxFolderViewFolder::Params params;
 89	
 90	params.name = bridge->getDisplayName();
 91	params.icon = bridge->getIcon();
 92	params.icon_open = bridge->getOpenIcon();
 93	
 94	if (mShowItemLinkOverlays) // if false, then links show up just like normal items
 95	{
 96		params.icon_overlay = LLUI::getUIImage("Inv_Link");
 97	}
 98	
 99	params.root = mFolderRoot;
100	params.listener = bridge;
101	params.tool_tip = params.name;
102	
103	return LLUICtrlFactory::create<LLOutboxFolderViewFolder>(params);
104}
105
106LLFolderViewItem * LLOutboxInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge)
107{
108	LLFolderViewItem::Params params;
109
110	params.name = bridge->getDisplayName();
111	params.icon = bridge->getIcon();
112	params.icon_open = bridge->getOpenIcon();
113
114	if (mShowItemLinkOverlays) // if false, then links show up just like normal items
115	{
116		params.icon_overlay = LLUI::getUIImage("Inv_Link");
117	}
118
119	params.creation_date = bridge->getCreationDate();
120	params.root = mFolderRoot;
121	params.listener = bridge;
122	params.rect = LLRect (0, 0, 0, 0);
123	params.tool_tip = params.name;
124
125	return LLUICtrlFactory::create<LLOutboxFolderViewItem>(params);
126}
127
128//
129// LLOutboxFolderViewFolder Implementation
130//
131
132LLOutboxFolderViewFolder::LLOutboxFolderViewFolder(const Params& p)
133	: LLFolderViewFolder(p)
134{
135}
136
137//
138// LLOutboxFolderViewItem Implementation
139//
140
141LLOutboxFolderViewItem::LLOutboxFolderViewItem(const Params& p)
142	: LLFolderViewItem(p)
143{
144}
145
146BOOL LLOutboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask)
147{
148	return TRUE;
149}
150
151void LLOutboxFolderViewItem::openItem()
152{
153	// Intentionally do nothing to block attaching items from the outbox
154}
155
156// eof