PageRenderTime 37ms CodeModel.GetById 11ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLGROUPLIST_H
  27. #define LL_LLGROUPLIST_H
  28. #include "llevent.h"
  29. #include "llflatlistview.h"
  30. #include "llpanel.h"
  31. #include "llpointer.h"
  32. #include "llstyle.h"
  33. #include "llgroupmgr.h"
  34. /**
  35. * Auto-updating list of agent groups.
  36. *
  37. * Can use optional group name filter.
  38. *
  39. * @see setNameFilter()
  40. */
  41. class LLGroupList: public LLFlatListViewEx, public LLOldEvents::LLSimpleListener
  42. {
  43. LOG_CLASS(LLGroupList);
  44. public:
  45. LLGroupList(const Params& p);
  46. virtual ~LLGroupList();
  47. virtual void draw(); // from LLView
  48. /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView
  49. void setNameFilter(const std::string& filter);
  50. void toggleIcons();
  51. bool getIconsVisible() const { return mShowIcons; }
  52. private:
  53. void setDirty(bool val = true) { mDirty = val; }
  54. void refresh();
  55. void addNewItem(const LLUUID& id, const std::string& name, const LLUUID& icon_id, EAddPosition pos = ADD_BOTTOM);
  56. bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); // called on agent group list changes
  57. bool onContextMenuItemClick(const LLSD& userdata);
  58. bool onContextMenuItemEnable(const LLSD& userdata);
  59. LLHandle<LLView> mContextMenuHandle;
  60. bool mShowIcons;
  61. bool mDirty;
  62. std::string mNameFilter;
  63. };
  64. class LLButton;
  65. class LLIconCtrl;
  66. class LLTextBox;
  67. class LLGroupListItem : public LLPanel
  68. , public LLGroupMgrObserver
  69. {
  70. public:
  71. LLGroupListItem();
  72. ~LLGroupListItem();
  73. /*virtual*/ BOOL postBuild();
  74. /*virtual*/ void setValue(const LLSD& value);
  75. void onMouseEnter(S32 x, S32 y, MASK mask);
  76. void onMouseLeave(S32 x, S32 y, MASK mask);
  77. const LLUUID& getGroupID() const { return mGroupID; }
  78. const std::string& getGroupName() const { return mGroupName; }
  79. void setName(const std::string& name, const std::string& highlight = LLStringUtil::null);
  80. void setGroupID(const LLUUID& group_id);
  81. void setGroupIconID(const LLUUID& group_icon_id);
  82. void setGroupIconVisible(bool visible);
  83. virtual void changed(LLGroupChange gc);
  84. private:
  85. void setActive(bool active);
  86. void onInfoBtnClick();
  87. void onProfileBtnClick();
  88. LLTextBox* mGroupNameBox;
  89. LLUUID mGroupID;
  90. LLIconCtrl* mGroupIcon;
  91. LLButton* mInfoBtn;
  92. std::string mGroupName;
  93. LLStyle::Params mGroupNameStyle;
  94. static S32 sIconWidth; // icon width + padding
  95. };
  96. #endif // LL_LLGROUPLIST_H