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

/indra/llui/llstyle.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 118 lines | 74 code | 19 blank | 25 comment | 16 complexity | e624c333fe8f1f1ee5f3ef611e73b750 MD5 | raw file
  1/** 
  2 * @file llstyle.h
  3 * @brief Text style 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_LLSTYLE_H
 28#define LL_LLSTYLE_H
 29
 30#include "v4color.h"
 31#include "llui.h"
 32#include "llinitparam.h"
 33#include "lluiimage.h"
 34
 35class LLFontGL;
 36
 37class LLStyle : public LLRefCount
 38{
 39public:
 40	struct Params : public LLInitParam::Block<Params>
 41	{
 42		Optional<bool>					visible;
 43		Optional<LLFontGL::ShadowType>	drop_shadow;
 44		Optional<LLUIColor>				color,
 45										readonly_color,
 46										selected_color;
 47		Optional<const LLFontGL*>		font;
 48		Optional<LLUIImage*>			image;
 49		Optional<std::string>			link_href;
 50		Optional<bool>					is_link;
 51		Params();
 52	};
 53	LLStyle(const Params& p = Params());
 54public:
 55	const LLUIColor& getColor() const { return mColor; }
 56	void setColor(const LLUIColor &color) { mColor = color; }
 57
 58	const LLUIColor& getReadOnlyColor() const { return mReadOnlyColor; }
 59	void setReadOnlyColor(const LLUIColor& color) { mReadOnlyColor = color; }
 60
 61	const LLUIColor& getSelectedColor() const { return mSelectedColor; }
 62	void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; }
 63
 64	BOOL isVisible() const;
 65	void setVisible(BOOL is_visible);
 66
 67	LLFontGL::ShadowType getShadowType() const { return mDropShadow; }
 68
 69	void setFont(const LLFontGL* font);
 70	const LLFontGL* getFont() const;
 71
 72	const std::string& getLinkHREF() const { return mLink; }
 73	void setLinkHREF(const std::string& href);
 74	BOOL isLink() const;
 75
 76	LLPointer<LLUIImage> getImage() const;
 77	void setImage(const LLUUID& src);
 78	void setImage(const std::string& name);
 79
 80	BOOL isImage() const { return mImagep.notNull(); }
 81
 82	bool operator==(const LLStyle &rhs) const
 83	{
 84		return 
 85			mVisible == rhs.mVisible
 86			&& mColor == rhs.mColor
 87			&& mReadOnlyColor == rhs.mReadOnlyColor
 88			&& mSelectedColor == rhs.mSelectedColor
 89			&& mFont == rhs.mFont
 90			&& mLink == rhs.mLink
 91			&& mImagep == rhs.mImagep
 92			&& mDropShadow == rhs.mDropShadow;
 93	}
 94
 95	bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); }
 96
 97public:	
 98	LLFontGL::ShadowType		mDropShadow;
 99
100protected:
101	~LLStyle() { }
102
103private:
104	BOOL				mVisible;
105	LLUIColor			mColor;
106	LLUIColor   		mReadOnlyColor;
107	LLUIColor			mSelectedColor;
108	std::string			mFontName;
109	const LLFontGL*		mFont;
110	std::string			mLink;
111	bool				mIsLink;
112	LLPointer<LLUIImage> mImagep;
113};
114
115typedef LLPointer<LLStyle> LLStyleSP;
116typedef LLPointer<const LLStyle> LLStyleConstSP;
117
118#endif  // LL_LLSTYLE_H