diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 18:20:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-15 18:20:57 +0400 |
commit | 47ad078402c7139a6e91038cd40101010fabbc29 (patch) | |
tree | ca501f19389ce1ad056787f250830616a5ae99c3 | |
parent | 205b554bef36a2fa7a8d5f39be80b413a5ab0c82 (diff) |
show tooltips for menus, currently works for operators and enum properties which are can be accessed as menus from the UI (camera overlay enum for example)
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 16 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 29d37be1dee..0844b9581e3 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1370,7 +1370,7 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) mt->draw(C, &menu); } -static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN) +static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN, const char *tip) { uiBlock *block= layout->root->block; uiBut *but; @@ -1393,11 +1393,11 @@ static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCre w -= 10; if(name[0] && icon) - but= uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, ""); + but= uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip); else if(icon) - but= uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, ""); + but= uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, tip); else - but= uiDefMenuBut(block, func, arg, name, 0, 0, w, h, ""); + but= uiDefMenuBut(block, func, arg, name, 0, 0, w, h, tip); if(argN) { /* ugly .. */ but->poin= (char*)but; @@ -1430,7 +1430,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const if(layout->root->type == UI_LAYOUT_MENU && !icon) icon= ICON_BLANK1; - ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL); + ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, ""); /* TODO, menu description */ } /* label item */ @@ -1514,7 +1514,7 @@ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc if(!func) return; - ui_item_menu(layout, name, icon, func, arg, NULL); + ui_item_menu(layout, name, icon, func, arg, NULL, ""); } typedef struct MenuItemLevel { @@ -1560,7 +1560,7 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname)); lvl->opcontext= layout->root->opcontext; - ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl); + ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, ot->description); } static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) @@ -1593,7 +1593,7 @@ void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propn BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname)); lvl->opcontext= layout->root->opcontext; - ui_item_menu(layout, name, icon, menu_item_enum_rna_menu, NULL, lvl); + ui_item_menu(layout, name, icon, menu_item_enum_rna_menu, NULL, lvl, RNA_property_description(prop)); } /**************************** Layout Items ***************************/ diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 837a9d12af1..513f084b6e8 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -398,7 +398,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } } - if(but->tip && strlen(but->tip)) { + if(but->tip && but->tip[0] != '\0') { BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0])); data->color[data->totline]= 0xFFFFFF; data->totline++; |