本文整理汇总了C++中LLCtrlListInterface::addElement方法的典型用法代码示例。如果您正苦于以下问题:C++ LLCtrlListInterface::addElement方法的具体用法?C++ LLCtrlListInterface::addElement怎么用?C++ LLCtrlListInterface::addElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLCtrlListInterface
的用法示例。
在下文中一共展示了LLCtrlListInterface::addElement方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processDirGroupsReply
// static
void LLPanelDirBrowser::processDirGroupsReply(LLMessageSystem* msg, void**)
{
S32 i;
LLUUID query_id;
LLUUID group_id;
std::string group_name;
S32 members;
F32 search_order;
msg->getUUIDFast(_PREHASH_QueryData,_PREHASH_QueryID, query_id );
LLPanelDirBrowser* self;
self = gDirBrowserInstances.getIfThere(query_id);
if (!self)
{
return;
}
self->mHaveSearchResults = TRUE;
LLCtrlListInterface *list = self->childGetListInterface("results");
if (!list) return;
if (!list->getCanSelect())
{
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
self->mResultsContents = LLSD();
}
S32 rows = msg->getNumberOfBlocksFast(_PREHASH_QueryReplies);
self->mResultsReceived += rows;
rows = self->showNextButton(rows);
for (i = 0; i < rows; i++)
{
msg->getUUIDFast(_PREHASH_QueryReplies, _PREHASH_GroupID, group_id, i );
msg->getStringFast(_PREHASH_QueryReplies, _PREHASH_GroupName, group_name, i);
msg->getS32Fast(_PREHASH_QueryReplies, _PREHASH_Members, members, i );
msg->getF32Fast(_PREHASH_QueryReplies, _PREHASH_SearchOrder, search_order, i );
if (group_id.isNull())
{
continue;
}
LLSD content;
content["type"] = GROUP_CODE;
content["name"] = group_name;
LLSD row;
row["id"] = group_id;
LLUUID image_id;
row["columns"][0]["column"] = "icon";
row["columns"][0]["type"] = "icon";
row["columns"][0]["color"] = gColors.getColor("DefaultListIcon").getValue();
row["columns"][0]["value"] = "icon_group.tga";
row["columns"][1]["column"] = "name";
row["columns"][1]["color"] = gColors.getColor("DefaultListText").getValue();
row["columns"][1]["value"] = group_name;
row["columns"][1]["font"] = "SANSSERIF";
row["columns"][2]["column"] = "members";
row["columns"][2]["color"] = gColors.getColor("DefaultListText").getValue();
row["columns"][2]["value"] = members;
row["columns"][2]["font"] = "SANSSERIFSMALL";
row["columns"][3]["column"] = "score";
row["columns"][3]["color"] = gColors.getColor("DefaultListText").getValue();
row["columns"][3]["value"] = search_order;
list->addElement(row);
self->mResultsContents[group_id.asString()] = content;
}
list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending);
self->updateResultCount();
// Poke the result received timer
self->mLastResultTimer.reset();
self->mDidAutoSelect = FALSE;
}
示例2: processDirPlacesReply
void LLPanelDirBrowser::processDirPlacesReply(LLMessageSystem* msg, void**)
{
LLUUID agent_id;
LLUUID query_id;
LLUUID parcel_id;
std::string name;
BOOL is_for_sale;
BOOL is_auction;
F32 dwell;
msg->getUUID("AgentData", "AgentID", agent_id);
msg->getUUID("QueryData", "QueryID", query_id );
if (msg->getNumberOfBlocks("StatusData"))
{
U32 status;
msg->getU32("StatusData", "Status", status);
if (status & STATUS_SEARCH_PLACES_BANNEDWORD)
{
LLNotifications::instance().add("SearchWordBanned");
}
}
LLPanelDirBrowser* self;
self = gDirBrowserInstances.getIfThere(query_id);
if (!self)
{
// data from an old query
return;
}
self->mHaveSearchResults = TRUE;
LLCtrlListInterface *list = self->childGetListInterface("results");
if (!list) return;
if (!list->getCanSelect())
{
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
self->mResultsContents = LLSD();
}
S32 count = msg->getNumberOfBlocks("QueryReplies");
self->mResultsReceived += count;
count = self->showNextButton(count);
for (S32 i = 0; i < count ; i++)
{
msg->getUUID("QueryReplies", "ParcelID", parcel_id, i);
msg->getString("QueryReplies", "Name", name, i);
msg->getBOOL("QueryReplies", "ForSale", is_for_sale, i);
msg->getBOOL("QueryReplies", "Auction", is_auction, i);
msg->getF32("QueryReplies", "Dwell", dwell, i);
if (parcel_id.isNull())
{
continue;
}
LLSD content;
S32 type;
LLSD row = self->createLandSale(parcel_id, is_auction, is_for_sale, name, &type);
content["type"] = type;
content["name"] = name;
std::string buffer = llformat("%.0f", (F64)dwell);
row["columns"][3]["column"] = "dwell";
row["columns"][3]["value"] = buffer;
row["columns"][3]["font"] = "SANSSERIFSMALL";
row["columns"][3]["color"] = gColors.getColor("DefaultListText").getValue();
list->addElement(row);
self->mResultsContents[parcel_id.asString()] = content;
}
list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending);
self->updateResultCount();
// Poke the result received timer
self->mLastResultTimer.reset();
self->mDidAutoSelect = FALSE;
}
示例3: processDirEventsReply
//.........这里部分代码省略.........
U32 event_id;
U32 unix_time;
U32 event_flags;
msg->getUUID("QueryReplies", "OwnerID", owner_id, i);
msg->getString("QueryReplies", "Name", name, i);
msg->getU32("QueryReplies", "EventID", event_id, i);
msg->getString("QueryReplies", "Date", date, i);
msg->getU32("QueryReplies", "UnixTime", unix_time, i);
msg->getU32("QueryReplies", "EventFlags", event_flags, i);
// Skip empty events
if (owner_id.isNull())
{
//RN: should this check event_id instead?
llwarns << "skipped event due to owner_id null, event_id " << event_id << llendl;
continue;
}
// skip events that don't match the flags
// there's no PG flag, so we make sure neither adult nor mature is set
if (((event_flags & (EVENT_FLAG_ADULT | EVENT_FLAG_MATURE)) == EVENT_FLAG_NONE) && !show_pg)
{
//llwarns << "Skipped pg event because we're not showing pg, event_id " << event_id << llendl;
continue;
}
if ((event_flags & EVENT_FLAG_MATURE) && !show_mature)
{
//llwarns << "Skipped mature event because we're not showing mature, event_id " << event_id << llendl;
continue;
}
if ((event_flags & EVENT_FLAG_ADULT) && !show_adult)
{
//llwarns << "Skipped adult event because we're not showing adult, event_id " << event_id << llendl;
continue;
}
LLSD content;
content["type"] = EVENT_CODE;
content["name"] = name;
content["event_id"] = (S32)event_id;
LLSD row;
row["id"] = llformat("%u", event_id);
// Column 0 - event icon
LLUUID image_id;
if (event_flags == EVENT_FLAG_ADULT)
{
row["columns"][0]["column"] = "icon";
row["columns"][0]["type"] = "icon";
row["columns"][0]["value"] = "icon_event_adult.tga";
row["columns"][0]["color"] = gColors.getColor("DefaultListIcon").getValue();
}
else if (event_flags == EVENT_FLAG_MATURE)
{
row["columns"][0]["column"] = "icon";
row["columns"][0]["type"] = "icon";
row["columns"][0]["color"] = gColors.getColor("DefaultListIcon").getValue();
row["columns"][0]["value"] = "icon_event_mature.tga";
}
else
{
row["columns"][0]["column"] = "icon";
row["columns"][0]["type"] = "icon";
row["columns"][0]["color"] = gColors.getColor("DefaultListIcon").getValue();
row["columns"][0]["value"] = "icon_event.tga";
}
row["columns"][1]["column"] = "name";
row["columns"][1]["color"] = gColors.getColor("DefaultListText").getValue();
row["columns"][1]["value"] = name;
row["columns"][1]["font"] = "SANSSERIF";
row["columns"][2]["column"] = "date";
row["columns"][2]["color"] = gColors.getColor("DefaultListText").getValue();
row["columns"][2]["value"] = date;
row["columns"][2]["font"] = "SANSSERIFSMALL";
row["columns"][3]["column"] = "time";
row["columns"][3]["color"] = gColors.getColor("DefaultListText").getValue();
row["columns"][3]["value"] = llformat("%u", unix_time);
row["columns"][3]["font"] = "SANSSERIFSMALL";
list->addElement(row, ADD_SORTED);
std::string id_str = llformat("%u", event_id);
self->mResultsContents[id_str] = content;
}
list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending);
self->updateResultCount();
// Poke the result received timer
self->mLastResultTimer.reset();
self->mDidAutoSelect = FALSE;
}
示例4: processDirPeopleReply
void LLPanelDirBrowser::processDirPeopleReply(LLMessageSystem *msg, void**)
{
LLUUID query_id;
std::string first_name;
std::string last_name;
LLUUID agent_id;
msg->getUUIDFast(_PREHASH_QueryData,_PREHASH_QueryID, query_id);
LLPanelDirBrowser* self;
self = gDirBrowserInstances.getIfThere(query_id);
if (!self)
{
// data from an old query
return;
}
self->mHaveSearchResults = TRUE;
LLCtrlListInterface *list = self->childGetListInterface("results");
if (!list) return;
if (!list->getCanSelect())
{
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
self->mResultsContents = LLSD();
}
S32 rows = msg->getNumberOfBlocksFast(_PREHASH_QueryReplies);
self->mResultsReceived += rows;
rows = self->showNextButton(rows);
for (S32 i = 0; i < rows; i++)
{
msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_FirstName, first_name, i);
msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_LastName, last_name, i);
msg->getUUIDFast( _PREHASH_QueryReplies,_PREHASH_AgentID, agent_id, i);
// msg->getU8Fast( _PREHASH_QueryReplies,_PREHASH_Online, online, i);
// unused
// msg->getStringFast(_PREHASH_QueryReplies,_PREHASH_Group, group, i);
// msg->getS32Fast( _PREHASH_QueryReplies,_PREHASH_Reputation, reputation, i);
if (agent_id.isNull())
{
continue;
}
LLSD content;
LLSD row;
row["id"] = agent_id;
// We don't show online status in the finder anymore,
// so just use the 'offline' icon as the generic 'person' icon
row["columns"][0]["column"] = "icon";
row["columns"][0]["type"] = "icon";
row["columns"][0]["color"] = gColors.getColor("DefaultListIcon").getValue();
row["columns"][0]["value"] = "icon_avatar_offline.tga";
content["type"] = AVATAR_CODE;
std::string fullname = first_name + " " + last_name;
row["columns"][1]["column"] = "name";
row["columns"][1]["color"] = gColors.getColor("DefaultListText").getValue();
row["columns"][1]["value"] = fullname;
row["columns"][1]["font"] = "SANSSERIF";
content["name"] = fullname;
list->addElement(row);
self->mResultsContents[agent_id.asString()] = content;
}
list->sortByColumn(self->mCurrentSortColumn, self->mCurrentSortAscending);
self->updateResultCount();
// Poke the result received timer
self->mLastResultTimer.reset();
self->mDidAutoSelect = FALSE;
}
示例5: processPlacesReply
//.........这里部分代码省略.........
LLCtrlListInterface *list = self->childGetListInterface("parcel list");
if (!list) return;
// If this is the first packet, clear out the "loading..." indicator
if (!self->mFirstPacketReceived)
{
self->mFirstPacketReceived = TRUE;
list->operateOnAll(LLCtrlSelectionInterface::OP_DELETE);
}
LLUUID owner_id;
std::string name;
std::string desc;
S32 actual_area;
S32 billable_area;
U8 flags;
F32 global_x;
F32 global_y;
std::string sim_name;
std::string land_sku;
std::string land_type;
S32 i;
S32 count = msg->getNumberOfBlocks("QueryData");
for (i = 0; i < count; i++)
{
msg->getUUID("QueryData", "OwnerID", owner_id, i);
msg->getString("QueryData", "Name", name, i);
msg->getString("QueryData", "Desc", desc, i);
msg->getS32("QueryData", "ActualArea", actual_area, i);
msg->getS32("QueryData", "BillableArea", billable_area, i);
msg->getU8("QueryData", "Flags", flags, i);
msg->getF32("QueryData", "GlobalX", global_x, i);
msg->getF32("QueryData", "GlobalY", global_y, i);
msg->getString("QueryData", "SimName", sim_name, i);
if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 )
{
msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i);
llinfos << "Land sku: " << land_sku << llendl;
land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku);
}
else
{
land_sku.clear();
land_type = LLTrans::getString("land_type_unknown");
}
if(owner_id.notNull())
{
self->mActualArea += actual_area;
self->mBillableArea += billable_area;
S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
std::string location;
location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y);
std::string area;
if(billable_area == actual_area)
{
area = llformat("%d", billable_area);
}
else
{
area = llformat("%d / %d", billable_area, actual_area);
}
std::string hidden;
hidden = llformat("%f %f", global_x, global_y);
LLSD element;
element["columns"][0]["column"] = "name";
element["columns"][0]["value"] = name;
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][1]["column"] = "location";
element["columns"][1]["value"] = location;
element["columns"][1]["font"] = "SANSSERIF";
element["columns"][2]["column"] = "area";
element["columns"][2]["value"] = area;
element["columns"][2]["font"] = "SANSSERIF";
element["columns"][3]["column"] = "type";
element["columns"][3]["value"] = land_type;
element["columns"][3]["font"] = "SANSSERIF";
// hidden is always last column
element["columns"][4]["column"] = "hidden";
element["columns"][4]["value"] = hidden;
list->addElement(element);
}
}
self->refreshAggregates();
}
示例6: buildClothingList
void LLFloaterClothing::buildClothingList()
{
//llinfos << "buildClothingList" << llendl;
LLCtrlListInterface *list = childGetListInterface("clothing_list");
if (!list) return;
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
LLIsClothing is_clothing;
gInventory.collectDescendentsIf(gAgent.getInventoryRootID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
is_clothing);
S32 count = items.count();
for(S32 i = 0; i < count; ++i)
{
LLInventoryItem* item = items.get(i);
LLSD row;
row["id"] = item->getUUID();
BOOL item_is_multi = FALSE;
if ( item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
{
item_is_multi = TRUE;
}
LLUUID image_id = get_item_icon_uuid(item->getType(),
item->getInventoryType(),
item->getFlags(), item_is_multi); // flags = wearable type
row["columns"][0]["column"] = "icon";
row["columns"][0]["type"] = "icon";
row["columns"][0]["value"] = image_id;
LLString text = item->getName();
LLString style = "NORMAL";
if( gAgent.isWearingItem( item->getUUID() ) )
{
text.append(" (worn)");
style = "BOLD";
}
row["columns"][1]["column"] = "name";
row["columns"][1]["value"] = text;
row["columns"][1]["font"] = "SANSSERIFSMALL";
row["columns"][1]["font-style"] = style;
// hidden column for sorting
U32 flags = item->getFlags(); // flags = wearable type
enum EWearableType wearable_type = (enum EWearableType)flags;
const char* wearable_label = LLWearable::typeToTypeLabel(wearable_type);
//line->addColumn(wearable_label, FONT, -1); // invisible
row["columns"][2]["column"] = "sort";
row["columns"][2]["value"] = wearable_label;
list->addElement(row);
}
if (count > 0)
{
mAllowSelection = TRUE;
}
else if (LLInventoryModel::backgroundFetchActive())
{
// We're loading
list->addSimpleElement(LOADING_STRING);
mAllowSelection = FALSE;
}
else
{
// Weird case, we're done loading but have no clothing
list->addSimpleElement("No clothing found.");
mAllowSelection = FALSE;
}
}
示例7: handleReply
void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
{
U32 request_flags;
U32 total_count;
msg->getU32Fast(_PREHASH_RequestData, _PREHASH_RequestFlags, request_flags);
msg->getU32Fast(_PREHASH_RequestData, _PREHASH_TotalObjectCount, total_count);
msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode);
LLCtrlListInterface *list = childGetListInterface("objects_list");
if (!list) return;
S32 block_count = msg->getNumberOfBlocks("ReportData");
for (S32 block = 0; block < block_count; ++block)
{
U32 task_local_id;
U32 time_stamp = 0;
LLUUID task_id;
F32 location_x, location_y, location_z;
F32 score;
std::string name_buf;
std::string owner_buf;
F32 mono_score = 0.f;
bool have_extended_data = false;
msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block);
msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block);
msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationX, location_x, block);
msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationY, location_y, block);
msg->getF32Fast(_PREHASH_ReportData, _PREHASH_LocationZ, location_z, block);
msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block);
msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block);
msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block);
if(msg->getNumberOfBlocks("DataExtended"))
{
have_extended_data = true;
msg->getU32("DataExtended", "TimeStamp", time_stamp, block);
msg->getF32(_PREHASH_ReportData, "MonoScore", mono_score, block);
}
LLSD element;
element["id"] = task_id;
element["object_name"] = name_buf;
element["owner_name"] = owner_buf;
element["columns"][0]["column"] = "score";
element["columns"][0]["value"] = llformat("%0.3f", score);
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][1]["column"] = "name";
element["columns"][1]["value"] = name_buf;
element["columns"][1]["font"] = "SANSSERIF";
element["columns"][2]["column"] = "owner";
element["columns"][2]["value"] = owner_buf;
element["columns"][2]["font"] = "SANSSERIF";
element["columns"][3]["column"] = "location";
element["columns"][3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z);
element["columns"][3]["font"] = "SANSSERIF";
element["columns"][3]["column"] = "time";
element["columns"][3]["value"] = formatted_time((time_t)time_stamp);
element["columns"][3]["font"] = "SANSSERIF";
if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS
&& have_extended_data)
{
element["columns"][4]["column"] = "Mono Time";
element["columns"][4]["value"] = llformat("%0.3f", mono_score);
element["columns"][4]["font"] = "SANSSERIF";
}
list->addElement(element);
mObjectListData.append(element);
mObjectListIDs.push_back(task_id);
mtotalScore += score;
}
if (total_count == 0 && list->getItemCount() == 0)
{
LLSD element;
element["id"] = LLUUID::null;
element["columns"][0]["column"] = "name";
element["columns"][0]["value"] = getString("none_descriptor");
element["columns"][0]["font"] = "SANSSERIF";
list->addElement(element);
}
else
{
list->selectFirstItem();
}
if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS)
{
setTitle(getString("top_scripts_title"));
list->setColumnLabel("score", getString("scripts_score_label"));
LLUIString format = getString("top_scripts_text");
format.setArg("[COUNT]", llformat("%d", total_count));
//.........这里部分代码省略.........
示例8: processDirLandReply
//.........这里部分代码省略.........
S32 i;
S32 count = msg->getNumberOfBlocks("QueryReplies");
self->mResultsReceived += count;
S32 non_auction_count = 0;
for (i = 0; i < count; i++)
{
msg->getUUID( "QueryReplies", "ParcelID", parcel_id, i);
msg->getString( "QueryReplies", "Name", name, i);
msg->getBOOL( "QueryReplies", "Auction", auction, i);
msg->getBOOL( "QueryReplies", "ForSale", for_sale, i);
msg->getS32( "QueryReplies", "SalePrice", sale_price, i);
msg->getS32( "QueryReplies", "ActualArea", actual_area, i);
if ( msg->getSizeFast(_PREHASH_QueryReplies, i, _PREHASH_ProductSKU) > 0 )
{
msg->getStringFast( _PREHASH_QueryReplies, _PREHASH_ProductSKU, land_sku, i);
llinfos << "Land sku: " << land_sku << llendl;
land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku);
}
else
{
land_sku.clear();
land_type = LLTrans::getString("land_type_unknown");
}
if (parcel_id.isNull()) continue;
if (use_price && (sale_price > limit_price)) continue;
if (use_area && (actual_area < limit_area)) continue;
LLSD content;
S32 type;
LLSD row = self->createLandSale(parcel_id, auction, for_sale, name, &type);
content["type"] = type;
content["name"] = name;
content["landtype"] = land_type;
std::string buffer = "Auction";
if (!auction)
{
buffer = llformat("%d", sale_price);
non_auction_count++;
}
row["columns"][3]["column"] = "price";
row["columns"][3]["value"] = buffer;
row["columns"][3]["font"] = "SANSSERIFSMALL";
buffer = llformat("%d", actual_area);
row["columns"][4]["column"] = "area";
row["columns"][4]["value"] = buffer;
row["columns"][4]["font"] = "SANSSERIFSMALL";
if (!auction)
{
F32 price_per_meter;
if (actual_area > 0)
{
price_per_meter = (F32)sale_price / (F32)actual_area;
}
else
{
price_per_meter = 0.f;
}
// Prices are usually L$1 - L$10 / meter
buffer = llformat("%.1f", price_per_meter);
row["columns"][5]["column"] = "per_meter";
row["columns"][5]["value"] = buffer;
row["columns"][5]["font"] = "SANSSERIFSMALL";
}
else
{
// Auctions start at L$1 per meter
row["columns"][5]["column"] = "per_meter";
row["columns"][5]["value"] = "1.0";
row["columns"][5]["font"] = "SANSSERIFSMALL";
}
row["columns"][6]["column"] = "landtype";
row["columns"][6]["value"] = land_type;
row["columns"][6]["font"] = "SANSSERIFSMALL";
list->addElement(row);
self->mResultsContents[parcel_id.asString()] = content;
}
// All auction results are shown on the first page
// But they don't count towards the 100 / page limit
// So figure out the next button here, when we know how many aren't auctions
count = self->showNextButton(non_auction_count);
self->updateResultCount();
// Poke the result received timer
self->mLastResultTimer.reset();
self->mDidAutoSelect = FALSE;
}