コード例 #1
0
void LLScrollListIcon::setValue(const LLSD& value)
{
	if (value.isUUID())
	{
		// don't use default image specified by LLUUID::null, use no image in that case
		LLUUID image_id = value.asUUID();
		mIcon = image_id.notNull() ? LLUI::getUIImageByID(image_id) : LLUIImagePtr(NULL);
	}
	else
	{
		std::string value_string = value.asString();
		if (LLUUID::validate(value_string))
		{
			setValue(LLUUID(value_string));
		}
		else if (!value_string.empty())
		{
			mIcon = LLUI::getUIImage(value.asString());
		}
		else
		{
			mIcon = NULL;
		}
	}
}
コード例 #2
0
LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const
{
	LLInventoryItem* item = getEmbeddedItemPtr(ext_char);
	if (item)
	{
		const char* img_name = "";
		switch( item->getType() )
		{
			case LLAssetType::AT_TEXTURE:
				if(item->getInventoryType() == LLInventoryType::IT_SNAPSHOT)
				{
					img_name = "Inv_Snapshot";
				}
				else
				{
					img_name = "Inv_Texture";
				}

				break;
			case LLAssetType::AT_SOUND:			img_name = "Inv_Sound";		break;
			case LLAssetType::AT_CLOTHING:		img_name = "Inv_Clothing";	break;
			case LLAssetType::AT_OBJECT:
				img_name = LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags() ?
					"Inv_Object_Multi" : "Inv_Object";
				break;
			case LLAssetType::AT_CALLINGCARD:	img_name = "Inv_CallingCard"; break;
			case LLAssetType::AT_LANDMARK:		img_name = "Inv_Landmark"; 	break;
			case LLAssetType::AT_NOTECARD:		img_name = "Inv_Notecard";	break;
			case LLAssetType::AT_LSL_TEXT:		img_name = "Inv_Script";	break;
			case LLAssetType::AT_BODYPART:		img_name = "Inv_Skin";		break;
			case LLAssetType::AT_ANIMATION:		img_name = "Inv_Animation";	break;
			case LLAssetType::AT_GESTURE:		img_name = "Inv_Gesture";	break;
			case LLAssetType::AT_MESH:      	img_name = "Inv_Mesh";	    break;
			default:                        	img_name = "Inv_Invalid";   break; // use the Inv_Invalid icon for undefined object types (see MAINT-3981)
		}

		return LLUI::getUIImage(img_name);
	}
	return LLUIImagePtr();
}