From 7ca31bb171b2c94f8e9b928990363a42af8716fb Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 29 Jun 2009 11:29:52 +0000 Subject: 2.5 Search Menu: added feature that on opening, it shows the current ID block, and selects it. Same can be used for other searches, just pass on pointer to active item for the search callback. Also fixed arrow triangle draw for search. --- source/blender/editors/interface/interface_templates.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/interface/interface_templates.c') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a006187c4aa..b128da7b97f 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -112,6 +112,7 @@ static uiBlock *search_menu(bContext *C, ARegion *ar, void *arg_litem) { static char search[256]; static TemplateID template; + PointerRNA idptr; wmEvent event; wmWindow *win= CTX_wm_window(C); uiBlock *block; @@ -122,6 +123,9 @@ static uiBlock *search_menu(bContext *C, ARegion *ar, void *arg_litem) /* arg_litem is malloced, can be freed by parent button */ template= *((TemplateID*)arg_litem); + /* get active id for showing first item */ + idptr= RNA_property_pointer_get(&template.ptr, template.prop); + block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1); @@ -129,7 +133,7 @@ static uiBlock *search_menu(bContext *C, ARegion *ar, void *arg_litem) uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL); but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, 150, 19, ""); - uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb); + uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data); uiBoundsBlock(block, 6); uiBlockSetDirection(block, UI_DOWN); -- cgit v1.2.3