bool ItemListPlugin::_get(const StringName& p_name,Variant &r_ret) const { String name = p_name; int idx = name.get_slice("/",0).to_int(); String what=name.get_slice("/",1); if (what=="text") r_ret=get_item_text(idx); else if (what=="icon") r_ret=get_item_icon(idx); else if (what=="checkable") r_ret=is_item_checkable(idx); else if (what=="checked") r_ret=is_item_checked(idx); else if (what=="id") r_ret=get_item_id(idx); else if (what=="enabled") r_ret=is_item_enabled(idx); else if (what=="separator") r_ret=is_item_separator(idx); else return false; return true; }
void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const { if( sEntries.empty() ) { return; } for (std::set<llwchar>::const_iterator iter1 = mEmbeddedUsedChars.begin(); iter1 != mEmbeddedUsedChars.end(); ++iter1) { llwchar wch = *iter1; item_map_t::iterator iter2 = sEntries.find(wch); if (iter2 == sEntries.end()) { continue; } LLInventoryItem* item = iter2->second.mItem; if (!item) { continue; } LLUIImagePtr image = get_item_icon(item->getType(), item->getInventoryType(), 0, item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS);//LLUI::getUIImage(img_name); font->addEmbeddedChar( wch, image->getImage(), item->getName() ); } }
bool ItemListPlugin::_get(const StringName &p_name, Variant &r_ret) const { String name = p_name; int idx = name.get_slice("/", 0).to_int(); String what = name.get_slice("/", 1); if (what == "text") r_ret = get_item_text(idx); else if (what == "icon") r_ret = get_item_icon(idx); else if (what == "checkable") { // This keeps compatibility to/from versions where this property was a boolean, before radio buttons if (!is_item_checkable(idx)) { r_ret = 0; } else { r_ret = is_item_radio_checkable(idx) ? 2 : 1; } } else if (what == "checked") r_ret = is_item_checked(idx); else if (what == "id") r_ret = get_item_id(idx); else if (what == "enabled") r_ret = is_item_enabled(idx); else if (what == "separator") r_ret = is_item_separator(idx); else return false; return true; }
Array ItemList::_get_items() const { Array items; for (int i = 0; i < get_item_count(); i++) { items.push_back(get_item_text(i)); items.push_back(get_item_icon(i)); items.push_back(is_item_disabled(i)); } return items; }
Array OptionButton::_get_items() const { Array items; for (int i = 0; i < get_item_count(); i++) { items.push_back(get_item_text(i)); items.push_back(get_item_icon(i)); items.push_back(is_item_disabled(i)); items.push_back(get_item_ID(i)); items.push_back(get_item_metadata(i)); } return items; }
Array PopupMenu::_get_items() const { Array items; for (int i = 0; i < get_item_count(); i++) { items.push_back(get_item_text(i)); items.push_back(get_item_icon(i)); items.push_back(is_item_checkable(i)); items.push_back(is_item_checked(i)); items.push_back(is_item_disabled(i)); items.push_back(get_item_id(i)); items.push_back(get_item_accelerator(i)); items.push_back(get_item_metadata(i)); items.push_back(get_item_submenu(i)); items.push_back(is_item_separator(i)); } return items; }
Array PopupMenu::_get_items() const { Array items; for (int i = 0; i < get_item_count(); i++) { items.push_back(get_item_text(i)); items.push_back(get_item_icon(i)); // For compatibility, use false/true for no/checkbox and integers for other values int ct = this->items[i].checkable_type; items.push_back(Variant(ct <= Item::CHECKABLE_TYPE_CHECK_BOX ? is_item_checkable(i) : ct)); items.push_back(is_item_checked(i)); items.push_back(is_item_disabled(i)); items.push_back(get_item_id(i)); items.push_back(get_item_accelerator(i)); items.push_back(get_item_metadata(i)); items.push_back(get_item_submenu(i)); items.push_back(is_item_separator(i)); } return items; }
LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, const std::string& message, const std::string& from_name, const LLUUID& group_id, const LLUUID& group_insignia, const std::string& group_name, const U32& t, const bool& has_inventory, const std::string& inventory_name, LLOfferInfo* inventory_offer) : LLPanel(std::string("groupnotify"), LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), mAnimating(TRUE), mTimer(), mGroupID(group_id), mHasInventory(has_inventory), mInventoryOffer(inventory_offer) { setFocusRoot(TRUE); time_t timestamp = (time_t)t; std::string time_buf = g_formatted_time(timestamp); setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); // TODO: add a color for group notices setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); LLIconCtrl* icon; LLTextEditor* text; const S32 VPAD = 2; const S32 TOP = getRect().getHeight() - 32; // Get past the top menu bar const S32 BOTTOM_PAD = VPAD * 2; const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + VPAD; const S32 RIGHT = getRect().getWidth() - HPAD - HPAD; const S32 LINE_HEIGHT = 16; const S32 LABEL_WIDTH = 64; const S32 ICON_WIDTH = 64; S32 y = TOP; S32 x = HPAD + HPAD; class NoticeText : public LLTextBox { public: NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL) : LLTextBox(name, rect, text, font) { setHAlign(LLFontGL::RIGHT); setFontStyle(LLFontGL::DROP_SHADOW_SOFT); setBorderVisible(FALSE); setColor( gColors.getColor("GroupNotifyTextColor") ); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); } }; // Title addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),std::string("Group Notice"),LLFontGL::sSansSerifHuge)); y -= llfloor(1.5f*LINE_HEIGHT); x += HPAD + HPAD + ICON_WIDTH; std::stringstream from; from << "Sent by " << from_name << ", " << group_name; addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::sSansSerif)); y -= (LINE_HEIGHT + VPAD); x = HPAD + HPAD; // TODO: change this to be the group icon. if (!group_insignia.isNull()) { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), group_insignia); } else { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + ICON_WIDTH; // If we have inventory with this message, leave room for the name. S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); text = new LLViewerTextEditor(std::string("box"), LLRect(x, y, RIGHT, box_bottom), DB_GROUP_NOTICE_MSG_STR_LEN, LLStringUtil::null, LLFontGL::sSansSerif, FALSE); static const LLStyleSP headerstyle(new LLStyle(true,LLColor4::black,"SansSerifBig")); static const LLStyleSP datestyle(new LLStyle(true,LLColor4::black,"serif")); text->appendStyledText(subject,false,false,&headerstyle); text->appendStyledText(time_buf,false,false,&datestyle); // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); text->appendColoredText(message,false,false,LLColor4::grey4); LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); text->setCursor(0,0); text->setEnabled(FALSE); text->setWordWrap(TRUE); //text->setTabStop(FALSE); // was interfering with copy-and-paste text->setTabsToNextField(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(TRUE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( semi_transparent ); text->setWriteableBgColor ( semi_transparent ); addChild(text); y = box_bottom - VPAD; if (mHasInventory) { addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),std::string("Attached: "),LLFontGL::sSansSerif)); LLUIImagePtr item_icon = get_item_icon(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, 0, FALSE); x += LABEL_WIDTH + HPAD; std::stringstream ss; ss << " " << inventory_name; LLTextBox *line = new LLTextBox(std::string("object_name"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str(),LLFontGL::sSansSerif); line->setEnabled(FALSE); line->setBorderVisible(TRUE); line->setDisabledColor(LLColor4::blue4); line->setFontStyle(LLFontGL::NORMAL); line->setBackgroundVisible(true); line->setBackgroundColor( semi_transparent ); addChild(line); icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+16, y-16), item_icon->getName()); icon->setMouseOpaque(FALSE); addChild(icon); } LLButton* btn; btn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, onClickNext, this, LLFontGL::sSansSerif); btn->setToolTip(std::string("Next")); // *TODO: Translate btn->setScaleImage(TRUE); addChild(btn); mNextBtn = btn; S32 btn_width = 80; S32 wide_btn_width = 120; LLRect btn_rect; x = 3 * HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, btn_width, BTN_HEIGHT); btn = new LLButton(std::string("OK"), btn_rect, LLStringUtil::null, onClickOk, this); addChild(btn, -1); setDefaultBtn(btn); x += btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); btn = new LLButton(std::string("Group Notices"), btn_rect, LLStringUtil::null, onClickGroupInfo, this); btn->setToolTip(std::string("View past notices or opt-out of receiving these messages here.")); // TODO: Translate addChild(btn, -1); if (mHasInventory && mInventoryOffer) { x += wide_btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); std::string btn_lbl(""); if(is_openable(mInventoryOffer->mType)) { btn_lbl = "Open Attachment"; } else { btn_lbl = "Save Attachment"; } mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, onClickSaveInventory, this); mSaveInventoryBtn->setVisible(mHasInventory); addChild(mSaveInventoryBtn); } sGroupNotifyBoxCount++; // If this is the only notify box, don't show the next button if (sGroupNotifyBoxCount == 1) { mNextBtn->setVisible(FALSE); } }