PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llstyle.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 104 lines | 63 code | 16 blank | 25 comment | 0 complexity | 815abd3ea33a8dce5a81ab3e62e6ebf1 MD5 | raw file
  1/** 
  2 * @file llstyle.cpp
  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#include "linden_common.h"
 28
 29#include "llstyle.h"
 30
 31#include "llfontgl.h"
 32#include "llstring.h"
 33#include "llui.h"
 34
 35LLStyle::Params::Params()
 36:	visible("visible", true),
 37	drop_shadow("drop_shadow", LLFontGL::NO_SHADOW),
 38	color("color", LLColor4::black),
 39	readonly_color("readonly_color", LLColor4::black),
 40	selected_color("selected_color", LLColor4::black),
 41	font("font", LLFontGL::getFontMonospace()),
 42	image("image"),
 43	link_href("href"),
 44	is_link("is_link")
 45{}
 46
 47
 48LLStyle::LLStyle(const LLStyle::Params& p)
 49:	mVisible(p.visible),
 50	mColor(p.color),
 51	mReadOnlyColor(p.readonly_color),
 52	mSelectedColor(p.selected_color),
 53	mFont(p.font()),
 54	mLink(p.link_href),
 55	mIsLink(p.is_link.isProvided() ? p.is_link : !p.link_href().empty()),
 56	mDropShadow(p.drop_shadow),
 57	mImagep(p.image())
 58{}
 59
 60void LLStyle::setFont(const LLFontGL* font)
 61{
 62	mFont = font;
 63}
 64
 65
 66const LLFontGL* LLStyle::getFont() const
 67{
 68	return mFont;
 69}
 70
 71void LLStyle::setLinkHREF(const std::string& href)
 72{
 73	mLink = href;
 74}
 75
 76BOOL LLStyle::isLink() const
 77{
 78	return mIsLink;
 79}
 80
 81BOOL LLStyle::isVisible() const
 82{
 83	return mVisible;
 84}
 85
 86void LLStyle::setVisible(BOOL is_visible)
 87{
 88	mVisible = is_visible;
 89}
 90
 91LLPointer<LLUIImage> LLStyle::getImage() const
 92{
 93	return mImagep;
 94}
 95
 96void LLStyle::setImage(const LLUUID& src)
 97{
 98	mImagep = LLUI::getUIImageByID(src);
 99}
100
101void LLStyle::setImage(const std::string& name)
102{
103	mImagep = LLUI::getUIImage(name);
104}