gtk2: fix TListview.GetItemAtXY (issue #0013845)

git-svn-id: trunk@20272 -
This commit is contained in:
paul 2009-05-28 01:59:30 +00:00
parent 07ef806b61
commit c5b68e067f

View File

@ -1199,13 +1199,22 @@ var
Widgets: PTVWidgets;
ItemPath: PGtkTreePath;
Column: PGtkTreeViewColumn;
cx, cy: gint;
begin
Result := -1;
if not WSCheckHandleAllocated(ALV, 'GetItemAt')
then Exit;
GetCommonTreeViewWidgets(PGtkWidget(ALV.Handle), Widgets);
// convert X, Y to bin window coords
x := x + Round(PGtkTreeView(Widgets^.MainView)^.priv^.hadjustment^.value);
if GTK_TREE_VIEW_FLAG_SET(PGtkTreeView(Widgets^.MainView), GTK_TREE_VIEW_HEADERS_VISIBLE) then
begin
gdk_window_get_size(PGtkTreeView(Widgets^.MainView)^.priv^.header_window, @cx, @cy);
y := y - cy;
end;
if gtk_tree_view_get_path_at_pos(PGtkTreeView(Widgets^.MainView), x, y, ItemPath, Column, nil, nil) then
begin
if ItemPath <> nil then