mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:19:16 +02:00
Merged revision(s) 47418 #5e5ef0e82a from trunk:
Gtk2: fixed item height. issue #27043 ........ git-svn-id: branches/fixes_1_4@47439 -
This commit is contained in:
parent
fe37d522a6
commit
b8a0eaca2e
@ -1060,6 +1060,10 @@ var
|
||||
R: TRect;
|
||||
ANewCell: PGtkCellRenderer;
|
||||
ANewPath: PGtkTreePath;
|
||||
APGList: PGList;
|
||||
pixrenderer: PGtkCellRenderer;
|
||||
AWidth: gint;
|
||||
AHeight: gint;
|
||||
begin
|
||||
Result := Rect(0, 0, 0, 0);
|
||||
if not WSCheckHandleAllocated(ALV, 'ItemDisplayRect') then
|
||||
@ -1082,6 +1086,19 @@ begin
|
||||
@ARect, @L, @T, @W, @H);
|
||||
inc(ItemRect.y, H);
|
||||
end;
|
||||
|
||||
if (ACode = drIcon) and not TLVHack(ALV).OwnerDraw then
|
||||
begin
|
||||
APGList := gtk_tree_view_column_get_cell_renderers(gtk_tree_view_get_column(PGtkTreeView(MainView), 0));
|
||||
pixrenderer := PGtkCellRenderer(g_list_last(APGList)^.prev^.data);
|
||||
gtk_cell_renderer_get_fixed_size(pixrenderer, @AWidth, @AHeight);
|
||||
if AWidth > 0 then
|
||||
ItemRect.Width := AWidth - 2;
|
||||
if AHeight > 0 then
|
||||
ItemRect.Height := AHeight - 2;
|
||||
g_list_free(APGList);
|
||||
end;
|
||||
|
||||
end
|
||||
else
|
||||
if GTK_IS_ICON_VIEW(MainView) then
|
||||
@ -2141,6 +2158,16 @@ begin
|
||||
if Widgets^.Images = nil then
|
||||
Widgets^.Images := TList.Create;
|
||||
|
||||
if (AValue.Count = 0) and 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);
|
||||
gtk_cell_renderer_set_fixed_size(pixrenderer, AValue.Width + 2, AValue.Height + 2);
|
||||
g_list_free(APGList);
|
||||
gtk_tree_view_column_queue_resize(gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), 0));
|
||||
end;
|
||||
|
||||
for i := 0 to AValue.Count-1 do
|
||||
begin
|
||||
pixbuf := nil;
|
||||
@ -2175,10 +2202,7 @@ begin
|
||||
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);
|
||||
gtk_cell_renderer_set_fixed_size(pixrenderer, AValue.Width + 2, AValue.Height + 2);
|
||||
g_list_free(APGList);
|
||||
gtk_tree_view_column_queue_resize(gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), 0));
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user