mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-21 22:59:27 +02:00
Cocoa/ListView: implement ItemExchange() #41124, patch by David Jenkins with modification
This commit is contained in:
parent
72f42b17e1
commit
d713e3b541
@ -171,6 +171,7 @@ type
|
||||
// Item
|
||||
procedure ItemDelete( const AIndex: Integer); override;
|
||||
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
||||
procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); override;
|
||||
function ItemGetPosition( const AIndex: Integer): TPoint; override;
|
||||
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
||||
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); override;
|
||||
@ -1142,6 +1143,13 @@ begin
|
||||
Result:= NSRectToRect( frame );
|
||||
end;
|
||||
|
||||
procedure TCocoaWSListView_CollectionViewHandler.ItemExchange(
|
||||
const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer
|
||||
);
|
||||
begin
|
||||
// not supported yet
|
||||
end;
|
||||
|
||||
function TCocoaWSListView_CollectionViewHandler.ItemGetPosition(
|
||||
const AIndex: Integer): TPoint;
|
||||
var
|
||||
|
@ -133,6 +133,7 @@ type
|
||||
// Item
|
||||
procedure ItemDelete( const AIndex: Integer); virtual; abstract;
|
||||
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; virtual; abstract;
|
||||
procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); virtual; abstract;
|
||||
function ItemGetPosition( const AIndex: Integer): TPoint; virtual; abstract;
|
||||
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; virtual; abstract; // returns True if supported
|
||||
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); virtual; abstract;
|
||||
|
@ -212,6 +212,7 @@ type
|
||||
// Item
|
||||
procedure ItemDelete( const AIndex: Integer); override;
|
||||
function ItemDisplayRect( const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
||||
procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); override;
|
||||
function ItemGetPosition( const AIndex: Integer): TPoint; override;
|
||||
function ItemGetState( const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
||||
procedure ItemInsert( const AIndex: Integer; const {%H-}AItem: TListItem); override;
|
||||
@ -1744,6 +1745,12 @@ begin
|
||||
Result:= NSRectToRect( frame );
|
||||
end;
|
||||
|
||||
procedure TCocoaWSListView_TableViewHandler.ItemExchange(
|
||||
const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer);
|
||||
begin
|
||||
_tableView.lclExchangeItem( AIndex1, AIndex2 );
|
||||
end;
|
||||
|
||||
function TCocoaWSListView_TableViewHandler.ItemGetPosition(
|
||||
const AIndex: Integer): TPoint;
|
||||
var
|
||||
@ -1757,12 +1764,18 @@ end;
|
||||
function TCocoaWSListView_TableViewHandler.ItemGetState(
|
||||
const AIndex: Integer; const AItem: TListItem; const AState: TListItemState;
|
||||
out AIsSet: Boolean): Boolean;
|
||||
var
|
||||
lclcb : TLCLListViewCallback;
|
||||
begin
|
||||
Result:= false;
|
||||
lclcb:= getCallback;
|
||||
if NOT Assigned(lclcb) then
|
||||
Exit;
|
||||
|
||||
case AState of
|
||||
lisSelected: begin
|
||||
Result:= (AIndex>=0) and (AIndex <= _tableView.numberOfRows);
|
||||
AIsSet:= _tableView.isRowSelected(AIndex);
|
||||
AIsSet:= lclcb.getItemStableSelection( AIndex );
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -44,6 +44,7 @@ type
|
||||
// Item
|
||||
class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); override;
|
||||
class function ItemDisplayRect(const ALV: TCustomListView; const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
|
||||
class procedure ItemExchange(const ALV: TCustomListView; AItem: TListItem; const AIndex1, AIndex2: Integer); override;
|
||||
class function ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem): Boolean; override;
|
||||
class function ItemGetPosition(const ALV: TCustomListView; const AIndex: Integer): TPoint; override;
|
||||
class function ItemGetState(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
|
||||
@ -317,6 +318,16 @@ begin
|
||||
Result:= WSHandler.ItemDisplayRect( AIndex, ASubItem, ACode );
|
||||
end;
|
||||
|
||||
class procedure TCocoaWSCustomListView.ItemExchange(const ALV: TCustomListView;
|
||||
AItem: TListItem; const AIndex1, AIndex2: Integer);
|
||||
var
|
||||
WSHandler: TCocoaWSListViewHandler;
|
||||
begin
|
||||
WSHandler:= getWSHandler( ALV );
|
||||
if Assigned(WSHandler) then
|
||||
WSHandler.ItemExchange(ALV, AItem, AIndex1, AIndex2);
|
||||
end;
|
||||
|
||||
class function TCocoaWSCustomListView.ItemGetChecked(
|
||||
const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem
|
||||
): Boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user