PageRenderTime 27ms CodeModel.GetById 16ms app.highlight 9ms 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
  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
 28#ifndef LLSCROLLLISTITEM_H
 29#define LLSCROLLLISTITEM_H
 30
 31#include "llpointer.h"		// LLPointer<>
 32#include "llsd.h"
 33#include "v4color.h"
 34#include "llinitparam.h"
 35#include "llscrolllistcell.h"
 36
 37#include <vector>
 38
 39class LLCoordGL;
 40class LLCheckBoxCtrl;
 41class LLResizeBar;
 42class LLScrollListCtrl;
 43class LLScrollColumnHeader;
 44class LLUIImage;
 45
 46//---------------------------------------------------------------------------
 47// LLScrollListItem
 48//---------------------------------------------------------------------------
 49class LLScrollListItem
 50{
 51	friend class LLScrollListCtrl;
 52public:
 53	struct Params : public LLInitParam::Block<Params>
 54	{
 55		Optional<bool>		enabled;
 56		Optional<void*>		userdata;
 57		Optional<LLSD>		value;
 58		
 59		Ignored				name; // use for localization tools
 60		Ignored				type; 
 61		Ignored				length; 
 62
 63		Multiple<LLScrollListCell::Params> columns;
 64
 65		Params()
 66		:	enabled("enabled", true),
 67			value("value"),
 68			name("name"),
 69			type("type"),
 70			length("length"),
 71			columns("columns")
 72		{
 73			addSynonym(columns, "column");
 74			addSynonym(value, "id");
 75		}
 76	};
 77
 78	virtual ~LLScrollListItem();
 79
 80	void	setSelected( BOOL b )			{ mSelected = b; }
 81	BOOL	getSelected() const				{ return mSelected; }
 82
 83	void	setEnabled( BOOL b )			{ mEnabled = b; }
 84	BOOL	getEnabled() const 				{ return mEnabled; }
 85
 86	void	setHighlighted( BOOL b )		{ mHighlighted = b; }
 87	BOOL	getHighlighted() const			{ return mHighlighted; }
 88
 89	void	setUserdata( void* userdata )	{ mUserdata = userdata; }
 90	void*	getUserdata() const 			{ return mUserdata; }
 91
 92	virtual LLUUID	getUUID() const			{ return mItemValue.asUUID(); }
 93	LLSD	getValue() const				{ return mItemValue; }
 94	
 95	void	setRect(LLRect rect)			{ mRectangle = rect; }
 96	LLRect	getRect() const					{ return mRectangle; }
 97
 98	void	addColumn( const LLScrollListCell::Params& p );
 99
100	void	setNumColumns(S32 columns);
101
102	void	setColumn( S32 column, LLScrollListCell *cell );
103	
104	S32		getNumColumns() const;
105
106	LLScrollListCell *getColumn(const S32 i) const;
107
108	std::string getContentsCSV() const;
109
110	virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);
111
112protected:
113	LLScrollListItem( const Params& );
114
115private:
116	BOOL	mSelected;
117	BOOL	mHighlighted;
118	BOOL	mEnabled;
119	void*	mUserdata;
120	LLSD	mItemValue;
121	std::vector<LLScrollListCell *> mColumns;
122	LLRect  mRectangle;
123};
124
125#endif