PageRenderTime 121ms CodeModel.GetById 9ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLGROUPICONCTRL_H
  27. #define LL_LLGROUPICONCTRL_H
  28. #include "lliconctrl.h"
  29. #include "llgroupmgr.h"
  30. /**
  31. * Extends IconCtrl to show group icon wherever it is needed.
  32. *
  33. * It gets icon id by group id from the LLGroupMgr.
  34. * If group data is not loaded yet it subscribes as LLGroupMgr observer and requests necessary data.
  35. */
  36. class LLGroupIconCtrl
  37. : public LLIconCtrl, public LLGroupMgrObserver
  38. {
  39. public:
  40. struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params>
  41. {
  42. Optional <LLUUID> group_id;
  43. Optional <bool> draw_tooltip;
  44. Optional <std::string> default_icon_name;
  45. Params();
  46. };
  47. protected:
  48. LLGroupIconCtrl(const Params&);
  49. friend class LLUICtrlFactory;
  50. public:
  51. virtual ~LLGroupIconCtrl();
  52. /**
  53. * Determines group icon id by group id and sets it as icon value.
  54. *
  55. * Icon id is got from the appropriate LLGroupMgrGroupData specified by group UUID.
  56. * If necessary it requests necessary data from the LLGroupMgr.
  57. *
  58. * @params value - if LLUUID - it is processed as group id otherwise base method is called.
  59. */
  60. virtual void setValue(const LLSD& value);
  61. // LLGroupMgrObserver observer trigger
  62. virtual void changed(LLGroupChange gc);
  63. const std::string& getGroupName() const { return mGroupName; }
  64. void setDrawTooltip(bool value) { mDrawTooltip = value;}
  65. const LLUUID& getGroupId() const { return mGroupId; }
  66. protected:
  67. LLUUID mGroupId;
  68. std::string mGroupName;
  69. bool mDrawTooltip;
  70. std::string mDefaultIconName;
  71. bool updateFromCache();
  72. };
  73. #endif // LL_LLGROUPICONCTRL_H