Fix selection behavior on right-click in wxGTK wxDataViewCtrl.
Select the item under the cursor even when right-clicking it, because it's expected behavior (Nautilus does it too). Fixes #13531. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75273 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
210a35e384
commit
bae200a453
@ -4441,6 +4441,16 @@ gtk_dataview_button_press_callback( GtkWidget *WXUNUSED(widget),
|
||||
&cell_y
|
||||
);
|
||||
|
||||
// If the right click is on an item that isn't selected, select it, as is
|
||||
// commonly done. Do not do it if the item under mouse is already selected,
|
||||
// because it could be a part of multi-item selection.
|
||||
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dv->GtkGetTreeView()));
|
||||
if ( !gtk_tree_selection_path_is_selected(selection, path) )
|
||||
{
|
||||
gtk_tree_selection_unselect_all(selection);
|
||||
gtk_tree_selection_select_path(selection, path);
|
||||
}
|
||||
|
||||
wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, dv->GetId() );
|
||||
if (path)
|
||||
event.SetItem(dv->GTKPathToItem(path));
|
||||
|
Loading…
Reference in New Issue
Block a user