PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llui/llctrlselectioninterface.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 104 lines | 57 code | 20 blank | 27 comment | 0 complexity | e34095028c4312798f56c576c87c563b MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llctrlselectioninterface.h
  3. * @brief Programmatic selection of items in a list.
  4. *
  5. * $LicenseInfo:firstyear=2006&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 LLCTRLSELECTIONINTERFACE_H
  27. #define LLCTRLSELECTIONINTERFACE_H
  28. #include "stdtypes.h"
  29. #include "stdenums.h"
  30. #include "llstring.h"
  31. class LLSD;
  32. class LLUUID;
  33. class LLScrollListItem;
  34. class LLCtrlSelectionInterface
  35. {
  36. public:
  37. virtual ~LLCtrlSelectionInterface();
  38. enum EOperation
  39. {
  40. OP_DELETE = 1,
  41. OP_SELECT,
  42. OP_DESELECT,
  43. };
  44. virtual BOOL getCanSelect() const = 0;
  45. virtual S32 getItemCount() const = 0;
  46. virtual BOOL selectFirstItem() = 0;
  47. virtual BOOL selectNthItem( S32 index ) = 0;
  48. virtual BOOL selectItemRange( S32 first, S32 last ) = 0;
  49. virtual S32 getFirstSelectedIndex() const = 0;
  50. // TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function
  51. virtual BOOL setCurrentByID( const LLUUID& id ) = 0;
  52. virtual LLUUID getCurrentID() const = 0;
  53. BOOL selectByValue(const LLSD value);
  54. BOOL deselectByValue(const LLSD value);
  55. virtual BOOL setSelectedByValue(const LLSD& value, BOOL selected) = 0;
  56. virtual LLSD getSelectedValue() = 0;
  57. virtual BOOL isSelected(const LLSD& value) const = 0;
  58. virtual BOOL operateOnSelection(EOperation op) = 0;
  59. virtual BOOL operateOnAll(EOperation op) = 0;
  60. };
  61. class LLCtrlListInterface : public LLCtrlSelectionInterface
  62. {
  63. public:
  64. virtual ~LLCtrlListInterface();
  65. virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM) = 0;
  66. virtual void clearColumns() = 0;
  67. virtual void setColumnLabel(const std::string& column, const std::string& label) = 0;
  68. // TomY TODO: Document this
  69. virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL) = 0;
  70. LLScrollListItem* addSimpleElement(const std::string& value); // defaults to bottom
  71. LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos); // defaults to no LLSD() id
  72. virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) = 0;
  73. virtual void clearRows() = 0;
  74. virtual void sortByColumn(const std::string& name, BOOL ascending) = 0;
  75. };
  76. class LLCtrlScrollInterface
  77. {
  78. public:
  79. virtual ~LLCtrlScrollInterface();
  80. virtual S32 getScrollPos() const = 0;
  81. virtual void setScrollPos( S32 pos ) = 0;
  82. virtual void scrollToShowSelected() = 0;
  83. };
  84. #endif