forked from blender/blender
main sync #3
@ -1037,6 +1037,33 @@ void file_draw_list(const bContext *C, ARegion *region)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const int icon = filelist_geticon(files, i, true);
|
const int icon = filelist_geticon(files, i, true);
|
||||||
|
|
||||||
|
icon_ofs += ICON_DEFAULT_WIDTH_SCALE + 0.2f * UI_UNIT_X;
|
||||||
|
|
||||||
|
/* Add dummy draggable button covering the icon and the label. */
|
||||||
|
if (do_drag) {
|
||||||
|
const uiStyle *style = UI_style_get();
|
||||||
|
const int str_width = UI_fontstyle_string_width(&style->widget, file->name);
|
||||||
|
const int drag_width = MIN2(str_width + icon_ofs, column_width - ATTRIBUTE_COLUMN_PADDING);
|
||||||
|
uiBut *drag_but = uiDefBut(block,
|
||||||
|
UI_BTYPE_LABEL,
|
||||||
|
0,
|
||||||
|
"",
|
||||||
|
tile_draw_rect.xmin,
|
||||||
|
tile_draw_rect.ymin - 1,
|
||||||
|
drag_width,
|
||||||
|
layout->tile_h + layout->tile_border_y * 2,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
UI_but_dragflag_enable(drag_but, UI_BUT_DRAG_FULL_BUT);
|
||||||
|
file_but_enable_drag(drag_but, sfile, file, path, NULL, icon, UI_DPI_FAC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add this after the fake draggable button, so the icon button tooltip is displayed. */
|
||||||
uiBut *icon_but = file_add_icon_but(sfile,
|
uiBut *icon_but = file_add_icon_but(sfile,
|
||||||
block,
|
block,
|
||||||
path,
|
path,
|
||||||
@ -1046,9 +1073,10 @@ void file_draw_list(const bContext *C, ARegion *region)
|
|||||||
ICON_DEFAULT_HEIGHT_SCALE,
|
ICON_DEFAULT_HEIGHT_SCALE,
|
||||||
is_hidden);
|
is_hidden);
|
||||||
if (do_drag) {
|
if (do_drag) {
|
||||||
|
/* For some reason the dragging is unreliable for the icon button if we don't explicitly
|
||||||
|
* enable dragging, even though the dummy drag button above covers the same area. */
|
||||||
file_but_enable_drag(icon_but, sfile, file, path, NULL, icon, UI_DPI_FAC);
|
file_but_enable_drag(icon_but, sfile, file, path, NULL, icon, UI_DPI_FAC);
|
||||||
}
|
}
|
||||||
icon_ofs += ICON_DEFAULT_WIDTH_SCALE + 0.2f * UI_UNIT_X;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_selflag & FILE_SEL_EDITING) {
|
if (file_selflag & FILE_SEL_EDITING) {
|
||||||
|
Loading…
Reference in New Issue
Block a user