diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-14 05:38:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-14 05:38:29 +0300 |
commit | 35f431b3d0edda651fda97cb0156181fab07562c (patch) | |
tree | 463161e5b71e2842ff16e9baf33b925aa872e9e4 /source/blender/editors/interface/interface_style.c | |
parent | 17bd906de3ba02c8d7bf848b1f61465f09fc631c (diff) |
Menu UI feature common in other widget sets:
Automatically assign menu keys based on name, alternative to pressing number 0-9 on menus items.
keys are assigned by first giving each menu item the first character of any word, if that fails any key in the name is used.
- active key is shown underlined.
- only ascii keys are assigned currently.
- can run operators, open menu items.
- currently this only works in cases where number buttons were used (UI_BLOCK_NUMSELECT), but could be enabled for file menu, splash etc by removing this check.
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index ec9ac300ca2..af0b2189a99 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -136,7 +136,9 @@ static uiFont *uifont_to_blfont(int id) /* *************** draw ************************ */ -void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, const char *str) + +void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str, + float *r_xofs, float *r_yofs) { float height; int xofs=0, yofs; @@ -171,6 +173,16 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, const char *str) BLF_disable(fs->uifont_id, BLF_SHADOW); if (fs->kerning == 1) BLF_disable(fs->uifont_id, BLF_KERNING_DEFAULT); + + *r_xofs= xofs; + *r_yofs= yofs; +} + +void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, const char *str) +{ + float xofs, yofs; + uiStyleFontDrawExt(fs, rect, str, + &xofs, &yofs); } /* drawn same as above, but at 90 degree angle */ |