diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-19 05:49:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-19 05:50:50 +0300 |
commit | 594790d8a56777c4436b4da2165113d59d57283a (patch) | |
tree | 6f49400d14f2667d2702d708a8418e57f26a492f /source/blender/editors/interface/interface_query.c | |
parent | 7a4ef5256a383c2aba4585a2b80ff715b52bf73b (diff) |
UI: add function to access the buttons text without it's shortcut
Diffstat (limited to 'source/blender/editors/interface/interface_query.c')
-rw-r--r-- | source/blender/editors/interface/interface_query.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index 8534c95b6fd..09429bb6df5 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -23,6 +23,7 @@ #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_rect.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "DNA_screen_types.h" @@ -553,6 +554,12 @@ size_t ui_but_drawstr_len_without_sep_char(const uiBut *but) return strlen(but->drawstr); } +size_t ui_but_drawstr_without_sep_char(const uiBut *but, char *str, size_t str_maxlen) +{ + size_t str_len_clip = ui_but_drawstr_len_without_sep_char(but); + return BLI_strncpy_rlen(str, but->drawstr, min_zz(str_len_clip + 1, str_maxlen)); +} + size_t ui_but_tip_len_only_first_line(const uiBut *but) { if (but->tip == NULL) { |