summaryrefslogtreecommitdiff
path: root/indra/llui/llsearcheditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llsearcheditor.cpp')
-rw-r--r--indra/llui/llsearcheditor.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp
index 6fa99df82e..ec2ad5e5fa 100644
--- a/indra/llui/llsearcheditor.cpp
+++ b/indra/llui/llsearcheditor.cpp
@@ -44,22 +44,34 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
S32 srch_btn_top = p.search_button.top_pad + p.search_button.rect.height;
S32 srch_btn_right = p.search_button.rect.width + p.search_button.left_pad;
LLRect srch_btn_rect(p.search_button.left_pad, srch_btn_top, srch_btn_right, p.search_button.top_pad);
+
+ S32 clr_btn_top = p.clear_button.rect.bottom + p.clear_button.rect.height;
+ S32 clr_btn_right = getRect().getWidth() - p.clear_button.pad_right;
+ S32 clr_btn_left = clr_btn_right - p.clear_button.rect.width;
+ LLRect clear_btn_rect(clr_btn_left, clr_btn_top, clr_btn_right, p.clear_button.rect.bottom);
+
S32 text_pad_left = p.text_pad_left;
+ S32 text_pad_right = p.text_pad_right;
if (p.search_button_visible)
text_pad_left += srch_btn_rect.getWidth();
+ if (p.clear_button_visible)
+ text_pad_right = getRect().getWidth() - clr_btn_left + p.clear_button.pad_left;
+
// Set up line editor.
LLLineEditor::Params line_editor_params(p);
line_editor_params.name("filter edit box");
line_editor_params.rect(getLocalRect());
line_editor_params.follows.flags(FOLLOWS_ALL);
line_editor_params.text_pad_left(text_pad_left);
+ line_editor_params.text_pad_right(text_pad_right);
line_editor_params.revert_on_esc(false);
line_editor_params.commit_callback.function(boost::bind(&LLUICtrl::onCommit, this));
line_editor_params.keystroke_callback(boost::bind(&LLSearchEditor::handleKeystroke, this));
mSearchEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_params);
+ mSearchEditor->setPassDelete(TRUE);
addChild(mSearchEditor);
if (p.search_button_visible)
@@ -79,8 +91,6 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
if (p.clear_button_visible)
{
// Set up clear button.
- S32 clr_btn_width = getRect().getHeight(); // button is square, and as tall as search editor
- LLRect clear_btn_rect(getRect().getWidth() - clr_btn_width, getRect().getHeight(), getRect().getWidth(), 0);
LLButton::Params clr_btn_params(p.clear_button);
clr_btn_params.name(std::string("clear button"));
clr_btn_params.rect(clear_btn_rect) ;
@@ -153,7 +163,7 @@ void LLSearchEditor::setFocus( BOOL b )
void LLSearchEditor::onClearButtonClick(const LLSD& data)
{
setText(LLStringUtil::null);
- mSearchEditor->doDelete(); // force keystroke callback
+ mSearchEditor->onCommit(); // force keystroke callback
}
void LLSearchEditor::handleKeystroke()