diff options
author | Julian Eisel <julian@blender.org> | 2020-08-07 16:16:26 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-07 16:17:52 +0300 |
commit | 076a93b855e89fd915779da5991132bc956aa0f4 (patch) | |
tree | fc644fb87df0cefe4b2b18741e87c64d4c58b403 /source/blender/editors/interface/interface_templates.c | |
parent | 9f475db6c984c4333ebca3ba1749831ca1bff04e (diff) |
UI Code Quality: Use derived struct for progessbar buttons
For the main rationale behind this design, see 03b122e2a18df. Further,
this removes users of `uiBut.a1`, which is a very ugly design
choice (hard to reason about).
Part of T74432.
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8593e7e3118..c7d3d7bf501 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6791,22 +6791,24 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) struct ProgressTooltip_Store *tip_arg = MEM_mallocN(sizeof(*tip_arg), __func__); tip_arg->wm = wm; tip_arg->owner = owner; - uiBut *but_progress = uiDefIconTextBut(block, - UI_BTYPE_PROGRESS_BAR, - 0, - 0, - text, - UI_UNIT_X, - 0, - UI_UNIT_X * 6.0f, - UI_UNIT_Y, - NULL, - 0.0f, - 0.0f, - progress, - 0, - NULL); - UI_but_func_tooltip_set(but_progress, progress_tooltip_func, tip_arg); + uiButProgressbar *but_progress = (uiButProgressbar *)uiDefIconTextBut(block, + UI_BTYPE_PROGRESS_BAR, + 0, + 0, + text, + UI_UNIT_X, + 0, + UI_UNIT_X * 6.0f, + UI_UNIT_Y, + NULL, + 0.0f, + 0.0f, + 0.0f, + 0, + NULL); + + but_progress->progress = progress; + UI_but_func_tooltip_set(&but_progress->but, progress_tooltip_func, tip_arg); } if (!wm->is_interface_locked) { |