diff options
Diffstat (limited to 'linden/indra/llui/llscrolllistctrl.cpp')
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.cpp | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index 22987dc..fd98bd5 100644 --- a/linden/indra/llui/llscrolllistctrl.cpp +++ b/linden/indra/llui/llscrolllistctrl.cpp | |||
@@ -99,7 +99,7 @@ protected: | |||
99 | // LLScrollListIcon | 99 | // LLScrollListIcon |
100 | // | 100 | // |
101 | LLScrollListIcon::LLScrollListIcon(LLImageGL* icon, S32 width, LLUUID image_id) : | 101 | LLScrollListIcon::LLScrollListIcon(LLImageGL* icon, S32 width, LLUUID image_id) : |
102 | mIcon(icon), mImageUUID(image_id.asString()) | 102 | mIcon(icon), mColor(LLColor4::white), mImageUUID(image_id.asString()) |
103 | { | 103 | { |
104 | if (width) | 104 | if (width) |
105 | { | 105 | { |
@@ -115,6 +115,16 @@ LLScrollListIcon::~LLScrollListIcon() | |||
115 | { | 115 | { |
116 | } | 116 | } |
117 | 117 | ||
118 | void LLScrollListIcon::setColor(const LLColor4& color) | ||
119 | { | ||
120 | mColor = color; | ||
121 | } | ||
122 | |||
123 | void LLScrollListIcon::drawToWidth(S32 width, const LLColor4& color, const LLColor4& highlight_color) const | ||
124 | { | ||
125 | gl_draw_image(0, 0, mIcon, mColor); | ||
126 | } | ||
127 | |||
118 | // | 128 | // |
119 | // LLScrollListCheck | 129 | // LLScrollListCheck |
120 | // | 130 | // |
@@ -208,6 +218,15 @@ LLScrollListText::~LLScrollListText() | |||
208 | delete mColor; | 218 | delete mColor; |
209 | } | 219 | } |
210 | 220 | ||
221 | void LLScrollListText::setColor(const LLColor4& color) | ||
222 | { | ||
223 | if (!mColor) | ||
224 | { | ||
225 | mColor = new LLColor4(); | ||
226 | } | ||
227 | *mColor = color; | ||
228 | } | ||
229 | |||
211 | void LLScrollListText::setText(const LLString& text) | 230 | void LLScrollListText::setText(const LLString& text) |
212 | { | 231 | { |
213 | mText = text; | 232 | mText = text; |
@@ -2809,6 +2828,8 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p | |||
2809 | LLString fontname = (*itor)["font"].asString(); | 2828 | LLString fontname = (*itor)["font"].asString(); |
2810 | LLString fontstyle = (*itor)["font-style"].asString(); | 2829 | LLString fontstyle = (*itor)["font-style"].asString(); |
2811 | LLString type = (*itor)["type"].asString(); | 2830 | LLString type = (*itor)["type"].asString(); |
2831 | BOOL has_color = (*itor).has("color"); | ||
2832 | LLColor4 color = ((*itor)["color"]); | ||
2812 | 2833 | ||
2813 | const LLFontGL *font = gResMgr->getRes(fontname); | 2834 | const LLFontGL *font = gResMgr->getRes(fontname); |
2814 | if (!font) | 2835 | if (!font) |
@@ -2821,21 +2842,41 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p | |||
2821 | { | 2842 | { |
2822 | LLUUID image_id = value.asUUID(); | 2843 | LLUUID image_id = value.asUUID(); |
2823 | LLImageGL* icon = LLUI::sImageProvider->getUIImageByID(image_id); | 2844 | LLImageGL* icon = LLUI::sImageProvider->getUIImageByID(image_id); |
2824 | new_item->setColumn(index, new LLScrollListIcon(icon, width, image_id)); | 2845 | LLScrollListIcon* cell = new LLScrollListIcon(icon, width, image_id); |
2846 | if (has_color) | ||
2847 | { | ||
2848 | cell->setColor(color); | ||
2849 | } | ||
2850 | new_item->setColumn(index, cell); | ||
2825 | } | 2851 | } |
2826 | else if (type == "checkbox") | 2852 | else if (type == "checkbox") |
2827 | { | 2853 | { |
2828 | LLCheckBoxCtrl* ctrl = new LLCheckBoxCtrl(value.asString(), | 2854 | LLCheckBoxCtrl* ctrl = new LLCheckBoxCtrl(value.asString(), |
2829 | LLRect(0, 0, width, width), "label"); | 2855 | LLRect(0, 0, width, width), "label"); |
2830 | new_item->setColumn(index, new LLScrollListCheck(ctrl,width)); | 2856 | LLScrollListCheck* cell = new LLScrollListCheck(ctrl,width); |
2857 | if (has_color) | ||
2858 | { | ||
2859 | cell->setColor(color); | ||
2860 | } | ||
2861 | new_item->setColumn(index, cell); | ||
2831 | } | 2862 | } |
2832 | else if (type == "separator") | 2863 | else if (type == "separator") |
2833 | { | 2864 | { |
2834 | new_item->setColumn(index, new LLScrollListSeparator(width)); | 2865 | LLScrollListSeparator* cell = new LLScrollListSeparator(width); |
2866 | if (has_color) | ||
2867 | { | ||
2868 | cell->setColor(color); | ||
2869 | } | ||
2870 | new_item->setColumn(index, cell); | ||
2835 | } | 2871 | } |
2836 | else | 2872 | else |
2837 | { | 2873 | { |
2838 | new_item->setColumn(index, new LLScrollListText(value.asString(), font, width, font_style, font_alignment)); | 2874 | LLScrollListText* cell = new LLScrollListText(value.asString(), font, width, font_style, font_alignment); |
2875 | if (has_color) | ||
2876 | { | ||
2877 | cell->setColor(color); | ||
2878 | } | ||
2879 | new_item->setColumn(index, cell); | ||
2839 | if (columnp->mHeader && !value.asString().empty()) | 2880 | if (columnp->mHeader && !value.asString().empty()) |
2840 | { | 2881 | { |
2841 | columnp->mHeader->setHasResizableElement(TRUE); | 2882 | columnp->mHeader->setHasResizableElement(TRUE); |