mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 21:29:26 +02:00
Gtk3: fixed TCustomListView setting clDefault color, fixed ItemDisplayRect.
This commit is contained in:
parent
0a2ec46c51
commit
8a902339bf
@ -6927,10 +6927,14 @@ procedure TGtk3ListView.SetColor(AValue: TColor);
|
|||||||
var
|
var
|
||||||
ADisabledColor, BgColor: TGdkRGBA;
|
ADisabledColor, BgColor: TGdkRGBA;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
BgColor := TColortoTGdkRGBA(ColorToRgb(AValue));
|
BgColor := TColortoTGdkRGBA(ColorToRgb(AValue));
|
||||||
|
|
||||||
getContainerWidget^.get_style_context^.get_background_color([GTK_STATE_FLAG_INSENSITIVE], @ADisabledColor);
|
getContainerWidget^.get_style_context^.get_background_color([GTK_STATE_FLAG_INSENSITIVE], @ADisabledColor);
|
||||||
//override all
|
//override all
|
||||||
|
if AValue = clDefault then
|
||||||
|
gtk_widget_override_background_color(getContainerWidget, GTK_STATE_FLAG_NORMAL, nil)
|
||||||
|
else
|
||||||
gtk_widget_override_background_color(getContainerWidget, GTK_STATE_FLAG_NORMAL, @BgColor);
|
gtk_widget_override_background_color(getContainerWidget, GTK_STATE_FLAG_NORMAL, @BgColor);
|
||||||
//return system highlight color
|
//return system highlight color
|
||||||
BgColor := TColortoTGdkRGBA(ColorToRgb(clHighlight));
|
BgColor := TColortoTGdkRGBA(ColorToRgb(clHighlight));
|
||||||
@ -7305,11 +7309,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
Column := gtk_tree_view_get_column(PGtkTreeView(GetContainerWidget), ASubItem);
|
Column := gtk_tree_view_get_column(PGtkTreeView(GetContainerWidget), ASubItem);
|
||||||
gtk_tree_view_get_cell_area(PGtkTreeView(GetContainerWidget), Path, Column, @ItemRect);
|
gtk_tree_view_get_cell_area(PGtkTreeView(GetContainerWidget), Path, Column, @ItemRect);
|
||||||
gtk_tree_view_convert_bin_window_to_widget_coords(
|
|
||||||
PGtkTreeView(GetContainerWidget),
|
|
||||||
ItemRect.x, ItemRect.y, @x, @y);
|
|
||||||
ItemRect.x := x;
|
|
||||||
ItemRect.y := y;
|
|
||||||
end else
|
end else
|
||||||
gtk_icon_view_get_cell_rect(PGtkIconView(getContainerWidget), Path, nil, @ItemRect);
|
gtk_icon_view_get_cell_rect(PGtkIconView(getContainerWidget), Path, nil, @ItemRect);
|
||||||
Result := RectFromGdkRect(ItemRect);
|
Result := RectFromGdkRect(ItemRect);
|
||||||
@ -7364,8 +7363,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk3ListView.ItemPosition(AIndex: integer): TPoint;
|
function TGtk3ListView.ItemPosition(AIndex: integer): TPoint;
|
||||||
|
var
|
||||||
|
x, y: gint;
|
||||||
begin
|
begin
|
||||||
Result := ItemDisplayRect(AIndex, 0, drBounds).TopLeft;
|
Result := ItemDisplayRect(AIndex, 0, drBounds).TopLeft;
|
||||||
|
if IsTreeView then
|
||||||
|
begin
|
||||||
|
gtk_tree_view_convert_bin_window_to_widget_coords(
|
||||||
|
PGtkTreeView(GetContainerWidget),
|
||||||
|
Result.x, Result.y, @x, @y);
|
||||||
|
Result.x := x;
|
||||||
|
Result.y := y;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtk3ListView.UpdateItem(AIndex:integer;AItem: TListItem);
|
procedure TGtk3ListView.UpdateItem(AIndex:integer;AItem: TListItem);
|
||||||
|
Loading…
Reference in New Issue
Block a user