00001 00032 #ifndef LL_LLSTYLE_H 00033 #define LL_LLSTYLE_H 00034 00035 #include "v4color.h" 00036 #include "llresmgr.h" 00037 #include "llfont.h" 00038 #include "llui.h" 00039 00040 class LLStyle : public LLRefCount 00041 { 00042 public: 00043 LLStyle(); 00044 LLStyle(const LLStyle &style); 00045 LLStyle(BOOL is_visible, const LLColor4 &color, const LLString& font_name); 00046 00047 LLStyle &operator=(const LLStyle &rhs); 00048 00049 virtual void init (BOOL is_visible, const LLColor4 &color, const LLString& font_name); 00050 00051 virtual const LLColor4& getColor() const { return mColor; } 00052 virtual void setColor(const LLColor4 &color) { mColor = color; } 00053 00054 virtual BOOL isVisible() const; 00055 virtual void setVisible(BOOL is_visible); 00056 00057 virtual const LLString& getFontString() const { return mFontName; } 00058 virtual void setFontName(const LLString& fontname); 00059 virtual LLFONT_ID getFontID() const { return mFontID; } 00060 00061 virtual const LLString& getLinkHREF() const { return mLink; } 00062 virtual void setLinkHREF(const LLString& href); 00063 virtual BOOL isLink() const; 00064 00065 virtual LLUIImagePtr getImage() const; 00066 virtual void setImage(const LLUUID& src); 00067 00068 virtual BOOL isImage() const { return ((mImageWidth != 0) && (mImageHeight != 0)); } 00069 virtual void setImageSize(S32 width, S32 height); 00070 00071 BOOL getIsEmbeddedItem() const { return mIsEmbeddedItem; } 00072 void setIsEmbeddedItem( BOOL b ) { mIsEmbeddedItem = b; } 00073 00074 // inlined here to make it easier to compare to member data below. -MG 00075 bool operator==(const LLStyle &rhs) const 00076 { 00077 return 00078 mVisible == rhs.isVisible() 00079 && mColor == rhs.getColor() 00080 && mFontName == rhs.getFontString() 00081 && mLink == rhs.getLinkHREF() 00082 && mImagep == rhs.mImagep 00083 && mImageHeight == rhs.mImageHeight 00084 && mImageWidth == rhs.mImageWidth 00085 && mItalic == rhs.mItalic 00086 && mBold == rhs.mBold 00087 && mUnderline == rhs.mUnderline 00088 && mDropShadow == rhs.mDropShadow 00089 && mIsEmbeddedItem == rhs.mIsEmbeddedItem; 00090 } 00091 00092 bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); } 00093 00094 public: 00095 BOOL mItalic; 00096 BOOL mBold; 00097 BOOL mUnderline; 00098 BOOL mDropShadow; 00099 S32 mImageWidth; 00100 S32 mImageHeight; 00101 00102 protected: 00103 virtual ~LLStyle() { } 00104 00105 private: 00106 BOOL mVisible; 00107 LLColor4 mColor; 00108 LLString mFontName; 00109 LLFONT_ID mFontID; 00110 LLString mLink; 00111 LLUIImagePtr mImagep; 00112 BOOL mIsEmbeddedItem; 00113 }; 00114 00115 typedef LLPointer<LLStyle> LLStyleSP; 00116 00117 #endif // LL_LLSTYLE_H