mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 01:16:18 +02:00
Gtk3: implemented listview ItemDisplayRect
This commit is contained in:
parent
c2974f91ee
commit
cc4e6da36b
@ -641,6 +641,7 @@ type
|
||||
|
||||
procedure UpdateItem(AIndex:integer;AItem: TListItem);
|
||||
procedure ItemDelete(AIndex: Integer);
|
||||
function ItemDisplayRect(AIndex: Integer; ASubItem: integer; ACode: TDisplayCode): TRect;
|
||||
procedure ItemInsert(AIndex: Integer; AItem: TListItem);
|
||||
procedure ItemSetText(AIndex, ASubIndex: Integer; AItem: TListItem; const AText: String);
|
||||
procedure ItemSetImage(AIndex, ASubIndex: Integer; AItem: TListItem);
|
||||
@ -2079,6 +2080,7 @@ begin
|
||||
gtk_grab_add(GetContainerWidget);
|
||||
end;
|
||||
|
||||
|
||||
function TGtk3Widget.GtkEventKey(Sender: PGtkWidget; Event: PGdkEvent; AKeyPress: Boolean): Boolean;
|
||||
cdecl;
|
||||
const
|
||||
@ -2117,15 +2119,16 @@ begin
|
||||
else
|
||||
writeln('GtkEventKey: Gtk3Widget ',dbgsName(TGtk3Widget(TempWidget)));
|
||||
{$ENDIF}
|
||||
|
||||
if gdk_keyval_is_lower(AEvent.keyval) then
|
||||
KeyValue := Word(gdk_keyval_to_upper(AEvent.keyval))
|
||||
else
|
||||
KeyValue := Word(AEvent.keyval);
|
||||
|
||||
// state=16 = numlock= on.
|
||||
|
||||
LCLModifiers := GtkModifierStateToShiftState(AEvent.state, True);
|
||||
|
||||
|
||||
if length(AEventString) = 0 then
|
||||
begin
|
||||
if KeyValue = GDK_KEY_Alt_L then
|
||||
@ -2155,7 +2158,7 @@ begin
|
||||
if AKeyPress and (ACharCode = VK_TAB) then
|
||||
begin
|
||||
if Sender^.is_focus then
|
||||
Self.LCLObject.SelectNext(Self.LCLObject,true,true);
|
||||
Self.LCLObject.SelectNext(Self.LCLObject,true,true);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -7232,6 +7235,36 @@ begin
|
||||
gtk_list_store_remove(PGtkListStore(AModel), @Iter);
|
||||
end;
|
||||
|
||||
function TGtk3ListView.ItemDisplayRect(AIndex: Integer; ASubItem: integer;
|
||||
ACode: TDisplayCode): TRect;
|
||||
var
|
||||
AModel: PGtkTreeModel;
|
||||
Iter: TGtkTreeIter;
|
||||
Column: PGtkTreeViewColumn;
|
||||
Path: PGtkTreePath;
|
||||
ItemRect: TGdkRectangle;
|
||||
cell: PGtkCellRenderer;
|
||||
y, x: gint;
|
||||
begin
|
||||
Result := Rect(0, 0, 0, 0);
|
||||
if IsTreeView then
|
||||
AModel := PGtkTreeView(getContainerWidget)^.get_model
|
||||
else
|
||||
AModel := PGtkIconView(getContainerWidget)^.get_model;
|
||||
Path := gtk_tree_path_new_from_indices(AIndex, [-1]);
|
||||
try
|
||||
if Self.IsTreeView then
|
||||
begin
|
||||
Column := gtk_tree_view_get_column(PGtkTreeView(GetContainerWidget), ASubItem);
|
||||
gtk_tree_view_get_cell_area(PGtkTreeView(GetContainerWidget), Path, Column, @ItemRect);
|
||||
end else
|
||||
gtk_icon_view_get_cell_rect(PGtkIconView(getContainerWidget), Path, nil, @ItemRect);
|
||||
Result := RectFromGdkRect(ItemRect);
|
||||
finally
|
||||
gtk_tree_path_free(Path);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGtk3ListView.ItemInsert(AIndex: Integer; AItem: TListItem);
|
||||
var
|
||||
AModel: PGtkTreeModel;
|
||||
|
@ -636,8 +636,10 @@ class function TGtk3WSCustomListView.ItemDisplayRect(
|
||||
const ALV: TCustomListView; const AIndex, ASubItem: Integer;
|
||||
ACode: TDisplayCode): TRect;
|
||||
begin
|
||||
DebugLn('TGtk3WSCustomListView.ItemDisplayRect ');
|
||||
Result := Rect(0, 0, 0, 0);
|
||||
//DebugLn('TGtk3WSCustomListView.ItemDisplayRect ');
|
||||
if not WSCheckHandleAllocated(ALV, 'ItemDisplayRect') then
|
||||
Exit;
|
||||
Result := TGtk3ListView(ALV.Handle).ItemDisplayRect(AIndex, ASubItem, ACode);
|
||||
end;
|
||||
|
||||
class procedure TGtk3WSCustomListView.ItemExchange(const ALV: TCustomListView;
|
||||
|
Loading…
Reference in New Issue
Block a user