mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
LibGUI: Add visual indicators for accepted drags to view classes
All the view classes used in FileManager now indicate when they are ready to accept a drop by showing a rounded rectangle around the item.
This commit is contained in:
parent
607c01fad1
commit
9e60fc5006
4 changed files with 13 additions and 1 deletions
|
@ -154,6 +154,10 @@ void ColumnsView::paint_event(PaintEvent& event)
|
|||
painter.draw_focus_rect(row_rect, palette().focus_outline());
|
||||
}
|
||||
|
||||
if (has_pending_drop() && index == drop_candidate_index()) {
|
||||
painter.draw_rect(row_rect, palette().selection(), true);
|
||||
}
|
||||
|
||||
bool expandable = model()->row_count(index) > 0;
|
||||
if (expandable) {
|
||||
Gfx::IntRect arrow_rect = {
|
||||
|
|
|
@ -561,7 +561,7 @@ void IconView::paint_event(PaintEvent& event)
|
|||
draw_item_text(painter, item_data.index, item_data.selected, item_data.text_rect, item_data.text, font, Gfx::TextAlignment::Center, Gfx::TextElision::Right);
|
||||
}
|
||||
|
||||
if (item_data.index == drop_candidate_index()) {
|
||||
if (has_pending_drop() && item_data.index == drop_candidate_index()) {
|
||||
// FIXME: This visualization is not great, as it's also possible to drop things on the text label..
|
||||
painter.draw_rect(item_data.icon_rect.inflated(8, 8), palette().selection(), true);
|
||||
}
|
||||
|
|
|
@ -161,6 +161,10 @@ void TableView::paint_event(PaintEvent& event)
|
|||
painter.draw_rect(row_rect, widget_background_color);
|
||||
painter.draw_focus_rect(row_rect, palette().focus_outline());
|
||||
}
|
||||
|
||||
if (has_pending_drop() && selection_behavior() == SelectionBehavior::SelectRows && row_index == drop_candidate_index().row()) {
|
||||
painter.draw_rect(row_rect, palette().selection(), true);
|
||||
}
|
||||
++painted_item_index;
|
||||
};
|
||||
|
||||
|
|
|
@ -378,6 +378,10 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
else
|
||||
painter.blit(toggle_rect.location(), *m_expand_bitmap, m_expand_bitmap->rect());
|
||||
}
|
||||
|
||||
if (has_pending_drop() && index == drop_candidate_index()) {
|
||||
painter.draw_rect(rect, palette().selection(), true);
|
||||
}
|
||||
}
|
||||
x_offset += column_width + horizontal_padding() * 2;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue