/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. #include "llviewerprecompiledheaders.h"
  27. #include "llpanelmarketplaceoutboxinventory.h"
  28. #include "llfolderview.h"
  29. #include "llfoldervieweventlistener.h"
  30. #include "llinventorybridge.h"
  31. #include "llinventoryfunctions.h"
  32. #include "llpanellandmarks.h"
  33. #include "llplacesinventorybridge.h"
  34. #include "lltrans.h"
  35. #include "llviewerfoldertype.h"
  36. //
  37. // statics
  38. //
  39. static LLDefaultChildRegistry::Register<LLOutboxInventoryPanel> r1("outbox_inventory_panel");
  40. static LLDefaultChildRegistry::Register<LLOutboxFolderViewFolder> r2("outbox_folder_view_folder");
  41. //
  42. // LLOutboxInventoryPanel Implementation
  43. //
  44. LLOutboxInventoryPanel::LLOutboxInventoryPanel(const LLOutboxInventoryPanel::Params& p)
  45. : LLInventoryPanel(p)
  46. {
  47. }
  48. LLOutboxInventoryPanel::~LLOutboxInventoryPanel()
  49. {
  50. }
  51. // virtual
  52. void LLOutboxInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params)
  53. {
  54. // Determine the root folder in case specified, and
  55. // build the views starting with that folder.
  56. LLUUID root_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false, false);
  57. if (root_id == LLUUID::null)
  58. {
  59. llwarns << "Outbox inventory panel has no root folder!" << llendl;
  60. root_id = LLUUID::generateNewID();
  61. }
  62. LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_CATEGORY,
  63. LLAssetType::AT_CATEGORY,
  64. LLInventoryType::IT_CATEGORY,
  65. this,
  66. NULL,
  67. root_id);
  68. mFolderRoot = createFolderView(new_listener, params.use_label_suffix());
  69. }
  70. LLFolderViewFolder * LLOutboxInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge)
  71. {
  72. LLOutboxFolderViewFolder::Params params;
  73. params.name = bridge->getDisplayName();
  74. params.icon = bridge->getIcon();
  75. params.icon_open = bridge->getOpenIcon();
  76. if (mShowItemLinkOverlays) // if false, then links show up just like normal items
  77. {
  78. params.icon_overlay = LLUI::getUIImage("Inv_Link");
  79. }
  80. params.root = mFolderRoot;
  81. params.listener = bridge;
  82. params.tool_tip = params.name;
  83. return LLUICtrlFactory::create<LLOutboxFolderViewFolder>(params);
  84. }
  85. LLFolderViewItem * LLOutboxInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge)
  86. {
  87. LLFolderViewItem::Params params;
  88. params.name = bridge->getDisplayName();
  89. params.icon = bridge->getIcon();
  90. params.icon_open = bridge->getOpenIcon();
  91. if (mShowItemLinkOverlays) // if false, then links show up just like normal items
  92. {
  93. params.icon_overlay = LLUI::getUIImage("Inv_Link");
  94. }
  95. params.creation_date = bridge->getCreationDate();
  96. params.root = mFolderRoot;
  97. params.listener = bridge;
  98. params.rect = LLRect (0, 0, 0, 0);
  99. params.tool_tip = params.name;
  100. return LLUICtrlFactory::create<LLOutboxFolderViewItem>(params);
  101. }
  102. //
  103. // LLOutboxFolderViewFolder Implementation
  104. //
  105. LLOutboxFolderViewFolder::LLOutboxFolderViewFolder(const Params& p)
  106. : LLFolderViewFolder(p)
  107. {
  108. }
  109. //
  110. // LLOutboxFolderViewItem Implementation
  111. //
  112. LLOutboxFolderViewItem::LLOutboxFolderViewItem(const Params& p)
  113. : LLFolderViewItem(p)
  114. {
  115. }
  116. BOOL LLOutboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask)
  117. {
  118. return TRUE;
  119. }
  120. void LLOutboxFolderViewItem::openItem()
  121. {
  122. // Intentionally do nothing to block attaching items from the outbox
  123. }
  124. // eof