diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml b/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml
index 62c202815..10c36d6a4 100644
--- a/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml
+++ b/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml
@@ -2625,6 +2625,7 @@
+ negative_filter=""
+ render_layer="0">
+ h="#h"
+ render_layer="#render_layer">
+ negative_filter="#negative_filter"
+ render_layer="#render_layer">
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
+ global_color="false"
+ render_layer="#render_layer" />
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
+ inherit_gc_alpha="true"
+ render_layer="#render_layer" />
@@ -6337,6 +6352,7 @@
x="0"
y="0"
posref="BL BL"
+ posparent=""
dblink=""
texture=""
tooltip=""
@@ -6345,6 +6361,7 @@
id="but_#id"
button_type="toggle_button"
posref="#posref"
+ posparent="but_#posparent"
x="#x"
y="#y"
tx_normal="w_button_filter_off.tga"
@@ -6371,6 +6388,7 @@
x="0"
y="0"
posref="BL BL"
+ posparent=""
dblink=""
texture=""
tooltip=""
@@ -6379,6 +6397,7 @@
id="but_#id"
button_type="toggle_button"
posref="#posref"
+ posparent="but_#posparent"
x="#x"
y="#y"
tx_normal="w_button_filter_off.tga"
@@ -6553,83 +6572,109 @@
texture="W_line_hor.tga" />
+
+
+
+
+
+
+
-
-
-
+ onchange="inv_set_search"
+ on_focus_lost="inv_search_unfocus"
+ on_focus_lost_params="but_inv_search" />
diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp
index ea233b530..0d23e19ec 100644
--- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp
+++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp
@@ -2528,25 +2528,92 @@ class CHandlerInvDrag : public IActionHandler
};
REGISTER_ACTION_HANDLER( CHandlerInvDrag, "inv_drag" );
-// **********************************************************************************************************
-class CHandlerInvSetSearch : public IActionHandler
+// ***************************************************************************
+// show/hide edit box, set keyboard focus if 'show'
+class CHandlerInvSearchButton : public IActionHandler
{
- void execute (CCtrlBase *pCaller, const std::string &sParams)
+ virtual void execute (CCtrlBase *pCaller, const string &sParams)
+ {
+ if (sParams.empty())
+ {
+ nlwarning("inv_search_button: missing edit box shortid");
+ return;
+ }
+
+ CCtrlBaseButton* btn = dynamic_cast(pCaller);
+ if (!btn)
+ {
+ nlwarning("inv_search_button pCaller == NULL, caller must be CCtrlBaseButton with 'toggle_button' type");
+ return;
+ }
+
+ ucstring filter;
+ std::string id = btn->getParent()->getId() + ":" + sParams + ":eb";
+ CGroupEditBox *eb = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id));
+ if (!eb)
+ {
+ nlwarning("inv_search_button: editbox (%s) not found\n", id.c_str());
+ return;
+ }
+
+ eb->getParent()->setActive(btn->getPushed());
+ if (eb->getParent()->getActive())
+ {
+ CWidgetManager::getInstance()->setCaptureKeyboard(eb);
+ eb->setSelectionAll();
+ filter = eb->getInputString();
+ }
+
+ CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_list"));
+ if (pList != NULL) pList->setSearchFilter(filter);
+
+ CDBGroupIconListBag *pIcons = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(btn->getParent()->getId() + ":bag_icons"));
+ if (pIcons != NULL) pIcons->setSearchFilter(filter);
+ }
+};
+REGISTER_ACTION_HANDLER( CHandlerInvSearchButton, "inv_search_button" );
+
+// ***************************************************************************
+// if :eb is empty then hide edit box, unpush search button
+class CHandlerInvSearchUnfocus : public IActionHandler
+{
+ virtual void execute (CCtrlBase *pCaller, const string &sParams)
{
if (!pCaller) return;
CGroupEditBox *eb = dynamic_cast(pCaller);
- if (!eb) return;
-
- CInterfaceManager *pIM = CInterfaceManager::getInstance();
+ if (!eb || !eb->getInputString().empty()) return;
// ui:interface:inventory:content:bag:iil:inv_query_eb:eb
- string invId = pCaller->getParent()->getParent()->getId();
+ std::string id = pCaller->getParent()->getParent()->getId() + ":" + sParams;
+ CCtrlBaseButton *btn = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id));
+ if (btn) btn->setPushed(false);
- CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(invId + ":bag_list"));
+ // hide :inv_query_eb
+ pCaller->getParent()->setActive(false);
+
+ // clear filter
+ CAHManager::getInstance()->runActionHandler("inv_set_search", pCaller, "");
+ }
+};
+REGISTER_ACTION_HANDLER( CHandlerInvSearchUnfocus, "inv_search_unfocus" );
+
+// **********************************************************************************************************
+// set inventory search string
+class CHandlerInvSetSearch : public IActionHandler
+{
+ void execute (CCtrlBase *pCaller, const std::string &sParams)
+ {
+ CGroupEditBox *eb = dynamic_cast(pCaller);
+ if (!eb) return;
+
+ // ui:interface:inventory:content:bag:iil:inv_query_eb:eb
+ std::string id = pCaller->getParent()->getParent()->getId();
+
+ CDBGroupListSheetBag *pList = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_list"));
if (pList != NULL) pList->setSearchFilter(eb->getInputString());
- CDBGroupIconListBag *pIcons = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(invId + ":bag_icons"));
+ CDBGroupIconListBag *pIcons = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(id + ":bag_icons"));
if (pIcons != NULL) pIcons->setSearchFilter(eb->getInputString());
}
};