diff options
author | Ton Roosendaal <ton@blender.org> | 2009-06-24 20:44:54 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-06-24 20:44:54 +0400 |
commit | 627abe0acf2b52d06fc26e93462f5261cf508879 (patch) | |
tree | 75570a4492b4e35aebdab06a633da73bf016ecb2 /source/blender/editors/interface/interface_regions.c | |
parent | 5b26f520bb50f17b0a2193daf9b8b10616c4707b (diff) |
2.5
Added support for icons in search menu.
It already displays icons for saved materials etc. from old files.
Have to add previewrenders for this still.
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index f7a0e97d05d..a1dae39d687 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -40,6 +40,7 @@ #include "BLI_dynstr.h" #include "BKE_context.h" +#include "BKE_icons.h" #include "BKE_report.h" #include "BKE_screen.h" #include "BKE_texture.h" @@ -433,7 +434,7 @@ struct uiSearchItems { char **names; void **pointers; - + int *icons; }; typedef struct uiSearchboxData { @@ -448,7 +449,7 @@ typedef struct uiSearchboxData { /* exported for use by search callbacks */ /* returns zero if nothing to add */ -int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin) +int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid) { if(items->totitem>=items->maxitem) { @@ -464,6 +465,7 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin) BLI_strncpy(items->names[items->totitem], name, items->maxstrlen); items->pointers[items->totitem]= poin; + items->icons[items->totitem]= iconid; items->totitem++; @@ -639,7 +641,8 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) for(a=0; a<data->items.totitem; a++) { ui_searchbox_butrect(&rect, data, a); - ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], (a+1)==data->active?UI_ACTIVE:0); + /* widget itself */ + ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a+1)==data->active?UI_ACTIVE:0); } /* indicate more */ @@ -666,6 +669,7 @@ static void ui_searchbox_region_free(ARegion *ar) MEM_freeN(data->items.names[a]); MEM_freeN(data->items.names); MEM_freeN(data->items.pointers); + MEM_freeN(data->items.icons); MEM_freeN(data); ar->regiondata= NULL; @@ -794,6 +798,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) data->items.totitem= 0; data->items.names= MEM_callocN(SEARCH_ITEMS*sizeof(void *), "search names"); data->items.pointers= MEM_callocN(SEARCH_ITEMS*sizeof(void *), "search pointers"); + data->items.icons= MEM_callocN(SEARCH_ITEMS*sizeof(int), "search icons"); for(x1=0; x1<SEARCH_ITEMS; x1++) data->items.names[x1]= MEM_callocN(but->hardmax+1, "search pointers"); |