Drag Drop: allow customizable drawing

This commit is contained in:
Germano Cavalcante 2021-10-25 10:07:00 -03:00
parent e8027ec2a0
commit b17038db31
2 changed files with 15 additions and 0 deletions

View File

@ -740,6 +740,10 @@ struct wmDropBox *WM_dropbox_add(
void (*copy)(struct wmDrag *, struct wmDropBox *),
void (*cancel)(struct Main *, struct wmDrag *, struct wmDropBox *),
WMDropboxTooltipFunc tooltip);
void WM_drag_draw_item_name_fn(struct bContext *C,
struct wmWindow *win,
struct wmDrag *drag,
const int xy[2]);
void WM_drag_draw_default_fn(struct bContext *C,
struct wmWindow *win,
struct wmDrag *drag,

View File

@ -670,6 +670,17 @@ static void wm_drag_draw_item_name(wmDrag *drag, const int x, const int y)
UI_fontstyle_draw_simple(fstyle, x, y, WM_drag_get_item_name(drag), text_col);
}
void WM_drag_draw_item_name_fn(bContext *UNUSED(C),
wmWindow *UNUSED(win),
wmDrag *drag,
const int xy[2])
{
int x = xy[0] + 10 * UI_DPI_FAC;
int y = xy[1] + 1 * UI_DPI_FAC;
wm_drag_draw_item_name(drag, x, y);
}
static void wm_drag_draw_tooltip(bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])
{
if (!CTX_wm_region(C)) {