LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
:	LLScrollListCell(p),
	mText(p.value().asString()),
	mFont(LLFontGL::getFontSansSerifSmall()),
	mColor(p.color),
	mUseColor(p.color.isProvided()),
	mFontStyle(LLFontGL::getStyleFromString(p.font_style)),
	mFontAlignment(p.font_halign),
	mVisible(p.visible),
	mHighlightCount( 0 ),
	mHighlightOffset( 0 )
{
	sCount++;

	mTextWidth = getWidth();

	if (p.font.isProvided())
	{
		if (const LLFontGL* font = LLResMgr::getInstance()->getRes(p.font)) // Common CAPITALIZED font name?
			mFont = font;
		else // Less common camelCase font?
		{
			LLFontDescriptor font_desc;
			font_desc.setName(p.font);
			if (const LLFontGL* font = LLFontGL::getFont(font_desc))
				mFont = font;
		}
	}

	// initialize rounded rect image
	if (!mRoundedRectImage)
	{
		mRoundedRectImage = LLUI::getUIImage("rounded_square.tga");
	}
}
//
// LLScrollListIcon
//
LLScrollListIcon::LLScrollListIcon(const LLScrollListCell::Params& p)
:	LLScrollListCell(p),
	// <edit>
	mCallback(NULL),
	// </edit>
	mColor(p.color),
	mAlignment(p.font_halign)
{
	setValue(p.value().asString());
}
LLScrollListDate::LLScrollListDate( const LLScrollListCell::Params& p)
:	LLScrollListText(p),
	mFormat(p.format),
	mDate(p.value().asDate())
{}
//
// LLScrollListCheck
//
LLScrollListCheck::LLScrollListCheck(const LLScrollListCell::Params& p)
:	LLScrollListCell(p)
{
	mCheckBox = new LLCheckBoxCtrl("checkbox", LLRect(0, p.width, p.width, 0), "", NULL, NULL, p.value());
	mCheckBox->setEnabled(p.enabled);

	LLRect rect(mCheckBox->getRect());
	if (p.width)
	{
		rect.mRight = rect.mLeft + p.width;
		mCheckBox->setRect(rect);
		setWidth(p.width);
	}
	else
	{
		setWidth(rect.getWidth()); //check_box->getWidth();
	}

	mCheckBox->setColor(p.color);
}
void ALFloaterRegionTracker::refresh()
{
	if (!mRegionMap.size())
	{
		updateHeader();
		return;
	}

	const std::string& saved_selected_value = mRegionScrollList->getSelectedValue().asString();
	mRegionScrollList->deleteAllItems();

	const std::string& cur_region_name = gAgent.getRegion()->getName();

	for (LLSD::map_const_iterator it = mRegionMap.beginMap(); it != mRegionMap.endMap(); it++)
	{
		const std::string& sim_name = it->first;
		const LLSD& data = it->second;
		if (data.isMap()) // Assume the rest is correct.
		{
			LLScrollListCell::Params label;
			LLScrollListCell::Params maturity;
			LLScrollListCell::Params region;
			LLScrollListCell::Params count;
			label.column("region_label").type("text").value(data["label"].asString());
			maturity.column("region_maturity_icon").type("icon").font_halign(LLFontGL::HCENTER);
			region.column("region_name").type("text").value(sim_name);
			count.column("region_agent_count").type("text").value("...");
			if (LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromName(sim_name))
			{
				maturity.value(info->getAccessIcon());

				info->updateAgentCount(LLTimer::getElapsedSeconds());
				S32 agent_count = info->getAgentCount();
				if (info->isDown())
				{
					label.color(LLColor4::red);
					maturity.color(LLColor4::red);
					region.color(LLColor4::red);
					count.color(LLColor4::red);
					count.value(0);
				}
				else
					count.value((sim_name == cur_region_name) ? agent_count + 1 : agent_count);
			}
			else
			{
				label.color(LLColor4::grey);
				maturity.color(LLColor4::grey);
				region.color(LLColor4::grey);
				count.color(LLColor4::grey);

				LLWorldMapMessage::getInstance()->sendNamedRegionRequest(sim_name);
				if (!mEventTimer.getStarted()) mEventTimer.start();
			}
			LLScrollListItem::Params row;
			row.value = sim_name;
			row.columns.add(label);
			row.columns.add(maturity);
			row.columns.add(region);
			row.columns.add(count);
			mRegionScrollList->addRow(row);
		}
	}
	if (!saved_selected_value.empty())
		mRegionScrollList->selectByValue(saved_selected_value);
}