gtk2: use different way to get TListItem focused - it was the same as selected before

git-svn-id: trunk@24694 -
This commit is contained in:
paul 2010-04-18 13:26:53 +00:00
parent 6ac3997a9f
commit 7295a7d531

View File

@ -927,6 +927,8 @@ class function TGtk2WSCustomListView.ItemGetState(const ALV: TCustomListView;
var var
Widgets: PTVWidgets; Widgets: PTVWidgets;
Path: PGtkTreePath; Path: PGtkTreePath;
Column: PGtkTreeColumn;
Cell: PGtkCellRendere;
begin begin
Result := False; Result := False;
@ -950,14 +952,16 @@ begin
lisFocused: lisFocused:
begin begin
Path := gtk_tree_path_new_from_string(PChar(IntToStr(AIndex)));
if GTK_IS_TREE_VIEW(MainView) then if GTK_IS_TREE_VIEW(MainView) then
AIsSet := gtk_tree_selection_path_is_selected(TreeSelection, Path) gtk_tree_view_get_cursor(PGtkTreeView(MainView), Path, Column)
{$IFDEF GTK_2_8}
else else
if GTK_IS_ICON_VIEW(MainView) then if GTK_IS_ICON_VIEW(MainView) then
AIsSet := gtk_icon_view_path_is_selected(PGtkIconView(MainView), Path) gtk_icon_view_get_cursor(PGtkIconView(MainView), Path, Cell)
{$ENDIF}
else else
AIsSet := False; Path := nil;
AIsSet := (Path <> nil) and (StrToInt(gtk_tree_path_to_string(path)) = AIndex);
gtk_tree_path_free(Path); gtk_tree_path_free(Path);
Result := True; Result := True;
end; end;
@ -1083,6 +1087,7 @@ begin
else else
gtk_tree_view_set_cursor(PGtkTreeView(MainView), nil, nil, False); gtk_tree_view_set_cursor(PGtkTreeView(MainView), nil, nil, False);
end end
{$IFDEF GTK_2_8}
else else
if GTK_IS_ICON_VIEW(MainView) then if GTK_IS_ICON_VIEW(MainView) then
begin begin
@ -1090,7 +1095,8 @@ begin
gtk_icon_view_set_cursor(PGtkIconView(MainView), Path, nil, False) gtk_icon_view_set_cursor(PGtkIconView(MainView), Path, nil, False)
else else
gtk_icon_view_set_cursor(PGtkIconView(MainView), nil, nil, False); gtk_icon_view_set_cursor(PGtkIconView(MainView), nil, nil, False);
end; end
{$ENDIF};
gtk_tree_path_free(Path); gtk_tree_path_free(Path);
end; end;