From a4f840e15bf0a3692741876e27766d606e6d942c Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Tue, 15 Jun 2021 18:53:32 +0200 Subject: UI: Support right aligned non-shortcut hints in widgets Widget drawing code already supported drawing right-aligned, grayed out shortcut strings. This patch generalizes things a bit so this can also be used to draw other hints in the same way. There have been a few instances in the past where this would've been useful, D11046 being the latest one. Note that besides some manual regression testing, I didn't check if this works yet, as there is no code actually using it (other than the shortcuts). Can be checked as part of further development for D11046. A possible further improvement would be providing a way to define how clipping should be done. E.g. sometimes the right-aligned text should be clipped first (because it's just a hint), in other cases it should be left untouched (like current code explicitly does it for shortcuts). Removes the `UI_BUT_HAS_SHORTCUT` flag, which isn't needed anymore. --- source/blender/editors/include/UI_interface.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/include') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 1d335c500ca..df65c602fc4 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -290,18 +290,14 @@ enum { /** Active right part of number button */ UI_BUT_ACTIVE_RIGHT = 1 << 22, - /* (also used by search buttons to enforce shortcut display for their items). */ - /** Button has shortcut text. */ - UI_BUT_HAS_SHORTCUT = 1 << 23, - /** Reverse order of consecutive off/on icons */ - UI_BUT_ICON_REVERSE = 1 << 24, + UI_BUT_ICON_REVERSE = 1 << 23, /** Value is animated, but the current value differs from the animated one. */ - UI_BUT_ANIMATED_CHANGED = 1 << 25, + UI_BUT_ANIMATED_CHANGED = 1 << 24, /* Draw the checkbox buttons inverted. */ - UI_BUT_CHECKBOX_INVERT = 1 << 26, + UI_BUT_CHECKBOX_INVERT = 1 << 25, }; /* scale fixed button widths by this to account for DPI */ -- cgit v1.2.3