UI: add UI_SELECT_DRAW flag
Allow to draw as pressed w/o interfering with behavior. Resolves issue where buttons raised on mouse-over.
This commit is contained in:
parent
8a3728800c
commit
9ece0ee5fe
|
@ -119,6 +119,7 @@ enum {
|
|||
UI_ACTIVE = (1 << 2),
|
||||
UI_HAS_ICON = (1 << 3),
|
||||
UI_HIDDEN = (1 << 4),
|
||||
UI_SELECT_DRAW = (1 << 5), /* Display selected, doesn't impact interaction. */
|
||||
/* warn: rest of uiBut->flag in UI_interface.h */
|
||||
};
|
||||
|
||||
|
|
|
@ -846,7 +846,7 @@ static uiBut *uiItemFullO_ptr_ex(
|
|||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
|
||||
if (flag & UI_ITEM_O_DEPRESS) {
|
||||
but->flag |= UI_SELECT;
|
||||
but->flag |= UI_SELECT_DRAW;
|
||||
}
|
||||
|
||||
if (layout->redalert)
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
#define ICON_SIZE_FROM_BUTRECT(rect) (0.8f * BLI_rcti_size_y(rect))
|
||||
|
||||
#define UI_BUT_FLAGS_PUBLIC \
|
||||
(UI_SELECT | UI_SCROLLED | UI_ACTIVE | UI_HAS_ICON | UI_HIDDEN)
|
||||
(UI_SELECT | UI_SCROLLED | UI_ACTIVE | UI_HAS_ICON | UI_HIDDEN | UI_SELECT_DRAW)
|
||||
|
||||
/* Don't overlap w/ UI_BUT_FLAGS_PUBLIC buts. */
|
||||
enum {
|
||||
|
@ -3909,6 +3909,10 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
|
|||
|
||||
state = but->flag & UI_BUT_FLAGS_PUBLIC;
|
||||
|
||||
if (state & UI_SELECT_DRAW) {
|
||||
state |= UI_SELECT;
|
||||
}
|
||||
|
||||
if ((but->editstr) ||
|
||||
(UNLIKELY(but->flag & UI_BUT_DRAG_MULTI) && ui_but_drag_multi_edit_get(but)))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue