From 18566c502398e0e449717a06b1ffae3966e55522 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Mon, 31 Aug 2020 21:27:37 +0300
Subject: SL-13852 Add visibility options to inventory search results

---
 indra/llui/lllineeditor.h     |  3 +++
 indra/llui/llsearcheditor.cpp | 22 +++++++++++++++++++++-
 indra/llui/llsearcheditor.h   | 20 ++++++++++++++++++--
 3 files changed, 42 insertions(+), 3 deletions(-)

(limited to 'indra/llui')

diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index aa5779d45f..f84625bea7 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -283,6 +283,9 @@ public:
 
 	void			resetContextMenu() { setContextMenu(NULL); };
 
+	void			setBgImage(LLPointer<LLUIImage> image) { mBgImage = image; }
+	void			setBgImageFocused(LLPointer<LLUIImage> image) { mBgImageFocused = image; }
+
 private:
 	// private helper methods
 
diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp
index 1fdd05a11c..bafeef41fb 100644
--- a/indra/llui/llsearcheditor.cpp
+++ b/indra/llui/llsearcheditor.cpp
@@ -34,7 +34,11 @@
 LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
 :	LLUICtrl(p),
 	mSearchButton(NULL),
-	mClearButton(NULL)
+	mClearButton(NULL),
+	mEditorImage(p.background_image),
+	mEditorImageFocused(p.background_image_focused),
+	mEditorSearchImage(p.background_image_highlight),
+	mHighlightTextField(p.highlight_text_field)
 {
 	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;
@@ -57,6 +61,8 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
 	// Set up line editor.
 	LLLineEditor::Params line_editor_params(p);
 	line_editor_params.name("filter edit box");
+	line_editor_params.background_image(p.background_image);
+	line_editor_params.background_image_focused(p.background_image_focused);
 	line_editor_params.rect(getLocalRect());
 	line_editor_params.follows.flags(FOLLOWS_ALL);
 	line_editor_params.text_pad_left(text_pad_left);
@@ -104,6 +110,20 @@ void LLSearchEditor::draw()
 	if (mClearButton)
 		mClearButton->setVisible(!mSearchEditor->getWText().empty());
 
+	if (mHighlightTextField)
+	{	
+		if (!mSearchEditor->getWText().empty())
+		{
+			mSearchEditor->setBgImage(mEditorSearchImage);
+			mSearchEditor->setBgImageFocused(mEditorSearchImage);
+		}
+		else
+		{
+			mSearchEditor->setBgImage(mEditorImage);
+			mSearchEditor->setBgImageFocused(mEditorImageFocused);
+		}
+	}
+
 	LLUICtrl::draw();
 }
 
diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h
index 3b12868225..c0f3c1d60c 100644
--- a/indra/llui/llsearcheditor.h
+++ b/indra/llui/llsearcheditor.h
@@ -47,14 +47,23 @@ public:
 		Optional<LLButton::Params>	search_button, 
 									clear_button;
 		Optional<bool>				search_button_visible, 
-									clear_button_visible;
+									clear_button_visible,
+									highlight_text_field;
 		Optional<commit_callback_t> keystroke_callback;
 
+		Optional<LLUIImage*>		background_image,
+									background_image_focused,
+									background_image_highlight;
+
 		Params()
 		:	search_button("search_button"),
 			search_button_visible("search_button_visible"),
 			clear_button("clear_button"), 
-			clear_button_visible("clear_button_visible")
+			clear_button_visible("clear_button_visible"),
+			highlight_text_field("highlight_text_field"),
+			background_image("background_image"),
+			background_image_focused("background_image_focused"),
+			background_image_highlight("background_image_highlight")
 		{}
 	};
 
@@ -93,6 +102,13 @@ protected:
 	LLLineEditor* mSearchEditor;
 	LLButton* mSearchButton;
 	LLButton* mClearButton;
+
+	LLPointer<LLUIImage> mEditorImage;
+	LLPointer<LLUIImage> mEditorImageFocused;
+	LLPointer<LLUIImage> mEditorSearchImage;
+	LLPointer<LLUIImage> mEditorSearchImageFocused;
+
+	bool mHighlightTextField;
 };
 
 #endif  // LL_SEARCHEDITOR_H
-- 
cgit v1.2.3