PageRenderTime 24ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llscrolllistitem.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 125 lines | 71 code | 25 blank | 29 comment | 0 complexity | 2fce07137ba529d4f10a5f270dedd8c0 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llscrolllistitem.h
  3. * @brief Scroll lists are composed of rows (items), each of which
  4. * contains columns (cells).
  5. *
  6. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2010, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #ifndef LLSCROLLLISTITEM_H
  28. #define LLSCROLLLISTITEM_H
  29. #include "llpointer.h" // LLPointer<>
  30. #include "llsd.h"
  31. #include "v4color.h"
  32. #include "llinitparam.h"
  33. #include "llscrolllistcell.h"
  34. #include <vector>
  35. class LLCoordGL;
  36. class LLCheckBoxCtrl;
  37. class LLResizeBar;
  38. class LLScrollListCtrl;
  39. class LLScrollColumnHeader;
  40. class LLUIImage;
  41. //---------------------------------------------------------------------------
  42. // LLScrollListItem
  43. //---------------------------------------------------------------------------
  44. class LLScrollListItem
  45. {
  46. friend class LLScrollListCtrl;
  47. public:
  48. struct Params : public LLInitParam::Block<Params>
  49. {
  50. Optional<bool> enabled;
  51. Optional<void*> userdata;
  52. Optional<LLSD> value;
  53. Ignored name; // use for localization tools
  54. Ignored type;
  55. Ignored length;
  56. Multiple<LLScrollListCell::Params> columns;
  57. Params()
  58. : enabled("enabled", true),
  59. value("value"),
  60. name("name"),
  61. type("type"),
  62. length("length"),
  63. columns("columns")
  64. {
  65. addSynonym(columns, "column");
  66. addSynonym(value, "id");
  67. }
  68. };
  69. virtual ~LLScrollListItem();
  70. void setSelected( BOOL b ) { mSelected = b; }
  71. BOOL getSelected() const { return mSelected; }
  72. void setEnabled( BOOL b ) { mEnabled = b; }
  73. BOOL getEnabled() const { return mEnabled; }
  74. void setHighlighted( BOOL b ) { mHighlighted = b; }
  75. BOOL getHighlighted() const { return mHighlighted; }
  76. void setUserdata( void* userdata ) { mUserdata = userdata; }
  77. void* getUserdata() const { return mUserdata; }
  78. virtual LLUUID getUUID() const { return mItemValue.asUUID(); }
  79. LLSD getValue() const { return mItemValue; }
  80. void setRect(LLRect rect) { mRectangle = rect; }
  81. LLRect getRect() const { return mRectangle; }
  82. void addColumn( const LLScrollListCell::Params& p );
  83. void setNumColumns(S32 columns);
  84. void setColumn( S32 column, LLScrollListCell *cell );
  85. S32 getNumColumns() const;
  86. LLScrollListCell *getColumn(const S32 i) const;
  87. std::string getContentsCSV() const;
  88. virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);
  89. protected:
  90. LLScrollListItem( const Params& );
  91. private:
  92. BOOL mSelected;
  93. BOOL mHighlighted;
  94. BOOL mEnabled;
  95. void* mUserdata;
  96. LLSD mItemValue;
  97. std::vector<LLScrollListCell *> mColumns;
  98. LLRect mRectangle;
  99. };
  100. #endif