PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llviewborder.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 110 lines | 65 code | 19 blank | 26 comment | 0 complexity | 8b8f20eaf10a834594829d55f5f7610f MD5 | raw file
  1/** 
  2 * @file llviewborder.h
  3 * @brief A customizable decorative border.  Does not interact with mouse events.
  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_LLVIEWBORDER_H
 28#define LL_LLVIEWBORDER_H
 29
 30#include "llview.h"
 31
 32class LLViewBorder : public LLView
 33{
 34public:
 35	typedef enum e_bevel { BEVEL_IN, BEVEL_OUT, BEVEL_BRIGHT, BEVEL_NONE } EBevel ;
 36	typedef enum e_style { STYLE_LINE, STYLE_TEXTURE } EStyle;
 37
 38	struct BevelValues
 39	:	public LLInitParam::TypeValuesHelper<LLViewBorder::EBevel, BevelValues>
 40	{
 41		static void declareValues();
 42	};
 43
 44	struct StyleValues
 45	:	public LLInitParam::TypeValuesHelper<LLViewBorder::EStyle, StyleValues>
 46	{
 47		static void declareValues();
 48	};
 49
 50	struct Params : public LLInitParam::Block<Params, LLView::Params>
 51	{
 52		Optional<EBevel, BevelValues>	bevel_style;
 53		Optional<EStyle, StyleValues>	render_style;	
 54		Optional<S32>					border_thickness;
 55
 56		Optional<LLUIColor>		highlight_light_color,
 57								highlight_dark_color,
 58								shadow_light_color,
 59								shadow_dark_color;
 60
 61		Params();
 62	};
 63protected:
 64	LLViewBorder(const Params&);
 65	friend class LLUICtrlFactory;
 66public:
 67	virtual void setValue(const LLSD& val) { setRect(LLRect(val)); }
 68
 69	virtual BOOL isCtrl() const { return FALSE; }
 70
 71	// llview functionality
 72	virtual void draw();
 73	
 74	static BOOL getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style);
 75
 76	void		setBorderWidth(S32 width)			{ mBorderWidth = width; }
 77	S32			getBorderWidth() const				{ return mBorderWidth; }
 78	void		setBevel(EBevel bevel)				{ mBevel = bevel; }
 79	EBevel		getBevel() const					{ return mBevel; }
 80	void		setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light );
 81	void		setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark,
 82				  				   const LLColor4& highlight_light, const LLColor4& highlight_dark );
 83	void		setTexture( const class LLUUID &image_id );
 84
 85	LLColor4	getHighlightLight() {return mHighlightLight.get();}
 86	LLColor4	getShadowDark() {return mHighlightDark.get();}
 87
 88	EStyle		getStyle() const { return mStyle; }
 89
 90	void		setKeyboardFocusHighlight( BOOL b )	{ mHasKeyboardFocus = b; }
 91
 92private:
 93	void		drawOnePixelLines();
 94	void		drawTwoPixelLines();
 95	void		drawTextures();
 96	
 97	EBevel		mBevel;
 98	EStyle		mStyle;
 99	LLUIColor	mHighlightLight;
100	LLUIColor	mHighlightDark;
101	LLUIColor	mShadowLight;
102	LLUIColor	mShadowDark;
103	LLUIColor	mBackgroundColor;
104	S32			mBorderWidth;
105	LLPointer<LLUIImage>	mTexture;
106	BOOL		mHasKeyboardFocus;
107};
108
109#endif // LL_LLVIEWBORDER_H
110