mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 00:02:03 +02:00
Gtk2: fixed icons size in TListView when using OnCustomDrawItem. issue #27043
git-svn-id: trunk@46853 -
This commit is contained in:
parent
1607deedbe
commit
591d6edbff
@ -2120,6 +2120,8 @@ var
|
||||
bitmap: PGdkBitmap;
|
||||
Width, Height: integer;
|
||||
i: Integer;
|
||||
APGList: PGList;
|
||||
pixrenderer: PGtkCellRenderer;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ALV, 'SetImageList')
|
||||
then Exit;
|
||||
@ -2168,6 +2170,18 @@ begin
|
||||
pixbuf := gdk_pixbuf_copy(GDIObj^.GDIPixbufObject);
|
||||
end;
|
||||
end;
|
||||
if GTK_IS_TREE_VIEW(Widgets^.MainView) and (TLVHack(ALV).Columns.Count > 0) and
|
||||
not TLVHack(ALV).OwnerDraw then
|
||||
begin
|
||||
APGList := gtk_tree_view_column_get_cell_renderers(gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), 0));
|
||||
pixrenderer := PGtkCellRenderer(g_list_last(APGList)^.prev^.data);
|
||||
if Assigned(pixbuf) then
|
||||
gtk_cell_renderer_set_fixed_size(pixrenderer, gdk_pixbuf_get_width(pixbuf) + 4, gdk_pixbuf_get_height(pixbuf) + 4)
|
||||
else
|
||||
gtk_cell_renderer_set_fixed_size(pixrenderer, -1, -1);
|
||||
g_list_free(APGList);
|
||||
gtk_tree_view_column_queue_resize(gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), 0));
|
||||
end;
|
||||
Widgets^.Images.Add(pixbuf);
|
||||
finally
|
||||
BitImage.Free;
|
||||
|
Loading…
Reference in New Issue
Block a user