diff --git a/indra/newview/lldroptarget.cpp b/indra/newview/lldroptarget.cpp index 6e9b6e277..1aea26a94 100644 --- a/indra/newview/lldroptarget.cpp +++ b/indra/newview/lldroptarget.cpp @@ -39,6 +39,7 @@ #include +#include "llbutton.h" #include "llinventorymodel.h" #include "llstartup.h" #include "lltextbox.h" @@ -58,6 +59,7 @@ std::string currently_set_to(const LLInventoryItem* item) LLDropTarget::LLDropTarget(const LLDropTarget::Params& p) : LLView(p) +, mReset(NULL) { setToolTip(std::string(p.tool_tip)); @@ -76,6 +78,11 @@ LLDropTarget::LLDropTarget(const LLDropTarget::Params& p) mBorder->setMouseOpaque(false); if (!p.border_visible) mBorder->setBorderWidth(0); + if (p.show_reset) + { + addChild(mReset = new LLButton("reset", LLRect(), "icn_clear_lineeditor.tga", "icn_clear_lineeditor.tga", "", boost::bind(&LLDropTarget::setValue, this, _2))); + } + // Now set the rects of the children p.fill_parent ? fillParent(getParent()) : setChildRects(p.rect); } @@ -98,6 +105,16 @@ void LLDropTarget::initFromXML(LLXMLNodePtr node, LLView* parent) LLView::initFromXML(node, parent); const LLRect& rect = getRect(); + if (node->hasAttribute("show_reset")) + { + bool show; + node->getAttribute_bool("show_reset", show); + if (!show) + { + delete mReset; + mReset = NULL; + } + } setChildRects(LLRect(0, rect.getHeight(), rect.getWidth(), 0)); if (node->hasAttribute("name")) // Views can't have names, but drop targets can @@ -171,6 +188,17 @@ void LLDropTarget::setControlName(const std::string& control_name, LLView* conte void LLDropTarget::setChildRects(LLRect rect) { mBorder->setRect(rect); + if (mReset) + { + // Reset button takes rightmost part of the text area. + S32 height(rect.getHeight()); + rect.mRight -= height; + mText->setRect(rect); + rect.mLeft = rect.mRight; + rect.mRight += height; + mReset->setRect(rect); + } + else { mText->setRect(rect); } diff --git a/indra/newview/lldroptarget.h b/indra/newview/lldroptarget.h index 37f97030f..69d9a6998 100644 --- a/indra/newview/lldroptarget.h +++ b/indra/newview/lldroptarget.h @@ -47,11 +47,13 @@ public: Optional border_visible; // Whether or not to display the border Optional control_name; // Control to change on item drop (Per Account only) Optional label; // Label for the LLTextBox, used when label doesn't dynamically change on drop + Optional show_reset; // Whether or not to show the reset button Optional fill_parent; // Whether or not to fill the direct parent, to have a larger drop target. If true, the next sibling must explicitly define its rect without deltas. Params() : border_visible("border_visible", true) , control_name("control_name", "") , label("label", "") + , show_reset("show_reset", true) , fill_parent("fill_parent", false) { changeDefault(mouse_opaque, false); @@ -85,6 +87,7 @@ protected: LLControlVariable* mControl; boost::signals2::scoped_connection mConnection; class LLTextBox* mText; + class LLButton* mReset; }; #endif // LLDROPTARGET_H diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 40e450dd7..e6bfd0251 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -71,7 +71,14 @@ const S32 NOTICE_DATE_STRING_SIZE = 30; class LLGroupDropTarget : public LLDropTarget { public: - LLGroupDropTarget(const LLDropTarget::Params& p = LLDropTarget::Params()); + struct Params : public LLInitParam::Block + { + Params() + { + changeDefault(show_reset, false); // We have a button for this + } + }; + LLGroupDropTarget(const Params& p = Params()); ~LLGroupDropTarget() {}; // @@ -92,14 +99,14 @@ protected: LLPanelGroupNotices* mGroupNoticesPanel; }; -LLGroupDropTarget::LLGroupDropTarget(const LLDropTarget::Params& p) +LLGroupDropTarget::LLGroupDropTarget(const LLGroupDropTarget::Params& p) : LLDropTarget(p) {} // static LLView* LLGroupDropTarget::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory* factory) { - LLGroupDropTarget* target = new LLGroupDropTarget(); + LLGroupDropTarget* target = new LLGroupDropTarget; target->initFromXML(node, parent); return target; } diff --git a/indra/newview/skins/default/xui/en-us/panel_avatar.xml b/indra/newview/skins/default/xui/en-us/panel_avatar.xml index 9c59c900e..84be27a55 100644 --- a/indra/newview/skins/default/xui/en-us/panel_avatar.xml +++ b/indra/newview/skins/default/xui/en-us/panel_avatar.xml @@ -131,7 +131,7 @@ mouse_opaque="true" name="Give item:" v_pad="0" width="75"> Give item: - +