diff options
author | Bryan O'Sullivan <bos@lindenlab.com> | 2009-08-31 13:47:47 -0700 |
---|---|---|
committer | Bryan O'Sullivan <bos@lindenlab.com> | 2009-08-31 13:47:47 -0700 |
commit | 30ff6cabd61f2f083df5df1e6e70cc94742af477 (patch) | |
tree | 631935f1cf59d19a91cdad65e9a75fe825afda7d /indra/llui/llstyle.cpp | |
parent | ff11d74820c89822cd067b51727d9df1dc87d0d0 (diff) | |
parent | 3ac3a4b206c08ed06b889bdaa24074b6aa0e020a (diff) |
Merge with trunk
Diffstat (limited to 'indra/llui/llstyle.cpp')
-rw-r--r-- | indra/llui/llstyle.cpp | 125 |
1 files changed, 28 insertions, 97 deletions
diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index a716cbbaec..929a809d88 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -33,112 +33,43 @@ #include "linden_common.h" #include "llstyle.h" + +#include "llfontgl.h" #include "llstring.h" #include "llui.h" -//#include "llviewerimagelist.h" - -LLStyle::LLStyle() +LLStyle::Params::Params() +: visible("visible", true), + drop_shadow("drop_shadow", false), + color("color", LLColor4::black), + font("font", LLFontGL::getFontMonospace()), + image("image"), + link_href("href") +{} + + +LLStyle::LLStyle(const LLStyle::Params& p) +: mVisible(p.visible), + mColor(p.color()), + mFont(p.font()), + mLink(p.link_href), + mDropShadow(p.drop_shadow), + mImageHeight(0), + mImageWidth(0), + mImagep(p.image()) +{} + +void LLStyle::setFont(const LLFontGL* font) { - init(TRUE, LLColor4(0,0,0,1),LLStringUtil::null); + mFont = font; } -LLStyle::LLStyle(const LLStyle &style) -{ - if (this != &style) - { - init(style.isVisible(),style.getColor(),style.getFontString()); - if (style.isLink()) - { - setLinkHREF(style.getLinkHREF()); - } - mItalic = style.mItalic; - mBold = style.mBold; - mUnderline = style.mUnderline; - mDropShadow = style.mDropShadow; - mImageHeight = style.mImageHeight; - mImageWidth = style.mImageWidth; - mImagep = style.mImagep; - mIsEmbeddedItem = style.mIsEmbeddedItem; - } - else - { - init(TRUE, LLColor4(0,0,0,1),LLStringUtil::null); - } -} -LLStyle::LLStyle(BOOL is_visible, const LLColor4 &color, const std::string& font_name) +const LLFontGL* LLStyle::getFont() const { - init(is_visible, color, font_name); + return mFont; } -void LLStyle::init(BOOL is_visible, const LLColor4 &color, const std::string& font_name) -{ - mVisible = is_visible; - mColor = color; - setFontName(font_name); - setLinkHREF(LLStringUtil::null); - mItalic = FALSE; - mBold = FALSE; - mUnderline = FALSE; - mDropShadow = FALSE; - mImageHeight = 0; - mImageWidth = 0; - mIsEmbeddedItem = FALSE; -} - - -// Copy assignment -LLStyle &LLStyle::operator=(const LLStyle &rhs) -{ - if (this != &rhs) - { - setVisible(rhs.isVisible()); - setColor(rhs.getColor()); - this->mFontName = rhs.getFontString(); - this->mLink = rhs.getLinkHREF(); - mImagep = rhs.mImagep; - mImageHeight = rhs.mImageHeight; - mImageWidth = rhs.mImageWidth; - mItalic = rhs.mItalic; - mBold = rhs.mBold; - mUnderline = rhs.mUnderline; - mDropShadow = rhs.mDropShadow; - mIsEmbeddedItem = rhs.mIsEmbeddedItem; - } - - return *this; -} - - -void LLStyle::setFontName(const std::string& fontname) -{ - mFontName = fontname; - - std::string fontname_lc = fontname; - LLStringUtil::toLower(fontname_lc); - - mFontID = LLFONT_OCRA; // default - - if ((fontname_lc == "sansserif") || (fontname_lc == "sans-serif")) - { - mFontID = LLFONT_SANSSERIF; - } - else if ((fontname_lc == "serif")) - { - mFontID = LLFONT_SMALL; - } - else if ((fontname_lc == "sansserifbig")) - { - mFontID = LLFONT_SANSSERIF_BIG; - } - else if (fontname_lc == "small") - { - mFontID = LLFONT_SANSSERIF_SMALL; - } -} - - void LLStyle::setLinkHREF(const std::string& href) { mLink = href; @@ -166,7 +97,7 @@ LLUIImagePtr LLStyle::getImage() const void LLStyle::setImage(const LLUUID& src) { - mImagep = LLUI::sImageProvider->getUIImageByID(src); + mImagep = LLUI::getUIImageByID(src); } |