PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/lliconctrl.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 94 lines | 44 code | 16 blank | 34 comment | 0 complexity | 511a8b00493c91803f3a3199e8e9e26e MD5 | raw file
 1/** 
 2 * @file lliconctrl.h
 3 * @brief LLIconCtrl base class
 4 *
 5 * $LicenseInfo:firstyear=2001&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 LL_LLICONCTRL_H
28#define LL_LLICONCTRL_H
29
30#include "lluuid.h"
31#include "v4color.h"
32#include "lluictrl.h"
33#include "lluiimage.h"
34#include "stdenums.h"
35
36class LLTextBox;
37class LLUICtrlFactory;
38
39//
40// Classes
41//
42
43// 
44class LLIconCtrl
45: public LLUICtrl
46{
47public:
48	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
49	{
50		Optional<LLUIImage*>	image;
51		Optional<LLUIColor>		color;
52		Optional<bool>			use_draw_context_alpha;
53		Ignored					scale_image;
54		Params();
55	};
56protected:
57	LLIconCtrl(const Params&);
58	friend class LLUICtrlFactory;
59
60public:
61	virtual ~LLIconCtrl();
62
63	// llview overrides
64	virtual void	draw();
65
66	// lluictrl overrides
67	virtual void	setValue(const LLSD& value );
68
69	std::string	getImageName() const;
70
71	void			setColor(const LLColor4& color) { mColor = color; }
72	void			setImage(LLPointer<LLUIImage> image) { mImagep = image; }
73	const LLPointer<LLUIImage> getImage() { return mImagep; }
74	
75private:
76	void setIconImageDrawSize() ;
77
78protected:
79	S32 mPriority;
80
81	//the output size of the icon image if set.
82	S32 mDrawWidth ;
83	S32 mDrawHeight ;
84
85	// If set to true (default), use the draw context transparency.
86	// If false, will use transparency returned by getCurrentTransparency(). See STORM-698.
87	bool mUseDrawContextAlpha;
88
89private:
90	LLUIColor mColor;
91	LLPointer<LLUIImage> mImagep;
92};
93
94#endif