PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 8ms RepoModel.GetById 2ms 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
  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
 27#ifndef LLCTRLSELECTIONINTERFACE_H
 28#define LLCTRLSELECTIONINTERFACE_H
 29
 30#include "stdtypes.h"
 31#include "stdenums.h"
 32#include "llstring.h"
 33
 34class LLSD;
 35class LLUUID;
 36class LLScrollListItem;
 37
 38class LLCtrlSelectionInterface
 39{
 40public:
 41	virtual ~LLCtrlSelectionInterface();
 42	
 43	enum EOperation
 44	{
 45		OP_DELETE = 1,
 46		OP_SELECT,
 47		OP_DESELECT,
 48	};
 49
 50	virtual BOOL	getCanSelect() const = 0;
 51
 52	virtual S32		getItemCount() const = 0;
 53
 54	virtual BOOL	selectFirstItem() = 0;
 55	virtual BOOL	selectNthItem( S32 index ) = 0;
 56	virtual BOOL	selectItemRange( S32 first, S32 last ) = 0;
 57
 58	virtual S32		getFirstSelectedIndex() const = 0;
 59
 60	// TomY TODO: Simply cast the UUIDs to LLSDs, using the selectByValue function
 61	virtual BOOL	setCurrentByID( const LLUUID& id ) = 0;
 62	virtual LLUUID	getCurrentID() const = 0;
 63
 64			BOOL	selectByValue(const LLSD value);
 65			BOOL	deselectByValue(const LLSD value);
 66	virtual BOOL	setSelectedByValue(const LLSD& value, BOOL selected) = 0;
 67	virtual LLSD	getSelectedValue() = 0;
 68
 69	virtual BOOL	isSelected(const LLSD& value) const = 0;
 70
 71	virtual BOOL	operateOnSelection(EOperation op) = 0;
 72	virtual BOOL	operateOnAll(EOperation op) = 0;
 73};
 74
 75class LLCtrlListInterface : public LLCtrlSelectionInterface
 76{
 77public:
 78	virtual ~LLCtrlListInterface();
 79	
 80	virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM) = 0;
 81	virtual void clearColumns() = 0;
 82	virtual void setColumnLabel(const std::string& column, const std::string& label) = 0;
 83	// TomY TODO: Document this
 84	virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL) = 0;
 85
 86	LLScrollListItem* addSimpleElement(const std::string& value); // defaults to bottom
 87	LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos); // defaults to no LLSD() id
 88	virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos, const LLSD& id) = 0;
 89
 90	virtual void clearRows() = 0;
 91	virtual void sortByColumn(const std::string& name, BOOL ascending) = 0;
 92};
 93
 94class LLCtrlScrollInterface
 95{
 96public:
 97	virtual ~LLCtrlScrollInterface();
 98	
 99	virtual S32 getScrollPos() const = 0;
100	virtual void setScrollPos( S32 pos ) = 0;
101	virtual void scrollToShowSelected() = 0;
102};
103
104#endif